mpi4py 只能在 mpiexec 下工作

mpi4py only works under mpiexec

我已经在一台新服务器上设置了 mpi4py,但效果不佳。当我导入 mpi4py.MPI 时,它崩溃了。但是,如果我在 mpiexec 下做同样的事情,它就会起作用。在我的另一台服务器和我的工作站上,这两种技术都可以正常工作。我在新服务器上缺少什么?

这是新服务器上发生的事情:

$ python -c 'from mpi4py import MPI; print("OK")'
--------------------------------------------------------------------------
It looks like orte_init failed for some reason; your parallel process is
likely to abort.  There are many reasons that a parallel process can
fail during orte_init; some of which are due to configuration or
environment problems.  This failure appears to be an internal failure;
here's some additional information (which may only be relevant to an
Open MPI developer):

  PMI2_Job_GetId failed failed
  --> Returned value (null) (14) instead of ORTE_SUCCESS
--------------------------------------------------------------------------
--------------------------------------------------------------------------
It looks like orte_init failed for some reason; your parallel process is
likely to abort.  There are many reasons that a parallel process can
fail during orte_init; some of which are due to configuration or
environment problems.  This failure appears to be an internal failure;
here's some additional information (which may only be relevant to an
Open MPI developer):

  orte_ess_init failed
  --> Returned value (null) (14) instead of ORTE_SUCCESS
--------------------------------------------------------------------------
--------------------------------------------------------------------------
It looks like MPI_INIT failed for some reason; your parallel process is
likely to abort.  There are many reasons that a parallel process can
fail during MPI_INIT; some of which are due to configuration or environment
problems.  This failure appears to be an internal failure; here's some
additional information (which may only be relevant to an Open MPI
developer):

  ompi_mpi_init: ompi_rte_init failed
  --> Returned "(null)" (14) instead of "Success" (0)
--------------------------------------------------------------------------
*** An error occurred in MPI_Init_thread
*** on a NULL communicator
*** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
***    and potentially your MPI job)
[Octomore:45430] Local abort before MPI_INIT completed successfully; not able to aggregate error messages, and not able to guarantee that all other processes were killed!

如果我运行它和mpiexec,就可以了。

$ mpiexec -np 1 python -c 'from mpi4py import MPI; print("OK")'
OK

我运行正在使用 CentOS 6.7。我已经安装了 Python 2.7 作为软件集合,并且加载了 openmpi/gnu/1.10.2 模块。还安装了 MPICH 和 MPICH2,因此它们可能与 OpenMPI 冲突。不过,我还没有加载 MPICH 模块。我在 virtualenv 中 运行ning Python:

$ pip list
mpi4py (2.0.0)
pip (8.1.2)
setuptools (18.0.1)
wheel (0.24.0)

原来mpi4py与OpenMPI 1.10.2版本不兼容。它适用于 1.6.5 版本。

$ module load openmpi/gnu/1.6.5
$ python -c 'from mpi4py import MPI; print("OK")'
OK