MPI_(I)NEIGHBOR_ALLTOALLW()中的MPI_Aint与MPI_(I)ALLTOALLW()中的int [英] MPI_Aint in MPI_(I)NEIGHBOR_ALLTOALLW() vs int in MPI_(I)ALLTOALLW()
问题描述
借助MPI3.0,引入了社区集体通信.
并且在其中两个(MPI_NEIGHBOR_ALLTOALLW
和MPI_INEIGHBOR_ALLTOALLW
)中,位移(sdispls
和rdispls
)是const MPI_Aint
的数组.与如何定义相同但集体的功能(MPI_ALLTOALLW
和MPI_ALLTOALLW
)相反-const int
的数组.
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
.
还要考虑MPI标准v3.0关于MPI_Aint(第16页)的说法:
Also considering what the MPI Standard v3.0 says about MPI_Aint (page 16):
2.5.6地址
2.5.6 Addresses
某些MPI程序使用的地址参数代表地址中的绝对地址 调用程序.这样的参数的数据类型是C中的MPI_Aint, 在Fortran中为INTEGER(KIND = MPI_ADDRESS_KIND).这些类型必须具有相同的宽度 并以相同的方式对地址值进行编码,以使一种语言中的地址值 可以直接传递给另一种语言,而无需进行转换.有MPI常数 MPI_BOTTOM表示地址范围的开始.
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.
我仍然不明白这一点,如果存在的话,int
和MPI_Aint
之间的区别(另外,MPI_Aint
不能为负)!
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
!
推荐答案
MPI_Aint
是可移植的C数据类型,可以容纳内存地址,并且可能比通常的int
大. MPI论坛的政策是不更改现有MPI调用的签名(因为它可能破坏现有应用程序-请参见
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
.
在这方面,MPI_Alltoallw
是一个旧的调用(来自MPI-2.0),并且保留了使用int
偏移量的签名,而MPI_(I)Neighbor_alltoallw
是一个新的调用(它与MPI-3.0一起提供),并且使用地址类型以便能够处理(几乎)位于内存中任何位置的数据.
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.
Fortran绑定也是如此.
The same applies to the Fortran bindings.
这篇关于MPI_(I)NEIGHBOR_ALLTOALLW()中的MPI_Aint与MPI_(I)ALLTOALLW()中的int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!