redesign of the init code
=> now, all cores initialize the arrays
This commit is contained in:
parent
97a648020a
commit
a36cc3f3a9
2 changed files with 24 additions and 26 deletions
|
@ -54,9 +54,12 @@
|
|||
//#define FIX 1024
|
||||
#define FIX 1
|
||||
|
||||
#define USE_SVM 1
|
||||
#define MEMTYPE SVM_STRONG
|
||||
//#define MEMTYPE SVM_LAZYRELEASE
|
||||
#define USE_STRONG 1
|
||||
#define USE_LAZYRELEASE 0
|
||||
|
||||
#if USE_STRONG && USE_LAZYRELEASE
|
||||
#error Please, use only one memory model
|
||||
#endif
|
||||
|
||||
static inline double pow(double a, int b)
|
||||
{
|
||||
|
@ -137,15 +140,19 @@ int laplace(void *arg)
|
|||
#endif
|
||||
|
||||
NewValues = (volatile DATA **)kmalloc((N + 2) * sizeof(DATA *));
|
||||
#if USE_SVM
|
||||
NewValues[0] = (DATA *) svmmalloc((N + 2) * (M + 2) * sizeof(DATA), MEMTYPE);
|
||||
#if USE_STRONG
|
||||
NewValues[0] = (DATA *) svmmalloc((N + 2) * (M + 2) * sizeof(DATA), SVM_STRONG);
|
||||
#elif USE_LATYRELEASE
|
||||
NewValues[0] = (DATA *) svmmalloc((N + 2) * (M + 2) * sizeof(DATA), SVM_LAZYRELEASE);
|
||||
#else
|
||||
NewValues[0] = (DATA *) kmalloc((N + 2) * (M + 2) * sizeof(DATA));
|
||||
#endif
|
||||
|
||||
OldValues = (volatile DATA **)kmalloc((N + 2) * sizeof(DATA *));
|
||||
#if USE_SVM
|
||||
OldValues[0] = (DATA *) svmmalloc((N + 2) * (M + 2) * sizeof(DATA), MEMTYPE);
|
||||
#if USE_STRONG
|
||||
OldValues[0] = (DATA *) svmmalloc((N + 2) * (M + 2) * sizeof(DATA), SVM_STRONG);
|
||||
#elif USE_LATYRELEASE
|
||||
OldValues[0] = (DATA *) svmmalloc((N + 2) * (M + 2) * sizeof(DATA), SVM_LAZYRELEASE);
|
||||
#else
|
||||
OldValues[0] = (DATA *) kmalloc((N + 2) * (M + 2) * sizeof(DATA));
|
||||
#endif
|
||||
|
@ -171,8 +178,11 @@ int laplace(void *arg)
|
|||
int height = N + 2;
|
||||
int width = M + 2;
|
||||
|
||||
if (my_rank == 0) {
|
||||
/*if (my_rank == 0) {
|
||||
for (i = 0; i < N + 2; i++) {
|
||||
for (j = 0; j < M + 2; j++) {*/
|
||||
{
|
||||
for (i = I; i < I + n + 2; i++) {
|
||||
for (j = 0; j < M + 2; j++) {
|
||||
|
||||
double X = (((double)j / (double)width) * 5.0) - 2.5;
|
||||
|
@ -186,20 +196,14 @@ int laplace(void *arg)
|
|||
else if (Z > 0.0)
|
||||
Z = 0.0;
|
||||
|
||||
NewValues[i][j] = (DATA) ((Z) * 255.0) * FIX;
|
||||
OldValues[i][j] = NewValues[i][j] = (DATA) ((Z) * 255.0) * FIX;
|
||||
|
||||
//if(NewValues[i][j] < 0) NewValues[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < N + 2; i++) {
|
||||
for (j = 0; j < M + 2; j++) {
|
||||
OldValues[i][j] = NewValues[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_SVM
|
||||
#if USE_LAZYRELEASE
|
||||
svm_flush();
|
||||
svm_invalidate();
|
||||
#endif
|
||||
|
@ -219,12 +223,6 @@ int laplace(void *arg)
|
|||
for (i = 1; i < n + 1; i++) {
|
||||
// over all rows
|
||||
for (j = 1; j < m + 1; j++) {
|
||||
#if !USE_SVM
|
||||
if (j % CACHE_LINE == 1) {
|
||||
asm volatile ("movl %0, %%eax" :: "r"(&(NewValues[I + i][J + j])) : "%eax");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
NewValues[I + i][J + j] =
|
||||
(OldValues[I + i - 1][J + j] +
|
||||
|
@ -238,7 +236,7 @@ int laplace(void *arg)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
#if USE_SVM
|
||||
#if USE_LAZYRELEASE
|
||||
svm_flush();
|
||||
svm_invalidate();
|
||||
#endif
|
||||
|
@ -247,8 +245,8 @@ int laplace(void *arg)
|
|||
NewValues = OldValues;
|
||||
OldValues = tmp;
|
||||
|
||||
RCCE_TNS_barrier(&RCCE_COMM_WORLD);
|
||||
//RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
//RCCE_TNS_barrier(&RCCE_COMM_WORLD);
|
||||
RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
|
||||
#ifdef _USE_GFX
|
||||
if ((my_rank == 0) && (t % 50 == 0)) {
|
||||
|
@ -281,7 +279,7 @@ int laplace(void *arg)
|
|||
|
||||
kprintf("Calculation time: %llu ms (%llu ticks)\n", (end-start)/(1000ULL*get_cpu_frequency()), end-start);
|
||||
|
||||
#if USE_SVM
|
||||
#if USE_STRONG || USE_LAZYRELEASE
|
||||
svm_statistics();
|
||||
#endif
|
||||
}
|
||||
|
|
0
apps/scc_bootinfo.asm
Normal file
0
apps/scc_bootinfo.asm
Normal file
Loading…
Add table
Reference in a new issue