95fbe0303d762ba5f5981a30301448311e4b8606
[riscv-tests.git] / benchmarks / mt-matmul / matmul.c
1 #include "dataset.h"
2
3 //--------------------------------------------------------------------------
4 // single-thread, naive version
5 //
6 void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda, const data_t A[], const data_t B[], data_t C[] )
7 {
8 int i, j, k;
9
10 for ( i = 0; i < lda; i++ )
11 {
12 for ( j = 0; j < lda; j++ )
13 {
14 for ( k = coreid; k < lda; k+=ncores )
15 {
16 C[i + j*lda] += A[j*lda + k] * B[k*lda + i];
17 }
18 }
19 }
20 }