|
@@ -58,7 +58,8 @@ static struct starpu_codelet cl22 =
|
|
|
};
|
|
|
|
|
|
/* Returns the MPI node number where data indexes index is */
|
|
|
-int my_distrib(int x, int y, int nb_nodes) {
|
|
|
+int my_distrib(int x, int y, int nb_nodes)
|
|
|
+{
|
|
|
return (x+y) % nb_nodes;
|
|
|
}
|
|
|
|
|
@@ -79,16 +80,20 @@ static void dw_cholesky(float ***matA, unsigned size, unsigned ld, unsigned nblo
|
|
|
data_handles = malloc(nblocks*sizeof(starpu_data_handle_t *));
|
|
|
for(x=0 ; x<nblocks ; x++) data_handles[x] = malloc(nblocks*sizeof(starpu_data_handle_t));
|
|
|
|
|
|
- for(x = 0; x < nblocks ; x++) {
|
|
|
- for (y = 0; y < nblocks; y++) {
|
|
|
+ for(x = 0; x < nblocks ; x++)
|
|
|
+ {
|
|
|
+ for (y = 0; y < nblocks; y++)
|
|
|
+ {
|
|
|
int mpi_rank = my_distrib(x, y, nodes);
|
|
|
- if (mpi_rank == rank) {
|
|
|
+ if (mpi_rank == rank)
|
|
|
+ {
|
|
|
//fprintf(stderr, "[%d] Owning data[%d][%d]\n", rank, x, y);
|
|
|
starpu_matrix_data_register(&data_handles[x][y], 0, (uintptr_t)matA[x][y],
|
|
|
ld, size/nblocks, size/nblocks, sizeof(float));
|
|
|
}
|
|
|
/* TODO: make better test to only registering what is needed */
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
/* I don't own that index, but will need it for my computations */
|
|
|
//fprintf(stderr, "[%d] Neighbour of data[%d][%d]\n", rank, x, y);
|
|
|
starpu_matrix_data_register(&data_handles[x][y], -1, (uintptr_t)NULL,
|
|
@@ -144,8 +149,10 @@ static void dw_cholesky(float ***matA, unsigned size, unsigned ld, unsigned nblo
|
|
|
|
|
|
starpu_task_wait_for_all();
|
|
|
|
|
|
- for(x = 0; x < nblocks ; x++) {
|
|
|
- for (y = 0; y < nblocks; y++) {
|
|
|
+ for(x = 0; x < nblocks ; x++)
|
|
|
+ {
|
|
|
+ for (y = 0; y < nblocks; y++)
|
|
|
+ {
|
|
|
if (data_handles[x][y])
|
|
|
starpu_data_unregister(data_handles[x][y]);
|
|
|
}
|
|
@@ -209,7 +216,8 @@ int main(int argc, char **argv)
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (display) {
|
|
|
+ if (display)
|
|
|
+ {
|
|
|
printf("[%d] Input :\n", rank);
|
|
|
|
|
|
for(y=0 ; y<nblocks ; y++)
|
|
@@ -221,10 +229,12 @@ int main(int argc, char **argv)
|
|
|
{
|
|
|
for (i = 0; i < BLOCKSIZE; i++)
|
|
|
{
|
|
|
- if (i <= j) {
|
|
|
+ if (i <= j)
|
|
|
+ {
|
|
|
printf("%2.2f\t", bmat[y][x][j +i*BLOCKSIZE]);
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
printf(".\t");
|
|
|
}
|
|
|
}
|
|
@@ -238,7 +248,8 @@ int main(int argc, char **argv)
|
|
|
|
|
|
starpu_mpi_shutdown();
|
|
|
|
|
|
- if (display) {
|
|
|
+ if (display)
|
|
|
+ {
|
|
|
printf("[%d] Results :\n", rank);
|
|
|
for(y=0 ; y<nblocks ; y++)
|
|
|
{
|
|
@@ -249,10 +260,12 @@ int main(int argc, char **argv)
|
|
|
{
|
|
|
for (i = 0; i < BLOCKSIZE; i++)
|
|
|
{
|
|
|
- if (i <= j) {
|
|
|
+ if (i <= j)
|
|
|
+ {
|
|
|
printf("%2.2f\t", bmat[y][x][j +i*BLOCKSIZE]);
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
printf(".\t");
|
|
|
}
|
|
|
}
|
|
@@ -263,10 +276,14 @@ int main(int argc, char **argv)
|
|
|
}
|
|
|
|
|
|
float *rmat = malloc(size*size*sizeof(float));
|
|
|
- for(x=0 ; x<nblocks ; x++) {
|
|
|
- for(y=0 ; y<nblocks ; y++) {
|
|
|
- for (i = 0; i < BLOCKSIZE; i++) {
|
|
|
- for (j = 0; j < BLOCKSIZE; j++) {
|
|
|
+ for(x=0 ; x<nblocks ; x++)
|
|
|
+ {
|
|
|
+ for(y=0 ; y<nblocks ; y++)
|
|
|
+ {
|
|
|
+ for (i = 0; i < BLOCKSIZE; i++)
|
|
|
+ {
|
|
|
+ for (j = 0; j < BLOCKSIZE; j++)
|
|
|
+ {
|
|
|
rmat[j+(y*BLOCKSIZE)+(i+(x*BLOCKSIZE))*size] = bmat[x][y][j +i*BLOCKSIZE];
|
|
|
}
|
|
|
}
|
|
@@ -278,7 +295,8 @@ int main(int argc, char **argv)
|
|
|
{
|
|
|
for (i = 0; i < size; i++)
|
|
|
{
|
|
|
- if (i > j) {
|
|
|
+ if (i > j)
|
|
|
+ {
|
|
|
rmat[j+i*size] = 0.0f; // debug
|
|
|
}
|
|
|
}
|
|
@@ -290,15 +308,18 @@ int main(int argc, char **argv)
|
|
|
rmat, size, 0.0f, test_mat, size);
|
|
|
|
|
|
fprintf(stderr, "[%d] comparing results ...\n", rank);
|
|
|
- if (display) {
|
|
|
+ if (display)
|
|
|
+ {
|
|
|
for (j = 0; j < size; j++)
|
|
|
{
|
|
|
for (i = 0; i < size; i++)
|
|
|
{
|
|
|
- if (i <= j) {
|
|
|
+ if (i <= j)
|
|
|
+ {
|
|
|
printf("%2.2f\t", test_mat[j +i*size]);
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
printf(".\t");
|
|
|
}
|
|
|
}
|
|
@@ -312,7 +333,8 @@ int main(int argc, char **argv)
|
|
|
for (y = 0; y < nblocks; y++)
|
|
|
{
|
|
|
int mpi_rank = my_distrib(x, y, nodes);
|
|
|
- if (mpi_rank == rank) {
|
|
|
+ if (mpi_rank == rank)
|
|
|
+ {
|
|
|
for (i = (size/nblocks)*x ; i < (size/nblocks)*x+(size/nblocks); i++)
|
|
|
{
|
|
|
for (j = (size/nblocks)*y ; j < (size/nblocks)*y+(size/nblocks); j++)
|
|
@@ -321,7 +343,8 @@ int main(int argc, char **argv)
|
|
|
{
|
|
|
float orig = (1.0f/(1.0f+i+j)) + ((i == j)?1.0f*size:0.0f);
|
|
|
float err = abs(test_mat[j +i*size] - orig);
|
|
|
- if (err > 0.00001) {
|
|
|
+ if (err > 0.00001)
|
|
|
+ {
|
|
|
fprintf(stderr, "[%d] Error[%d, %d] --> %2.2f != %2.2f (err %2.2f)\n", rank, i, j, test_mat[j +i*size], orig, err);
|
|
|
correctness = 0;
|
|
|
break;
|