[Mpi3-rma] MPI_Win_allocate_shared and Win_free

Pavan Balaji balaji at mcs.anl.gov
Fri Jan 18 07:58:22 CST 2013


Isn't this the same problem as the user calling "free" on a buffer given
to MPI_Win_create before doing an MPI_Win_free?

This should be a user error, though I'm not sure we call that out in the
standard.

 -- Pavan

On 01/18/2013 07:26 AM US Central Time, Hubert Ritzdorf wrote:
> Hi,
> 
> I have a question to the memory allocated in MPI_Win_allocate_shared.
> What happens if (see also pseudo code below)
> 
> (*) the allocated memory is used in another MPI_Win_create and
> (*) the window created by MPI_Win_allocate_shared is freed and
> (*) the user program still works with the allocates shared memory
>      before the window created by MPI_Win_create is freed ?
> 
> MPI 3.0, page 415, lines 6-8 specifies:
> 
> If the window was created with MPI_WIN_ALLOCATE_SHARED,
> MPI_WIN_FREE will free the window memory that was allocated
> in MPI_WIN_ALLOCATE_SHARED.
> 
> Thus main question:
> 
> (a) Should the corresponding program fail or
> (b) should the program work correctly (i..e. the MPI library recognizes
>      that the memory is still used in another window) and the shared memory
>      is freed when the window created by MPI_Win_create is freed ?
> 
> Best regards
> 
> Hubert
> 
> ------- Pseudo code -------
> 
>     MPI_Win_allocate_shared (shared_size, disp_unit, shared_info, comm,
>                              &shared_baseptr, &shared_win);
> 
>     MPI_Win_create (shared_baseptr, shared_size, disp_unit,
>                     info2, comm, &win2);
> 
>     /* Non-concurrent work/communication window shared_win */
>     ...
> 
>     /* Non-concurrent communication on window win2 */
>     ...
> 
>     /* Free window shared_win;
>        Is shared_baseptr really deallocated in MPI_Win_free
>        as defined on page 415 lines 6-8 ? */
> 
>     MPI_Win_free (&shared_win);
> 
>     /* Work on window win2 */
>     ...
> 
>     /* Free window win2;
>        Is shared_baseptr deallocated in following MPI_Win_free */
> 
>     MPI_Win_free (&win2);
> 
> 
> 
> 
> _______________________________________________
> mpi3-rma mailing list
> mpi3-rma at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-rma
> 

-- 
Pavan Balaji
http://www.mcs.anl.gov/~balaji



More information about the mpiwg-rma mailing list