On Thu, Feb 11, 2016 at 8:46 AM, Nathan Hjelm <hje...@lanl.gov> wrote: > > > On Thu, Feb 11, 2016 at 02:17:40PM +0000, Peter Wind wrote: > > I would add that the present situation is bound to give problems for some > > users. > > It is natural to divide an array in segments, each process treating its > > own segment, but needing to read adjacent segments too. > > MPI_Win_allocate_shared seems to be designed for this. > > This will work fine as long as no segment as size zero. It can also be > > expected that most testing would be done with all segments larger than > > zero. > > The document adding "size = 0 is valid", would also make people confident > > that it will be consistent for that special case too. > > Nope, that statement says its ok for a rank to specify that the local > shared memory segment is 0 bytes. Nothing more. The standard > unfortunately does not define what pointer value is returned for a rank > that specifies size = 0. Not sure if the RMA working group intentionally > left that undefine... Anyway, Open MPI does not appear to be out of > compliance with the standard here. >
MPI_Alloc_mem doesn't say what happens if you pass size=0 either. The RMA working group intentionally tries to maintain consistency with the rest of the MPI standard whenever possible, so we did not create a new semantic here. MPI_Win_shared_query text includes this: "If all processes in the group attached to the window specified size = 0, then the call returns size = 0 and a baseptr as if MPI_ALLOC_MEM was called with size = 0." > > To be safe you should use MPI_Win_shared_query as suggested. You can > pass MPI_PROC_NULL as the rank to get the pointer for the first non-zero > sized segment in the shared memory window. Indeed! I forgot about that. MPI_Win_shared_query solves this problem for the user brilliantly. Jeff -- Jeff Hammond jeff.scie...@gmail.com http://jeffhammond.github.io/