aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/mt-matmul/matmul.c
blob: 95fbe0303d762ba5f5981a30301448311e4b8606 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "dataset.h"

//--------------------------------------------------------------------------
// single-thread, naive version
//
void __attribute__((noinline)) matmul(const int coreid, const int ncores, const int lda,  const data_t A[], const data_t B[], data_t C[] )
{
   int i, j, k;
  
   for ( i = 0; i < lda; i++ )
   {
      for ( j = 0; j < lda; j++ )  
      {
         for ( k = coreid; k < lda; k+=ncores ) 
         {
            C[i + j*lda] += A[j*lda + k] * B[k*lda + i];
         }
      }
   }
}