/*************************************** Auteur : Pierre Aubert Mail : aubertp7@gmail.com Licence : CeCILL-C ****************************************/ #include "randinit.h" #include "micro_benchmark.h" #include "PTensor.h" #include INCLUDE_FUNCTION_NAME ///Get the number of nanoseconds per elements of the Matrix product /** @param nbElement : number of elements of the tables */ void evaluateMatrixProduct(size_t nbElement){ //Allocation of the tensors PTensor tensorX(AllocMode::ALIGNED, nbElement, nbElement); PTensor tensorY(AllocMode::ALIGNED, nbElement, nbElement); PTensor tensorOut(AllocMode::ALIGNED, nbElement, nbElement); size_t fullNbElement(nbElement*nbElement); //Initialisation of the tables tensorOut.fill(0.0f); for(size_t i(0lu); i < fullNbElement; ++i){ tensorX.setValue(i, (float)(i*32lu%17lu) + 42.0f); tensorY.setValue(i, (float)(i*57lu%31lu) + 12.5f); } #if defined(RATIO_NB_NAN) && defined(VALUE_DEF) size_t nbNan((size_t)(RATIO_NB_NAN*((double)fullNbElement))); setValueInTable(tensorX.getData(), fullNbElement, nbNan, VALUE_DEF); setValueInTable(tensorY.getData(), fullNbElement, nbNan, VALUE_DEF); #endif //Stating the timer micro_benchmarkAutoNsPrint("evaluate " KERNEL_STR_FUNCTION_NAME, fullNbElement, FUNCTION_NAME, tensorOut.getData(), tensorX.getData(), tensorY.getData(), nbElement); } int main(int argc, char** argv){ #ifdef DENORM_SET_TO_ZERO _mm_setcsr(_mm_getcsr() | (_MM_DENORMALS_ZERO_ON)); #endif #if defined(RATIO_NB_NAN) && defined(VALUE_DEF) initRandom(); #endif return micro_benchmarkParseArg(argc, argv, evaluateMatrixProduct); }