1 //**************************************************************************
2 // Multi-threaded Matrix Multiply benchmark
3 //--------------------------------------------------------------------------
4 // TA : Christopher Celio
8 // This benchmark multiplies two 2-D arrays together and writes the results to
9 // a third vector. The input data (and reference data) should be generated
10 // using the matmul_gendata.pl perl script and dumped to a file named
14 // print out arrays, etc.
17 //--------------------------------------------------------------------------
25 //--------------------------------------------------------------------------
26 // Input/Reference Data
31 //--------------------------------------------------------------------------
32 // Basic Utilities and Multi-thread Support
37 //--------------------------------------------------------------------------
40 extern void __attribute__((noinline
)) matmul(const int coreid
, const int ncores
, const int lda
, const data_t A
[], const data_t B
[], data_t C
[] );
43 //--------------------------------------------------------------------------
46 // all threads start executing thread_entry(). Use their "coreid" to
47 // differentiate between threads (each thread is running on a separate core).
49 void thread_entry(int cid
, int nc
)
51 static data_t results_data
[ARRAY_SIZE
];
53 stats(matmul(cid
, nc
, DIM_SIZE
, input1_data
, input2_data
, results_data
); barrier(nc
), DIM_SIZE
/DIM_SIZE
/DIM_SIZE
);
55 int res
= verifyDouble(ARRAY_SIZE
, results_data
, verify_data
);
58 printArray("results:", ARRAY_SIZE
, results_data
);
59 printArray("verify :", ARRAY_SIZE
, verify_data
);