! $UWHPSC/codes/mpi/test1.f90
program test1
use mpi
implicit none
integer :: ierr, numprocs, proc_num
call mpi_init(ierr)
call mpi_comm_size(MPI_COMM_WORLD, numprocs, ierr)
call mpi_comm_rank(MPI_COMM_WORLD, proc_num, ierr)
print *, 'Hello from Process number', proc_num, &
' of ', numprocs, ' processes'
call mpi_finalize(ierr)
end program test1
I'm a Mac M1 user. I have to run the above code in a Mac terminal. I found an error that is mentioned below. I also installed open-mpi using brew install open-mpi, but I still encounter this problem.
MacBook-Air mpi % gfortran test1.f90
test1.f90:4:9:
4 | use mpi
| 1
Fatal Error: Cannot open module file 'mpi.mod' for reading at (1): No such file or directory
compilation terminated.
MacBook-Air mpi % mpif90 test1.f90
ld: warning: -commons use_dylibs is no longer supported, using error treatment instead
mpifortinstead ofgfortranmpif90 test1.f90: this makes it less obvious to us what your question now is.