Thank you very much. The include mpif.h and use mpi seems the same.
About interfaces, take mpi_bcast
for example,
It says,
Fortran Syntax
USE MPI
! or the older form: INCLUDE ’mpif.h’
MPI_BCAST(BUFFER, COUNT, DATATYPE, ROOT, COMM, IERROR)
<type> BUFFER(*)
INTEGER COUNT, DATATYPE, ROOT, COMM, IERROR
I can be wrong, but t seems mpi_bcast
should be able to accept different datatype
and buffer
already, right?
I think if in the code I just directly use the intrinsic mpi_bcast
for different datatype it may not have warning. But perhaps because in my mpi module, I define my subroutine bcast
with overloading for different datatype, see
interface bcast ! broadcast from process 0
module procedure bcasti1,bcasti1d,bcasti2d,bcasti3d,bcasti4d
module procedure bcasti1_8,bcasti1d_8
module procedure bcastr1,bcastr1d,bcastr2d,bcastr3d,bcastr4d
module procedure bcastlogi
module procedure bcastchar
end interface bcast
and inside each my-defined subroutine like
subroutine bcasti1(i)
integer(kind=i4) :: i
integer :: ierror
call mpi_bcast(i,1,mpii4,0,mpi_comm_world,ierror)
return
end subroutine bcasti1
subroutine bcasti1d(i)
integer(kind=i4) :: i(:)
integer :: ierror
call mpi_bcast(i,size(i),mpii4,0,mpi_comm_world,ierror)
return
end subroutine bcasti1d
As explained by @RonShepard
In subroutine bcasti1
, i
is a number with integer(kind=i4) :: i
, in In subroutine bcasti1d
, i
is a 1d array with integer(kind=i4) :: i(:)
. The interface of integer and interger array is different, perhaps that make gfortran’s intrinsic mpi_bcast
a little unhappy so it gives me an warning. But Intel Fortran seems OK. In reality, when the program run, it seems always fine for some years on supercomputers.
If you may please provide a concrete minimal example as to how to overcome this warning in gfortran, based on my module, it would be very appreciated.