0
! $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
3
  • Welcome, please take the tour and read How to Ask. Please use the formatting features in the question editor to mark code and terminal output. I did these edits for you, together with some basic grammar edits. Commented May 7, 2024 at 9:21
  • compile with mpifort instead of gfortran Commented May 7, 2024 at 10:21
  • 1
    You show that you have it working with mpif90 test1.f90: this makes it less obvious to us what your question now is. Commented May 7, 2024 at 11:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.