X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c57842fe897f53b46f0be3da87f7c996674be7d6..14a764d0473e5137d70be1909b292579acb112ce:/teshsuite/smpi/mpich3-test/rma/req_example.c diff --git a/teshsuite/smpi/mpich3-test/rma/req_example.c b/teshsuite/smpi/mpich3-test/rma/req_example.c index 5788972d3e..93cd8da9fa 100644 --- a/teshsuite/smpi/mpich3-test/rma/req_example.c +++ b/teshsuite/smpi/mpich3-test/rma/req_example.c @@ -25,15 +25,16 @@ /* Use a global variable to inhibit compiler optimizations in the compute * function. */ double junk = 0.0; - -void compute(int step, double *data) { +void compute(int step, double *data); +void compute(int step, double *data) +{ int i; for (i = 0; i < N; i++) junk += data[i] * (double) step; } -int main( int argc, char *argv[] ) +int main(int argc, char *argv[]) { int i, rank, nproc; int errors = 0, all_errors = 0; @@ -41,7 +42,7 @@ int main( int argc, char *argv[] ) MPI_Request put_req[M] = { MPI_REQUEST_NULL }; MPI_Request get_req; double *baseptr; - double data[M][N]; /* M buffers of length N */ + double data[M][N]; /* M buffers of length N */ MPI_Info win_info; MPI_Init(&argc, &argv); @@ -53,34 +54,33 @@ int main( int argc, char *argv[] ) MPI_Info_create(&win_info); #ifdef USE_WIN_ALLOC_SHM - MPI_Info_set(win_info, "alloc_shm", "true"); + MPI_Info_set(win_info, (char*)"alloc_shm", (char*)"true"); #else - MPI_Info_set(win_info, "alloc_shm", "false"); + MPI_Info_set(win_info, (char*)"alloc_shm", (char*)"false"); #endif - MPI_Win_allocate(NSTEPS*N*sizeof(double), sizeof(double), win_info, + MPI_Win_allocate(NSTEPS * N * sizeof(double), sizeof(double), win_info, MPI_COMM_WORLD, &baseptr, &win); MPI_Win_lock_all(0, win); for (i = 0; i < NSTEPS; i++) { - int target = (rank+1) % nproc; + int target = (rank + 1) % nproc; int j; /* Find a free put request */ if (i < M) { j = i; - } else { + } + else { MPI_Waitany(M, put_req, &j, MPI_STATUS_IGNORE); } - MPI_Rget(data[j], N, MPI_DOUBLE, target, i*N, N, MPI_DOUBLE, win, - &get_req); - MPI_Wait(&get_req,MPI_STATUS_IGNORE); + MPI_Rget(data[j], N, MPI_DOUBLE, target, i * N, N, MPI_DOUBLE, win, &get_req); + MPI_Wait(&get_req, MPI_STATUS_IGNORE); compute(i, data[j]); - MPI_Rput(data[j], N, MPI_DOUBLE, target, i*N, N, MPI_DOUBLE, win, - &put_req[j]); + MPI_Rput(data[j], N, MPI_DOUBLE, target, i * N, N, MPI_DOUBLE, win, &put_req[j]); }