[Mpi3-rma] Updated Example 11.21
James Dinan
dinan at mcs.anl.gov
Tue May 10 15:34:15 CDT 2011
Hi All,
Thanks for the feedback during today's reading. I've attached updated
code for example 11.21. Updated lines are marked with a *. Changes:
- Window size in the comment should have been NSTEPS*N*sizeof(double)
- MPI_STATUS_NULL in waitany errpr fixed with addition of if .. else ..
- s/RGet/Rget/
- compute(..., data[M], ...) -> data[j]
- s/RPut/Rput/
~Jim.
---example 11.21---
int i, j;
MPI_Win win;
MPI_Request put_req[M] = { MPI_REQUEST_NULL };
MPI_Request get_req;
double data[M][N];
* /* Create win: size NSTEPS*N*sizeof(double), displacement unit
MPI_DOUBLE */
MPI_Win_lock_all(0, win);
for (i = 0; i < NSTEPS; i++) {
* if (i < M)
* j = i;
* 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);
* compute(i, data[j], ...);
* MPI_Rput(data[j], N, MPI_DOUBLE, target, i*N, N, MPI_DOUBLE, win,
&put_req[j]);
}
MPI_Waitall(M, put_req, MPI_STATUSES_IGNORE);
MPI_Win_unlock_all(win);
More information about the mpiwg-rma
mailing list