mpiexec and python mpi4py gives rank 0 and size 1

前端 未结 2 735
不思量自难忘°
不思量自难忘° 2021-02-20 14:49

I have a problem with running a python Hello World mpi4py code on a virtual machine.

The hello.py code is:

#!/usr/bin/python
#hello.py
from mpi4py import         


        
2条回答
  •  盖世英雄少女心
    2021-02-20 15:27

    As suggested above and in this question for C, this has to do with having mpirun coming from a different MPI than mpi4py was linked against.

    In my case, and I suspect the same is true for many other Python users, this came from having originally installed mpi4py through conda, which pulled a non-system version of MPI into my conda -- i.e. which mpirun gave a path in my conda environment.

    To solve the problem, I ran conda remove mpi4py and then pip install mpi4py, which seemed to rebuild mpi4py against the MPI in the conda environment and solved the issue.

提交回复
热议问题