macos - mpi4py MPI.init() 无限期挂起
问题描述
我正在尝试使用 mpi4py 中的 MPI 模块在 python (3.7.0) 中初始化 MPI,但是当我尝试以下操作时它会无限期挂起:
mpirun -n 4 python -c "from mpi4py import MPI"
这有效:
python -c "from mpi4py import MPI"
但这不是:
mpirun -n 1 python -c "from mpi4py import MPI"
我也试过
import mpi4py
mpi4py.rc.initialize = False
from mpi4py import MPI
MPI.Init()
但是当使用 mpirun 执行时,它会挂在 MPI.Init() 步骤。
我的 mpirun 版本是 1.10.7,mpi4py 版本是 3.0.1,我使用的是 macOS Mojave (10.14.3)。
编辑(响应@jcgiret):
我还尝试了以下方法:
mpirun -n 4 python -c "print('Before'); from mpi4py import MPI; print('After')"
只为得到
Before
Before
Before
Before
作为输出
解决方案
我设法通过安装 Miniconda 并使用包的 conda-forge 版本(3.0.1)来解决这个问题:
conda install -c conda-forge mpi4py
注意:它仍然不适用于 anaconda 版本(2.0.0)
推荐阅读
- character-encoding - 我怎样才能弄清楚这些颜色值是如何编码的?
- python - 尝试自动化一些数据抓取,但需要了解如何在抓取和导出之间组合数据
- docker - 通过在 swarm 模式下创建 docker 服务来设置 docker swap
- java - Linux 中的 Java 写入文件
- reactjs - 将 create-react-app 与本地模板一起使用?
- python - pyplot图例中的左右对齐
- r - R检查开发包很慢
- c# - 在 ASP.NET MVC 5 Stackoverflow 上更新 Kendo
- javascript - Firebase 数据库正在拒绝请求
- java - 如何在 Spring Boot 应用程序中测试 DatadogMeterRegistry?