在`libpmpi.12.dylib`中使用MPI_Barrier时出现分段错误

时间:2016-07-02 01:59:13

标签: c segmentation-fault mpi coredump mpich

我使用brew install mpich安装mpich,但是如果我使用MPI_Barrier,我将会出现分段错误。请参阅以下简单代码:

// 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

运行mpirun -n 2 ./A后,我收到以下错误:

  ==================================================================================    =
=   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

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

用法从官方指南中复制。 MPI_Barrierlibmpi.12.dylib功能实施的问题是什么?感谢。

0 个答案:

没有答案