add the possibility to use a transponse matrix B
This commit is contained in:
parent
6a9794dc9b
commit
6fff9c3bc7
1 changed files with 12 additions and 6 deletions
|
@ -120,12 +120,18 @@ static int mail_noise(void*arg) {
|
|||
|
||||
#define N 1024
|
||||
//#define N 514
|
||||
#define LAZY
|
||||
//#define LAZY
|
||||
|
||||
volatile static int* A[N];
|
||||
volatile static int* B[N];
|
||||
volatile static int* C[N];
|
||||
|
||||
#if 0
|
||||
#define GET_B(i, j) B[i][j]
|
||||
#else
|
||||
#define GET_B(i, j) B[j][i]
|
||||
#endif
|
||||
|
||||
static int svm_test(void *arg)
|
||||
{
|
||||
uint64_t start, end;
|
||||
|
@ -152,7 +158,7 @@ static int svm_test(void *arg)
|
|||
for(i=0; i<N; i++) {
|
||||
A[i][i] = 1;
|
||||
for(j=0; j<N; j++)
|
||||
B[i][j] = i+j;
|
||||
GET_B(i,j) = i+j;
|
||||
}
|
||||
|
||||
kputs("Start sequentiell calculation...\n");
|
||||
|
@ -164,7 +170,7 @@ static int svm_test(void *arg)
|
|||
for(i=0; i<N; i++)
|
||||
for(j=0; j<N; j++)
|
||||
for(k=0; k<N; k++)
|
||||
C[i][j] += A[i][k] * B[k][j];
|
||||
C[i][j] += A[i][k] * GET_B(k,j);
|
||||
|
||||
|
||||
end = rdtsc();
|
||||
|
@ -195,7 +201,7 @@ static int svm_test(void *arg)
|
|||
for(i=0; i<N; i++) {
|
||||
A[i][i] = 1;
|
||||
for(j=0; j<N; j++)
|
||||
B[i][j] = i+j;
|
||||
GET_B(i,j) = i+j;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +221,7 @@ static int svm_test(void *arg)
|
|||
for(i=my_ue*(N/num_ues); i<(my_ue+1)*(N/num_ues); i++)
|
||||
for(j=0; j<N; j++)
|
||||
for(k=0; k<N; k++)
|
||||
C[i][j] += A[i][k] * B[k][j];
|
||||
C[i][j] += A[i][k] * GET_B(k,j);
|
||||
|
||||
svm_flush();
|
||||
|
||||
|
@ -232,7 +238,7 @@ static int svm_test(void *arg)
|
|||
for(j=0; (j<N) && (err < 32); j++) {
|
||||
if (C[i][j] != i+j) {
|
||||
err++;
|
||||
kprintf("Wrong value at C[%u][%u] = %u, B[%u][%u] = %u\n", i, j, C[i][j], i, j, B[i][j]);
|
||||
kprintf("Wrong value at C[%u][%u] = %u, B[%u][%u] = %u\n", i, j, C[i][j], i, j, GET_B(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue