bump env
[riscv-tests.git] / mt / an_matmul.c
1 #include "stdlib.h"
2
3 #include "util.h"
4
5 #include "dataset.h"
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
9 // ***************************** //
10 // **** ADD YOUR CODE HERE ***** //
11 int i, j, k, limit, end, kblock, iblock, r, jblock;
12 int tempA1;
13 int tempB1;
14
15 limit = lda / ncores;
16 j = (coreid)*limit;
17 end = (coreid+1)*limit;
18
19 kblock = 1;
20 iblock = 1;
21 jblock = 1;
22 for (; j < end; j+= jblock)
23 for ( k = 0; k < lda; k = k + kblock )
24 {
25 r = j*lda + k;
26 tempA1 = A[r];
27
28 for ( i = 0; i < lda; i = i + iblock ) {
29 tempB1 = k*lda + i;
30
31 C[i + j*lda] += tempA1*B[tempB1];
32
33 }
34 barrier(ncores);
35 }
36 // ***************************** //
37 //
38 // feel free to make a separate function for MI and MSI versions.
39
40 }