/*************************************** 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 Hadamard product /** @param nbElement : number of elements of the tables */ void evaluateSqrt(size_t nbElement){ //Allocation of the tensors PTensor tensorX(AllocMode::ALIGNED, nbElement); PTensor tensorOut(AllocMode::ALIGNED, nbElement); //Initialisation of the tables tensorOut.fill(0.0f); for(size_t i(0lu); i < nbElement; ++i){ tensorX.setValue(i, (float)(i*32lu%17lu) + 42.0f); } #if defined(RATIO_NB_NAN) && defined(VALUE_DEF) size_t nbNan((size_t)(RATIO_NB_NAN*((double)nbElement))); setValueInTable(tensorX.getData(), nbElement, nbNan, VALUE_DEF); #endif size_t fullNbElement(nbElement); //Stating the timer micro_benchmarkAutoNsPrint("evaluate " KERNEL_STR_FUNCTION_NAME, fullNbElement, FUNCTION_NAME, tensorOut.getData(), tensorX.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, evaluateSqrt); }