通过Python在MPI_Init中启动Open MPI时出错

时间:2016-03-22 14:15:20

标签: python linux compilation openmpi

我正在尝试通过python访问OpenMPI的共享库,但出于某种原因我收到以下错误消息:

[Geo00433:01196] mca: base: component_find: unable to open /usr/li/openmpi/lib/openmpi/mca_paffinity_hwloc: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
[Geo00433:01196] mca: base: component_find: unable to open /usr/lib/openmpi/lib/openmpi/mca_carto_auto_detect: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
[Geo00433:01196] mca: base: component_find: unable to open /usr/lib/openmpi/lib/openmpi/mca_carto_file: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
[Geo00433:01196] mca: base: component_find: unable to open /usr/lib/openmpi/lib/openmpi/mca_shmem_mmap: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
[Geo00433:01196] mca: base: component_find: unable to open /usr/lib/openmpi/lib/openmpi/mca_shmem_posix: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
[Geo00433:01196] mca: base: component_find: unable to open /usr/lib/openmpi/lib/openmpi/mca_shmem_sysv: perhaps a missing symbol, or compiled for a different version of Open MPI? (ignored)
-------------------------------------------------------------------------
It looks like opal_init failed for some reason; your parallel process is
likely to abort.  There are many reasons that a parallel process can
fail during opal_init; some of which are due to configuration or
environment problems.  This failure appears to be an internal failure;
here is some additional information (which may only be relevant to an
Open MPI developer):

  opal_shmem_base_select failed
    --> Returned value -1 instead of OPAL_SUCCESS
--------------------------------------------------------------------------
[Geo00433:01196] [[INVALID],INVALID] ORTE_ERROR_LOG: Error in file runtime/orte_init.c at line 79
--------------------------------------------------------------------------
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 is some
additional information (which may only be relevant to an Open MPI
developer):

  ompi_mpi_init: orte_init failed
  --> Returned "Error" (-1) instead of "Success" (0)
--------------------------------------------------------------------------
*** An error occurred in MPI_Init
*** on a NULL communicator
*** MPI_ERRORS_ARE_FATAL: your MPI job will now abort
[Geo00433:1196] Local abort before MPI_INIT completed successfully; not able to aggregate error messages, and not able to guarantee that all other processes were killed!

有什么理由是什么原因?我已经检查了很多网页,但不知何故找不到我的问题的解决方案。

我安装了Ubuntu 15.10和mpich以及open-mpi。

非常感谢你们!

5 个答案:

答案 0 :(得分:4)

即使只安装了Open MPI,我在Ubuntu 16.04上也遇到了同样的问题(或者在错误信息上略有不同)。据我所知,Ubuntu的mpi4py软件包是如何构建的,但我不确定究竟是什么。

复制:由于这个问题并没有完全清楚错误信息是如何产生的(我没有编辑它的声誉),所以我就是这样做的。首先,安装Ubuntu的mpi4py软件包,然后进入python环境:

$ sudo apt-get install mpi
$ python

在python中,尝试以下方法:

>>> from mpi4py import MPI

然后您应该收到类似OP的错误消息。

解决方案:以下是我的工作方式。首先卸载Ubuntu的软件包:

$ sudo apt-get remove mpi4py

然后安装Open MPI标题(下一步涉及构建mpi4py)和pip:

$ sudo apt-get install libopenmpi-dev python-pip

最后安装mpi4py:

$ sudo pip install mpi4py

如果您尝试上面的python命令,它现在应该可以正常工作。

答案 1 :(得分:0)

正如Hristo Iliev指出的那样,错误信息确实与不同的.so文件有关。 在编译我使用的程序时,编译器在我的Linux机器上找到了“错误的”OpenMPI,即通过使用OpenMPI明确指定,问题就解决了。

感谢您的帮助!

答案 2 :(得分:0)

当我使用带有SWIG的自己包装的MPI的python接口时,我也遇到了类似的错误。如上所述,此错误可能与同一台计算机上的不同版本的MPI实现(例如计算机上的OpenMPI和MPICH)有关。

我通过编译和安装新版本的MPICH解决了这个问题。然后更改.bashrc中的环境变量并使用新的mpicxx或mpicc编译我自己的程序。错误会消失。

答案 3 :(得分:0)

尝试在Ubuntu 16.04 LTS上使用mpi4py时出现类似错误。 在我的情况下,错误与 mpicc包装器不在我的搜索路径中的事实有关。

我为解决问题所做的是以下

  • 使用
  • 卸载当前的mpi4py

$ sudo pip uninstall mpi4py

  • 使用
  • 查找mpicc的路径

$ mpicc

$ sudo env MPICC = / path / to / mpicc pip install mpi4py

之后错误消息消失了,我可以用python运行MPI

答案 4 :(得分:0)

首先尝试卸载您的mpi4py

>>> pip uninstall mpi4py

然后

>>> conda install mpi4py

来源:https://nyu-cds.github.io/python-mpi/setup/