I have ubuntu 24.04. I have installed gfortran and mpich. Using mpirun produces serial jobs instead than parallel.
When compiling the file test.f90 by
mpif90 -o test test.f90
and running it by
mpirun -np 2 ./test
I get
Hello World from process: 0 of 1
Hello World from process: 0 of 1
That is, the two processes are running independently instead then in parallel.
The correct, expected outcome should be
Hello World from process: 0 of 2
Hello World from process: 1 of 2
The file test.f90 contains the following
PROGRAM hello_world_mpi
include ‘mpif.h’
integer process_Rank, size_Of_Cluster, ierror
call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size_Of_Cluster, ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD, process_Rank, ierror)
print *, ‘Hello World from process: ‘, process_Rank, ‘of ‘, size_Of_Cluster
end program hello_world_mpi
Many thanks!
Fabio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.