I have a simple question about MPI_Aint, but I have not found an answer anywhere. For some reason, it MPI_Type_size(MPI_Aint)doesn’t work (it doesn’t look like classical data types, for example, MPI_Doubleor MPI_Int), at least with OpenMPI 1.8.4 and 1.10.1, but I don’t think this is an OpenMPI problem.
I need to create a type with MPI_Type_create_hindexed()and distribute the array array_of_displacementsdynamically. After calculating the size, NI wrote
MPI_Aint* disps = (MPI_Aint*) malloc(N*sizeof(MPI_Aint)) ;
instead
int mpiAintSize ;
MPI_Type_size(MPI_Aint, &mpiAintSize) ;
MPI_Aint* disps = (MPI_Aint*) malloc(N*mpiAintSize) ;
due to this problem. sizeof () will do the job while I'm lucky and I don't need portability (this array will be used to write / read large files using MPI-I / O).
But I would like to know: what a clean and portable way to allocate my array disps? What did I miss in MPI_Aint?