You must tell the compiler about the MPI stuff (mainly variables).
The modern way is introducing
use mpi
in every scope.
In the old days it was also done using
include "mpif.h"
but that has several disadvantages. Namely, because it is compatible with FORTRAN 77, it does not introduce explicit interfaces for any MPI subroutines and therefore the error checking is less thorough than with use mpi
. The modern method will help you more in keeping your code correct.
On the other hand, if you use use mpi
the module mpi
must be compiled with the same compiler (sometimes even with the same version) which you use to compile your program.
solved Fortran with MPI error