Openmpi different head file: use mpi ,mpif.h ,mpi,h

when i use different openmpi’s headfile , compiling program produce different result , and i want to know which headfile(mpi ,mpif.h ,mpi,h) is best one when using the cuda with openmpi on linux. the follow is code

program cartesian
implicit none
include ‘mpif.h’ ! use this compile is ok
!include ‘mpi.h’ ! use one compile is erorr
!use mpi ! use one : the implicit none must be Beneath it and print Could && not resolve generic procedure mpi_cart_create
integer SIZE, UP, DOWN, LEFT, RIGHT,dtypesize
parameter(SIZE=16)
parameter(UP=1)
parameter(DOWN=2)
parameter(LEFT=3)
parameter(RIGHT=4)
integer numtasks, rank, source, dest, outbuf, i, tag, ierr, &
inbuf(4), nbrs(4), dims(2), coords(2), periods(2), &
subcoords(2), remainX(2), remainY(2), reorder
integer stats(MPI_STATUS_SIZE, 8), reqs(8)
integer cartcomm , commX, commY ! required variable
data inbuf /-2,-2,-2,-2/, &
dims /4,4/, tag /1/, periods /1,1/, reorder /0/, &
remainX /1,0/, remainY /0,1/
call MPI_INIT(ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD, numtasks, ierr)
if (numtasks .eq. SIZE) then
call MPI_CART_CREATE(MPI_COMM_WORLD, 2, dims, periods, reorder,cartcomm, ierr)
!call MPI_COMM_RANK(cartcomm, rank, ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
call MPI_CART_COORDS(cartcomm, rank, 2, coords, ierr)
call MPI_CART_SHIFT(cartcomm, 0, 1, nbrs(UP), nbrs(DOWN), ierr)
call MPI_CART_SHIFT(cartcomm, 1, 1, nbrs(LEFT), nbrs(RIGHT),ierr)
call MPI_CART_SUB(cartcomm,remainX,commX,ierr)
call MPI_CART_SUB(cartcomm,remainY,commY,ierr)
call MPI_COMM_RANK(commX,subcoords(1),ierr)
call MPI_COMM_RANK(commY,subcoords(2),ierr)
outbuf = rank
dest = nbrs(1)
source = nbrs(2)
call MPI_ISEND(outbuf, 1, MPI_INTEGER, dest, tag, &
MPI_COMM_WORLD, reqs(1), ierr)
call MPI_IRECV(inbuf(1), 1, MPI_REAL, source, tag, &
MPI_COMM_WORLD, reqs(2), ierr)
dest = nbrs(3)
source = nbrs(4)
call MPI_ISEND(outbuf, 1, MPI_INTEGER, dest, tag, &
MPI_COMM_WORLD, reqs(3), ierr)
call MPI_IRECV(inbuf(2), 1, MPI_INTEGER, source, tag, &
MPI_COMM_WORLD, reqs(4), ierr)
call MPI_WAITALL(8, reqs, stats, ierr)
write(,30) rank,inbuf(1),inbuf(2)
else
print , ‘Must specify’,SIZE,’ processors Terminating.’
end if
CALL mpi_type_size ( MPI_DOUBLE_PRECISION, dtypesize, ierr )
write(
,
) 'dtypesize is ’ , dtypesize
call MPI_FINALIZE(ierr)
20 format('rank= ‘,I3,’ coords= ‘,I2,I2, ’ subcoords=’,I2,I2, &
’ neighbors(u,d,l,r)= ',I3,I3,I3,I3)
30 format('rank= ‘,I3,’ ', &
’ inbuf(d,r)= ',I3,I3 )
end program cartesian