在mac osx 10.8上运行hello_world的open-mpi运行时错误

时间:2014-07-28 04:18:51

标签: macos openmpi

我用homebrew安装了open-mpi-1.8.1并成功编译了以下hello world程序:

#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
  MPI_Init(NULL, NULL);
  int world_size;
  MPI_Comm_size(MPI_COMM_WORLD, &world_size);
  int world_rank;
  MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
  char processor_name[MPI_MAX_PROCESSOR_NAME];
  int name_len;
  MPI_Get_processor_name(processor_name, &name_len);
  printf("Hello world from processor %s, rank %d out of %d processors\n",
         processor_name, world_rank, world_size);
  MPI_Finalize();
}

但是在运行它时,我得到一堆Symbol not found错误,然后是分段错误。我还尝试从1.8.1和1.6.1直接从源代码构建open-mpi,遵循指令here并得到相同的错误。我有Xcode 5.1.1。

我该怎么办?提前谢谢。

mpirun -n 4 ./mpi_hello_world

mca: base: component_find: unable to open /usr/local/lib/openmpi/mca_ess_slurmd: dlopen(/usr/local/lib/openmpi/mca_ess_slurmd.so, 9): Symbol not found: _orte_jmap_t_class
  Referenced from: /usr/local/lib/openmpi/mca_ess_slurmd.so
  Expected in: flat namespace
in /usr/local/lib/openmpi/mca_ess_slurmd.so (ignored)

mca: base: component_find: unable to open /usr/local/lib/openmpi/mca_errmgr_default: dlopen(/usr/local/lib/openmpi/mca_errmgr_default.so, 9): Symbol not found: _orte_errmgr_base_error_abort
  Referenced from: /usr/local/lib/openmpi/mca_errmgr_default.so
  Expected in: flat namespace
 in /usr/local/lib/openmpi/mca_errmgr_default.so (ignored)

mca: base: component_find: unable to open /usr/local/lib/openmpi/mca_routed_cm: dlopen(/usr/local/lib/openmpi/mca_routed_cm.so, 9): Symbol not found: _orte_message_event_t_class
  Referenced from: /usr/local/lib/openmpi/mca_routed_cm.so
  Expected in: flat namespace
 in /usr/local/lib/openmpi/mca_routed_cm.so (ignored)

...

*** Process received signal ***
Signal: Segmentation fault: 11 (11)
Signal code: Address not mapped (1)
Failing at address: 0x100000013

1 个答案:

答案 0 :(得分:0)

您似乎同时安装了多个版本的Open MPI。你应该确保清除除了其中一个之外的所有部分并且只使用一个。

可以同时安装多个MPI,但是需要您非常小心地安装它们并在运行时环境中进行设置。