I'm working on building an MPI-based molecular dynamics program against several MPI implementations (separately), and I've run into a snag with MPICH 3.0: it seems not to provide explicit interfaces for several MPI procedures. Some of the affected procedures are mpi_bcast()
, mpi_ssend()
, mpi_recv()
, and mpi_finalize()
. MPICH 3.0 does provide explicit interfaces for some procedures, however, such as mpi_init()
. This example code demonstrates the problem:
program mpitest
use mpi
integer ierr
ierr = 0
call dummy_implicit(ierr)
call mpi_init(ierr)
if (ierr /= 0) then
write(*,*) 'MPI_Init() failed'
stop
endif
call mpi_finalize(ierr)
if (ierr /= 0) then
write(*,*) 'MPI_Finalize() failed'
endif
stop
end program
If I build this program on CentOS 7 against MPICH 3.0.4, I get this result:
$which mpif90
/usr/lib64/mpich/bin/mpif90
$ mpif90 -Wimplicit-interface -c -o mpitest.o mpitest.f90 mpitest.f90:6.31:
call dummy_implicit(ierr)
1 Warning: Procedure 'dummy_implicit' called with an implicit interface at (1) mpitest.f90:15.29:
call mpi_finalize(ierr)
1 Warning: Procedure 'mpi_finalize' called with an implicit interface at (1)
$
The warning about procedure dummy_implicit()
is expected and correct, but I expect MPICH to provide an explicit interface for mpi_finalize()
, just as it apparently does for mpi_init()
. Moreover, I find that if I build the same program against MPICH 3.2 or OpenMPI 1.10.3 then an implicit interface warning is emitted only for procedure dummy_implicit()
.
This issue bears some resemblance to one reported against MPICH2, but that one (1) was reported against MPICH 2, not MPICH 3, and (2) was closed about 5 years ago.
I do want to ensure that I have explicit interfaces in scope for all my procedure calls. I can provide the missing ones manually if need be, but surely that's not the intended usage model, nor is it required for other MPI implementations.
What am I doing wrong? Do I really need to provide explicit interfaces manually?