1

I install mpich using brew install mpich, but if I use MPI_Barrier, I will get segmentation fault. See the simple code below:

// A.c
#include "mpi.h" 
#include <stdio.h> 
int main(int argc, char *argv[]) 
{ 
  int rank, nprocs;

  MPI_Init(&argc,&argv); 
  MPI_Comm_size(MPI_COMM_WORLD,&nprocs); 
  MPI_Comm_rank(MPI_COMM_WORLD,&rank); 
  MPI_Barrier(MPI_COMM_WORLD);
  printf("Hello, world.  I am %d of %d\n", rank, nprocs);fflush(stdout); 
  MPI_Finalize(); 
  return 0;  
} 

mpicc A.c -g -O0 -o A

After running mpirun -n 2 ./A, I got error below:

  ==================================================================================    =
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 60914 RUNNING AT pivotal.lan
=   EXIT CODE: 139
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault: 11 (signal 11)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions

The detailed stack from lldb -c /cores/core.60914:

(lldb) target create --core "core.60914"
warning: (x86_64) /cores/core.60914 load command 82 LC_SEGMENT_64 has a     fileoff + filesize (0x27d3b000) that extends beyond the end of the file     (0x27d3a000), the segment will be truncated to match
warning: (x86_64) /cores/core.60914 load command 83 LC_SEGMENT_64 has a fileoff (0x27d3b000) that extends beyond the end of the file (0x27d3a000), ignoring this section
bCore file '/cores/core.60914' (x86_64) was loaded.
(lldb) bt
* thread #1: tid = 0x0000, 0x000000010176f432 libpmpi.12.dylib`MPID_Request_create + 244, stop reason = signal SIGSTOP
* frame #0: 0x000000010176f432 libpmpi.12.dylib`MPID_Request_create + 244
 frame #1: 0x000000010178d2fa libpmpi.12.dylib`MPID_Isend + 152
 frame #2: 0x0000000101744d6f libpmpi.12.dylib`MPIC_Sendrecv + 351
 frame #3: 0x00000001016861df libpmpi.12.dylib`MPIR_Barrier_intra + 401
 frame #4: 0x00000001016866f2 libpmpi.12.dylib`MPIR_Barrier + 67
 frame #5: 0x0000000101686789 libpmpi.12.dylib`MPIR_Barrier_impl + 90
 frame #6: 0x00000001016860fb libpmpi.12.dylib`MPIR_Barrier_intra + 173
 frame #7: 0x00000001016866f2 libpmpi.12.dylib`MPIR_Barrier + 67
 frame #8: 0x0000000101686789 libpmpi.12.dylib`MPIR_Barrier_impl + 90
 frame #9: 0x00000001015a8ed9 libmpi.12.dylib`MPI_Barrier + 820
 frame #10: 0x0000000101590ed8 a.out`main(argc=1, argv=0x00007fff5e66fa40) + 88 at b.c:11
 frame #11: 0x00007fff8f7805ad libdyld.dylib`start + 1

The usage is copied from official guide. What's the problem of MPI_Barrier function implementation in libmpi.12.dylib? Thanks.

xunzhang
  • 2,838
  • 6
  • 27
  • 44
  • I downloaded, built, and ran your program without error of any sort [I'm on linux/fedora]. What OS/distro are you using? – Craig Estey Jul 02 '16 at 02:39
  • @CraigEstey osx EI Captin – xunzhang Jul 02 '16 at 02:40
  • I'm not an OSX person per se. But, after some web search, I'm suspicious of `brew` [homebrew]. Most of the other MPI howto-install pages for OSX end up on www.openmpi.org, with download of the source tarball and rebuild from source [possibly needed because your OS is quite advanced version] At least, you can build the lib with `-g -O0` so the traceback will have line numbers See (e.g.): https://wiki.helsinki.fi/display/HUGG/Open+MPI+install+on+Mac+OS+X which also recommends use of GNU compilers – Craig Estey Jul 02 '16 at 03:03

0 Answers0