[mpich-discuss] MPI_alloc_mem call code compiles with Open MPI, not MPICH

Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC] matthew.thompson at nasa.gov
Fri Sep 22 09:11:35 CDT 2023


All,

I'm sort of new to MPICH and I'm encountering one call that works with Open MPI but not MPICH. As such, I'm wondering if I built MPICH incorrectly or incompletely (always easy to miss a configure flag!).

To wit, I have a code like:

program main
   use mpi
   use iso_fortran_env, only: INT64
   use iso_c_binding, only: C_PTR

   integer(kind=INT64) :: sz
   type (c_ptr) :: ptr

   call MPI_Alloc_mem(sz, MPI_INFO_NULL, ptr, ierror)

end program main

If I compile with GCC 12.1 + Open MPI 4.1.3, all is well:

$ mpifort --showme:version
mpifort: Open MPI 4.1.3 (Language: Fortran)
mathomp4 at discover23 ~/MPITests/CPtr master ?25
$ mpifort support_for_mpi_alloc_mem_cptr.F90
mathomp4 at discover23 ~/MPITests/CPtr master ?25
$ echo $?
0

I'll also say Intel MPI builds this code as well.

But with MPICH 4.1.2 I just built:

$ mpifort support_for_mpi_alloc_mem_cptr.F90
support_for_mpi_alloc_mem_cptr.F90:9:53:

    9 |    call MPI_Alloc_mem(sz, MPI_INFO_NULL, ptr, ierror)
      |                                                     1
Error: Type mismatch in argument 'baseptr' at (1); passed TYPE(c_ptr) to INTEGER(8)

Now, my configure lines to Open MPI and MPICH are pretty boring, so the resulting mpiforts are as well:

$ mpifort -show
gfortran -I/discover/swdev/gmao_SIteam/MPI/openmpi/4.1.3/gcc-12.1.0/include -pthread -I/discover/swdev/gmao_SIteam/MPI/openmpi/4.1.3/gcc-12.1.0/lib -L/discover/swdev/gmao_SIteam/MPI/openmpi/4.1.3/gcc-12.1.0/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi

$ mpifort -show
gfortran -I/discover/swdev/gmao_SIteam/MPI/mpich/4.1.2/gcc-12.1.0/include -I/discover/swdev/gmao_SIteam/MPI/mpich/4.1.2/gcc-12.1.0/include -L/discover/swdev/gmao_SIteam/MPI/mpich/4.1.2/gcc-12.1.0/lib -lmpifort -Wl,-rpath -Wl,/discover/swdev/gmao_SIteam/MPI/mpich/4.1.2/gcc-12.1.0/lib -Wl,--enable-new-dtags -lmpi

But I see Open MPI has that "mpi_usempi_ignore_tkr", is it possible that's what is doing it?

Perhaps we just need to recode the code (using transfer, etc?)

Thanks for any help,
Matt
--
Matt Thompson, SSAI, Sr Scientific Programmer/Analyst
NASA GSFC,    Global Modeling and Assimilation Office
Code 610.1,  8800 Greenbelt Rd,  Greenbelt,  MD 20771
Phone: 301-614-6712                 Fax: 301-614-6246
http://science.gsfc.nasa.gov/sed/bio/matthew.thompson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20230922/f77c50d9/attachment.html>


More information about the discuss mailing list