GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixMicroBenchmark/TESTS/HadamardProductAuto/main.cpp
Date: 2025-03-14 12:14:21
Exec Total Coverage
Lines: 0 17 0.0%
Branches: 0 26 0.0%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include "micro_benchmark.h"
8
9 ///Do the Hadamard product
10 /** @param[out] tabResult : table of results of tabX*tabY
11 * @param tabX : input table
12 * @param tabY : input table
13 * @param nbElement : number of elements in the tables
14 */
15 void hadamard_product(float* tabResult, const float* tabX, const float* tabY, size_t nbElement){
16 for(size_t i(0lu); i < nbElement; ++i){
17 tabResult[i] = tabX[i]*tabY[i];
18 }
19 }
20
21 ///Get the number of nanoseconds per elements of the Hadamard product
22 /** @param nbElement : number of elements of the tables
23 */
24 void evaluateHadamardProduct(size_t nbElement){
25 //Allocation of the tables
26 float * tabResult = new float[nbElement];
27 float * tabX = new float[nbElement];
28 float * tabY = new float[nbElement];
29 //Initialisation of the tables
30 for(size_t i(0lu); i < nbElement; ++i){
31 tabX[i] = (float)(i*32lu%17lu);
32 tabY[i] = (float)(i*57lu%31lu);
33 }
34 // size_t nbTestPerf(400lu);
35 // size_t nbCallPerTest(600lu);
36 size_t fullNbElement(nbElement);
37 //Stating the timer
38 // micro_benchmarkNsPrint("evaluateHadamardProduct",
39 // nbTestPerf, nbCallPerTest, fullNbElement, hadamard_product,
40 // tabResult, tabX, tabY, nbElement);
41
42 micro_benchmarkAutoNsPrint("evaluateHadamardProductAuto", fullNbElement, hadamard_product, tabResult, tabX, tabY, nbElement);
43
44 //Deallocate the tables
45 delete[] tabResult;
46 delete[] tabX;
47 delete[] tabY;
48 }
49
50 int main(int argc, char** argv){
51 return micro_benchmarkParseArg(argc, argv, evaluateHadamardProduct);
52 }
53
54