Opened 11 years ago

Closed 11 years ago

#39826 closed defect (fixed)

openmpi does not produce working Fortran MPI2 program

Reported by: dstrubbe (David Strubbe) Owned by: mww@…
Priority: Normal Milestone:
Component: ports Version: 2.1.3
Keywords: Cc: petrrr
Port: openmpi

Description

MPI2 support in the openmpi port does not seem to be working. I show below a simple test case using MPI_IN_PLACE for MPI_Allreduce, which fails for all numbers of processors I tried (1, 2, 3, 4; including running it without openmpiexec), and for various installations of openmpi which I tried ( 1.6.2_0+gcc45, 1.7.1_0+g95, and openmpi @1.7.1_0+gcc47). But it does work fine with mpich. I also obtained correct output for OpenMPI 1.4 on a Linux machine with Intel or GNU compilers.

Incorrect:

$ openmpif90 test.f90
$ openmpirun -n 3 ./a.out
 before, node            0 :           1
 before, node            1 :           1
 before, node            2 :           1
 after,  node            0 :           0
 after,  node            1 :           0
 after,  node            2 :           0

Correct, with mpich @3.0.4_0+gcc47:

$mpif90 test.f90
$ mpirun -n 3 ./a.out 
 before, node            0 :           1
 before, node            1 :           1
 before, node            2 :           1
 after,  node            0 :           3
 after,  node            1 :           3
 after,  node            2 :           3
program test

  use mpi

  integer :: mpierr
  integer, parameter :: SIZE = 1
  integer :: data(SIZE)

  call MPI_Init(mpierr)
  call MPI_Comm_rank(MPI_COMM_WORLD, inode, mpierr)

  data(1:SIZE) = 1

  write(6,*) 'before, node ', inode, ':', data

  call MPI_Allreduce(MPI_IN_PLACE, data, SIZE, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, mpierr)

  write(6,*) 'after,  node ', inode, ':', data

  call MPI_Finalize(mpierr)

end program test

Change History (8)

comment:1 Changed 11 years ago by larryv (Lawrence Velázquez)

Cc: mww@… removed
Owner: changed from macports-tickets@… to mww@…

comment:2 Changed 11 years ago by petrrr

Cc: Peter.Danecek@… added

Cc Me!

comment:3 Changed 11 years ago by dstrubbe (David Strubbe)

This seems to be a MacOS-specific issue. I found a thread and ticket about it at http://www.open-mpi.org/community/lists/users/2011/11/17862.php and http://www.open-mpi.org/community/lists/users/2013/01/21077.php. The fix mentioned in the first (-Wl,-commons,use_dylibs) is present in the version of OpenMPI we are using, and is correctly added by the configure script on my machine. I tried manually adding the second fix ( -Wl,-flat_namespace) to my link-line with openmpif90 and it doesn't seem to make any difference unfortunately.

comment:4 Changed 11 years ago by seanfarley (Sean Farley)

Resolution: worksforme
Status: newclosed

I just tested this and it seems work on my machine. Let me know if the issue still exists.

comment:5 Changed 11 years ago by dstrubbe (David Strubbe)

Resolution: worksforme
Status: closedreopened

I am reopening. It still doesn't work for me, on 3 different machines I tested:

  • openmpi-default @1.7.4_0+gcc48 on OSX 10.8.5, XCode 5.1
  • openmpi-default @1.7.4_0+gcc48 on OSX 10.9.2, XCode 5.1
  • openmpi-default @1.7.4_0+gcc45 on OSX 10.6.8, XCode 3.2.6.

comment:6 Changed 11 years ago by seanfarley (Sean Farley)

Ok, I'm able to reproduce this but have no idea why the linker flags don't work. I've updated openmpi to 1.7.5 and have put in -Wl,-flat_namespace to fix #42667 but things still don't work. At this point, we probably need a dev from OpenMPI to help us because I'm stuck.

comment:7 in reply to:  6 Changed 11 years ago by seanfarley (Sean Farley)

Replying to sean@…:

Ok, I'm able to reproduce this but have no idea why the linker flags don't work. I've updated openmpi to 1.7.5 and have put in -Wl,-flat_namespace to fix #42667 but things still don't work. At this point, we probably need a dev from OpenMPI to help us because I'm stuck.

Actually, I was able to fix this by rebuilding OpenMPI. I'll push this soon.

comment:8 Changed 11 years ago by seanfarley (Sean Farley)

Resolution: fixed
Status: reopenedclosed

Fixed in r118768. Thanks for the report!

Note: See TracTickets for help on using tickets.