[Mpi3-rma] Request-Based RMA Example
William Gropp
wgropp at illinois.edu
Thu Apr 21 16:41:26 CDT 2011
I've added this and posted an update to the wiki. There are a few
bugs in this; please check the wiki version.
Bill
On Apr 19, 2011, at 4:31 PM, James Dinan wrote:
> Hi All,
>
> Example is below, please give any feedback. I'll work on
> compressing this down the match the format in the writeup.
>
> Caption: The following example shows how request-based operations
> can be used to overlap communication with computation. Each process
> fetches, processes, and writes the result for $NSTEPS$ chunks of
> data. Instead of a single buffer, $M$ local buffers are used to
> allow up to $M$ communication operations to overlap with computation.
>
> ~Jim.
>
> ---snip---
>
> int i, j;
> MPI_Window win;
> MPI_Request put_req[M] = { MPI_REQUEST_NULL };
> MPI_Request get_req;
> double data[M][N];
>
> /* Create win: size M*N*sizeof(double), displacement unit MPI_DOUBLE
> */
>
> MPI_Win_lock_all(0, win);
>
> for (i = 0; i < NSTEPS; i++) {
> 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[M], ...);
> MPI_RPut(data[j], N, MPI_DOUBLE, target, i*N, N, MPI_DOUBLE, win,
> &R[j]);
> }
>
> MPI_Waitall(M, put_req, MPI_STATUSES_IGNORE);
> MPI_Win_unlock_all(win);
> _______________________________________________
> mpi3-rma mailing list
> mpi3-rma at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-rma
William Gropp
Director, Parallel Computing Institute
Deputy Director for Research
Institute for Advanced Computing Applications and Technologies
Paul and Cynthia Saylor Professor of Computer Science
University of Illinois Urbana-Champaign
More information about the mpiwg-rma
mailing list