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

Jan*_*nis 9 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!
Run Code Online (Sandbox Code Playgroud)

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

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

非常感谢!

小智 5

我在 Ubuntu 16.04 上遇到了同样的问题(或者非常相似,但错误消息略有不同),即使只安装了 Open MPI。据我所知,Ubuntu 的 mpi4py 包的构建方式存在问题,但我不确定它到底是什么。

重现:由于问题并没有完全清楚错误消息是如何产生的(我没有编辑它的声誉),所以我是这样得到它的。首先安装Ubuntu的mpi4py包,然后进入python环境:

$ sudo apt-get install mpi
$ python
Run Code Online (Sandbox Code Playgroud)

在 python 中,尝试以下操作:

>>> from mpi4py import MPI
Run Code Online (Sandbox Code Playgroud)

然后你应该会收到像OP一样的错误消息。

解决方案:这是我让它工作的方法。首先卸载Ubuntu的软件包:

$ sudo apt-get remove mpi4py
Run Code Online (Sandbox Code Playgroud)

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

$ sudo apt-get install libopenmpi-dev python-pip
Run Code Online (Sandbox Code Playgroud)

最后安装mpi4py:

$ sudo pip install mpi4py
Run Code Online (Sandbox Code Playgroud)

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