Remove smips/host-debugging cruft
[riscv-tests.git] / benchmarks / mt-matmul / mt-matmul.c
1 // See LICENSE for license details.
2
3 //**************************************************************************
4 // Multi-threaded Matrix Multiply benchmark
5 //--------------------------------------------------------------------------
6 // TA : Christopher Celio
7 // Student:
8 //
9 //
10 // This benchmark multiplies two 2-D arrays together and writes the results to
11 // a third vector. The input data (and reference data) should be generated
12 // using the matmul_gendata.pl perl script and dumped to a file named
13 // dataset.h.
14
15 //--------------------------------------------------------------------------
16 // Includes
17
18 #include <string.h>
19 #include <stdlib.h>
20 #include <stdio.h>
21 #include <stddef.h>
22
23
24 //--------------------------------------------------------------------------
25 // Input/Reference Data
26
27 #include "dataset.h"
28
29
30 //--------------------------------------------------------------------------
31 // Basic Utilities and Multi-thread Support
32
33 #include "util.h"
34
35
36 //--------------------------------------------------------------------------
37 // matmul function
38
39 extern void matmul(const size_t coreid, const size_t ncores, const size_t lda, const data_t A[], const data_t B[], data_t C[] );
40
41
42 //--------------------------------------------------------------------------
43 // Main
44 //
45 // all threads start executing thread_entry(). Use their "coreid" to
46 // differentiate between threads (each thread is running on a separate core).
47
48 void thread_entry(int cid, int nc)
49 {
50 static data_t results_data[ARRAY_SIZE];
51
52 stats(matmul(cid, nc, DIM_SIZE, input1_data, input2_data, results_data); barrier(nc), DIM_SIZE/DIM_SIZE/DIM_SIZE);
53
54 int res = verify(ARRAY_SIZE, results_data, verify_data);
55
56 exit(res);
57 }