redesign of the SVM benchmark
This commit is contained in:
parent
6f1c07c0dc
commit
b0b9b0996e
1 changed files with 42 additions and 32 deletions
|
@ -131,6 +131,46 @@ static int svm_test(void *arg)
|
|||
my_ue = RCCE_ue();
|
||||
num_ues = RCCE_num_ues();
|
||||
|
||||
#if 1
|
||||
if (!my_ue) {
|
||||
// allocate and initialize SVM region
|
||||
A[0] = (int*) kmalloc(3*N*N*sizeof(int));
|
||||
memset((void*) A[0], 0x00, 3*N*N*sizeof(int));
|
||||
|
||||
// initialize matrices
|
||||
for(i=0; i<N; i++) {
|
||||
A[i] = A[0] + i*N;
|
||||
B[i] = A[0] + (i*N + N*N);
|
||||
C[i] = A[0] + (i*N + 2*N*N);
|
||||
}
|
||||
|
||||
for(i=0; i<N; i++) {
|
||||
A[i][i] = 1;
|
||||
for(j=0; j<N; j++)
|
||||
B[i][j] = i+j;
|
||||
}
|
||||
|
||||
kputs("Start sequentiell calculation...\n");
|
||||
|
||||
start = rdtsc();
|
||||
start = rdtsc();
|
||||
|
||||
// start calculation
|
||||
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];
|
||||
|
||||
|
||||
end = rdtsc();
|
||||
|
||||
kprintf("Calculation time (seq): %llu\n", end-start);
|
||||
kfree(A[0], 3*N*N*sizeof(int));
|
||||
}
|
||||
|
||||
RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
#endif
|
||||
|
||||
// allocate and initialize SVM region
|
||||
A[0] = (int*) svmmalloc(3*N*N*sizeof(int));
|
||||
if (!my_ue)
|
||||
|
@ -153,38 +193,9 @@ static int svm_test(void *arg)
|
|||
svm_flush();
|
||||
|
||||
// Now, we need only read access on A and B
|
||||
//change_page_permissions((size_t) A[0], (size_t) (A[0]+2*N*N), VMA_CACHEABLE|VMA_READ);
|
||||
|
||||
change_page_permissions((size_t) A[0], (size_t) (A[0]+2*N*N), VMA_CACHEABLE|VMA_READ);
|
||||
RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
|
||||
#if 0
|
||||
kputs("Start sequentiell calculation...\n");
|
||||
|
||||
start = rdtsc();
|
||||
start = rdtsc();
|
||||
|
||||
// start calculation
|
||||
if (!my_ue) {
|
||||
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];
|
||||
}
|
||||
|
||||
|
||||
end = rdtsc();
|
||||
|
||||
if (!my_ue) {
|
||||
memset(C[0], 0x00, N*N*sizeof(int));
|
||||
// CL1FLUSH
|
||||
svm_flush();
|
||||
|
||||
kprintf("Calculation time (seq): %llu\n", end-start);
|
||||
}
|
||||
|
||||
|
||||
RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
#endif
|
||||
kputs("Start parallel calculation...\n");
|
||||
|
||||
start = rdtsc();
|
||||
|
@ -198,9 +209,8 @@ static int svm_test(void *arg)
|
|||
|
||||
svm_flush();
|
||||
|
||||
end = rdtsc();
|
||||
|
||||
RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
end = rdtsc();
|
||||
|
||||
kputs("Check results...\n");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue