Merge branch 'master' into ohligs
Conflicts: kernel/tests.c
This commit is contained in:
commit
e5167d1417
1 changed files with 24 additions and 9 deletions
|
@ -126,11 +126,18 @@ 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;
|
||||
uint32_t i, j, k;
|
||||
int my_ue, num_ues;
|
||||
register int tmp;
|
||||
|
||||
RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
my_ue = RCCE_ue();
|
||||
|
@ -152,7 +159,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");
|
||||
|
@ -161,10 +168,14 @@ static int svm_test(void *arg)
|
|||
start = rdtsc();
|
||||
|
||||
// start calculation
|
||||
for(i=0; i<N; i++)
|
||||
for(j=0; j<N; j++)
|
||||
for(i=0; i<N; i++) {
|
||||
for(j=0; j<N; j++) {
|
||||
tmp = C[i][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);
|
||||
C[i][j] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
end = rdtsc();
|
||||
|
@ -195,7 +206,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,10 +223,14 @@ static int svm_test(void *arg)
|
|||
RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
|
||||
// start calculation
|
||||
for(i=my_ue*(N/num_ues); i<(my_ue+1)*(N/num_ues); i++)
|
||||
for(j=0; j<N; j++)
|
||||
for(i=my_ue*(N/num_ues); i<(my_ue+1)*(N/num_ues); i++) {
|
||||
for(j=0; j<N; j++) {
|
||||
tmp = C[i][j];
|
||||
for(k=0; k<N; k++)
|
||||
C[i][j] += A[i][k] * B[k][j];
|
||||
tmp += A[i][k] * GET_B(k,j);
|
||||
C[i][j] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
svm_flush();
|
||||
|
||||
|
@ -232,7 +247,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