[MPICH] How to create a Window for 2D array
Tao He
taohe at blue.weeg.uiowa.edu
Thu Jan 5 16:59:44 CST 2006
Dear All,
I am a newer for One Sided-Communcation. I have a question how to create a window for 2D array. For example, I create a 2D double array by this function:
double** NewMPI2_2DPointer(int n1D, int n2D)
{ double **pp;
int error;
error = MPI_Alloc_mem(n1D * sizeof(double*), MPI_INFO_NULL, &pp);
if (error != MPI_SUCCESS)
{
printf("Memory allocation failed for PP 1D array, aborting.\n");
MPI_Abort(MPI_COMM_WORLD, -1);
exit(-1);
}
for(i=0; i<n1D; i++)
{
error = MPI_Alloc_mem(n2D * sizeof(double), MPI_INFO_NULL, &pp[i]);
if (error != MPI_SUCCESS)
{
printf("Memory allocation failed for PP 1D array, aborting.\n");
MPI_Abort(MPI_COMM_WORLD, -1);
exit(-1);
}
}
}
I want to create a window for this memory:
Like:
error = MPI_Win_create(pp, n1D, sizeof(double*), MPI_INFO_NULL, MPI_COMM_WORLD, &win);
or should be
error = MPI_Win_create(pp, n1D*n2D, sizeof(double), MPI_INFO_NULL, MPI_COMM_WORLD, &win);
Which is the right? Please tell me! THanks very much!
Tao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20060105/dd00f394/attachment.htm>
More information about the mpich-discuss
mailing list