[Mpi3-rma] Target displacement in dynamic windows

Jim Dinan dinan at mcs.anl.gov
Tue Sep 18 09:56:00 CDT 2012


Hi Hubert,

We discussed adding an alternative representation for manipulating 
window offsets, that would be overflow-safe (e.g. unsigned or "big 
enough").  The user would have to convert to this representation and 
then back to MPI_Aint in order to pass the displacement to an RMA 
communication routine.  So, the proposed solution will work with the 
existing interface at the expense of a few extra calls.

The fundamental problem is that in MPI-2, the window size if given by an 
(signed) MPI_Aint argument, which must be positive.  Thus, in MPI-2, the 
window size and offset are both bounded at MPI_AINT_MAXVAL.  Dynamic 
windows are not bounded in this way, so we need some safe way to do 
offset arithmetic on the full range of addresses.

AFAIK, C doesn't define a signed representation and it doesn't define 
what will happen when you overflow a signed integer.  So, I don't any 
solution where a user can do arithmetic on an MPI_Aint will work.  Does 
Fortran define this behavior?

Here's another proposal for safe displacement arithmetic would be to 
define a new routine:

MPI_Address_add(MPI_Aint base, MPI_Aint disp, MPI_Aint new_base)

Which returns new_base = base + disp.  This would not require the 
addition of any new types and would make it MPI's job to do the 
arithmetic in a safe and portable way.  This should also be 
Fortran-friendly.

  ~Jim.

On 9/18/12 5:32 AM, Hubert Ritzdorf wrote:
> Hi,
>
> the MPI_Auint has the problem that this doesn't work for the RMA communication interfaces and
> that you have to create new interfaces for this.
>
> I think another possibility would be to change the base address for dynamic windows to
> MPI_WIN_BASE_DYNAMIC which should be a predefined address and which could be
> MPI_MAX_AINT + 1, where MPI_MAX_AINT is the maximal positive value of an MPI_Aint..
>
> Advantages:
> (*) You can address the entire memory range with the MPI_Aint (positive and negative) displacement
>        No differences between Fortran and C.
>        No integer overflow
> (*) Same value for Fortran and C
>        Currently, you have to differentiate between dynamic windows created by C and Fortran
>        with all the possible problems in mixing C and Fortran routines/functions since the base
>        addresses are different.
> (*) Improved scalability
>        Fixed predefined value which will be (probably) the same in all processes.
>        In Fortran, the value of MPI_BOTTOM (address of a global variable) can be different for
>       different processes (example: MPMD applications).
>
> Address calculations would simple (ptr = ((char *) MPI_WIN_BASE_DYNAMIC) + displacement + 1)
> and could be placed into a macro for C. A function could work for Fortran.
> What you need is a single additional function MPI_Get_address_dynamic() which returns
> the displacement relative to MPI_WIN_BASE_DYNAMIC and not relative to MPI_BOTTOM.
>
> Hubert
>
> PS: I know its late. In the errata, we could replace MPI_BOTTOM by MPI_WIN_BASE_DYNAMIC and can
> add the function. MPI_Get_address_dynamic() in addition to the non-negative
> displacements. The MPI implementers would have the possibility to realize this and we to discuss it further.
> If we stay with MPI_BOTTOM as base for dynamic windows, it's fixed.
>
> ________________________________________
> From: mpi3-rma-bounces at lists.mpi-forum.org [mpi3-rma-bounces at lists.mpi-forum.org] on behalf of Jim Dinan [dinan at mcs.anl.gov]
> Sent: Monday, September 17, 2012 11:12 PM
> To: MPI 3.0 Remote Memory Access working group
> Subject: [Mpi3-rma] Target displacement in dynamic windows
>
> Hi All,
>
> In today's meeting, we arrived at the following approach to addressing
> the target displacements issue for dynamic windows:
>
> The MPI 3.0 errata should include the following two statements:
>
> 1. For dynamic windows, the target_disp argument to RMA communication
> operations is not restricted to non-negative values.
>
> 2. Users are cautioned that displacement arithmetic can overflow in
> variables with MPI_Aint type and result in unexpected values on some
> platforms.  This issue will be addressed in a future version of MPI.
>
> In MPI 3.1, we will look at two possible mechanisms for providing safe
> offset arithmetic:
>
> 1. MPI_Get_pointer(MPI_Aint address, void *ptr), which will allow a user
> to convert between addresses and pointers.
>
> 2. MPI_Auint -- an address integer which can represent the full range of
> MPI_Aint as a positive integer.  This could be an unsigned integer, but
> for Fortran compatibiliy, it may need to be a singed integer that's
> larger than MPI_Aint.  The following conversion functions would be provided:
>
> MPI_Get_auint(MPI_Aint addr, MPI_Auint *uaddr)
> MPI_Get_aint(MPI_Auint uaddr, MPI_Aint *addr)
>
> Please send comments.  Thanks,
>
>    ~Jim.
> _______________________________________________
> mpi3-rma mailing list
> mpi3-rma at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-rma
>
>
>   Click https://www.mailcontrol.com/sr/KWlIxjc1E8DTndxI!oX7Ug!f1TOPbjCaDuFAgQbitRShm2xo8mncBFGrPZehFfPKEpz+l7IB2gbwq3xXRfv08Q==  to report this email as spam.
>
> _______________________________________________
> mpi3-rma mailing list
> mpi3-rma at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-rma
>



More information about the mpiwg-rma mailing list