If I want to use the 64-bit interface I can specify the -i8
compiler Flag for ifort or -fdefault-integer-8
for gfortran.
In MPI however MPI_INTEGER is defined as a fixed 32 bit integer: https://www.ibm.com/support/knowledgecenter/SSFK3V_2.3.0/com.ibm.cluster.pe.v2r3.pe400.doc/am106_pmd.htm
If I have a simple call such as:
MPI_Bcast(buffer, count, MPI_DATATYPE, root, MPI_COMM_WORLD, ierr)
How can I pass MPI_DATATYPE
such that it takes the default value? I.e. MPI_INTEGER8
if -i8
is set or MPI_INTEGER4
if not?
I was considering doing it trough a constant, but I don't know what the type of MPI_DATATYPE
is. Is it integer(4)
just like MPI_COMM_WORLD
is?
Edit: I just realized, that different MPI implementations behave differently:
program main
use mpi
integer(4) :: sz
integer(4) :: ierr
call MPI_Init(ierr)
call MPI_Type_size(MPI_INTEGER4, sz, ierr)
write (* ,* ) "4 = ", sz
call MPI_Type_size(MPI_INTEGER8, sz, ierr)
write (* ,* ) "8 = ", sz
call MPI_Type_size(MPI_INTEGER, sz, ierr)
write (* ,* ) "? = ", sz
call MPI_Finalize(ierr)
end program main
IntelMPI:
> $ ./bla.x
4 = 4
8 = 8
? = 4
OpenMPI:
> $ ./bla.x
4 = 4
8 = 8
? = 8