Re: chapter 5

William Gropp (gropp@mcs.anl.gov)
Thu, 22 May 1997 09:34:54 -0500

| - But please can you add also a example written in C (same content
| as Example 5.1).
|

I'm not sure that it is worth it, but it is simply (with the Win_create's
added):

float *p;
MPI_Win win;

MPI_Alloc_mem( sizeof(float)*100*100, MPI_INFO_NULL, &p );
...
MPI_Win_create( p, sizeof(float)*100*100, sizeof(float),
MPI_INFO_NULL, MPI_COMM_WORLD, &win );
...
MPI_Free_mem( p );

In C++, it would be:

float *p;

p = MPI::Alloc_mem( sizeof(float)*100*100, MPI::INFO_NULL );
...
win = MPI::Win_create( p, sizeof(float)*100*100, sizeof(float),
MPI::INFO_NULL, MPI::COMM_WORLD );
...
MPI::Free_mem( p );

Note that in both cases, we are using "void *" where "void **" has the
appropriate intent because of a "feature" in C/C++ that makes "void *"
friendlier for users.

Bill