Why Is MPI_COMM_RANK Not Working Correctly on Mac OSX?

  • Context: Fortran 
  • Thread starter Thread starter natski
  • Start date Start date
  • Tags Tags
    Fortran Mac
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 replies · 3K views
natski
Messages
262
Reaction score
2
Hi all,

I have been running mpi fortran code on Linux based systems without any trouble for some time but making the same code run on a Mac is causing me some headaches. I installed mpi using the guide at: http://www.macresearch.org/compiling-mpi-f90-support-snow-leopard

I am trying to run some simple "hello world" code:

! Fortran example
program hello
include 'mpif.h'
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)

call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror)
print*, 'node', rank, ': Hello world'
call MPI_FINALIZE(ierror)
end

Compiling with mpif90 -o mpihello mpihello.f90 and then executing with mpirun -np 4 mpihello I get...

node 0 : Hello world
node 0 : Hello world
node 0 : Hello world
node 0 : Hello world

So essentially I am calling node 0 four times rather than actually parallelizing anything. Has anyone else encountered this problem? The same code runs fine on Linux FYI. Any tips/suggestions would be extremely appreciated!

Natski
 
on Phys.org
By looping the inner code and re-running I notice in Activity Monitor that four parallel versions of the code are in fact running. So this seems simply something wrong with the rank being returned by MPI_COMM_RANK - is this a normal issue for Macs?