MPI_Aint in MPI_(I)NEIGHBOR_ALLTOALLW() vs int in MPI_(I)ALLTOALLW()
Asked Answered
B

1

7

With MPI3.0 neighborhood collective communications were introduced. And in 2 of them (MPI_NEIGHBOR_ALLTOALLW and MPI_INEIGHBOR_ALLTOALLW) displacements (sdispls and rdispls) are arrays of const MPI_Aint. Contrariwise of how the same, but collective, funcions (MPI_ALLTOALLW and MPI_ALLTOALLW) are defined -arrays of const int.

Also considering what the MPI Standard v3.0 says about MPI_Aint (page 16):

2.5.6 Addresses

Some MPI procedures use address arguments that represent an absolute address in the calling program. The datatype of such an argument is MPI_Aint in C and INTEGER (KIND=MPI_ADDRESS_KIND) in Fortran. These types must have the same width and encode address values in the same manner such that address values in one language may be passed directly to another language without conversion. There is the MPI constant MPI_BOTTOM to indicate the start of the address range.

I still don't get the point and, if exist, the difference (in addition that MPI_Aint can't be negative) between int and MPI_Aint!

Bartender answered 21/8, 2013 at 13:2 Comment(0)
A
8

MPI_Aint is a portable C data type that can hold memory addresses and it could be larger than the usual int. The policy of the MPI Forum is to not change the signature of existing MPI calls (as it could break existing applications - see here). Rather new calls are introduced that supersede the old ones. The rationale is that int worked well before LP64 64-bit architectures become popular at which point int could no longer be used to address the whole virtual address space of a single process. After this realisation some MPI calls got new versions in later versions that use MPI_Aint or MPI_Count (large integer type) instead of int. For example, MPI_Get_count_x supersedes MPI_Get_count and uses MPI_Count instead of int.

In this respect MPI_Alltoallw is an old call (it comes from MPI-2.0) and it retains its signature of using int offsets while MPI_(I)Neighbor_alltoallw is a new one (it comes with MPI-3.0) and it uses the address type in order to be able to work with data located (almost) anywhere in memory.

The same applies to the Fortran bindings.

Archway answered 21/8, 2013 at 13:45 Comment(3)
With your answer and sizeof(MPI_Aint) that is 8 makes sense now, thanks :) p.s: But why this explanation is not in the standard?Bartender
Usually such things are discussed on the publicly available mailing lists and discussion forums of the MPI Forum.Archway
The MPI standard is not meant to be a user guide, even if it appears so at times. See "Using MPI" books for explanations.Imminence

© 2022 - 2024 — McMap. All rights reserved.