小编ziu*_*iuu的帖子

mpiexec和python mpi4py给出等级0和大小1

我在虚拟机上运行python Hello World mpi4py代码时遇到问题.

hello.py代码是:

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

comm = MPI.COMM_WORLD

size = comm.Get_size()
rank = comm.Get_rank()

print "hello world from process ", rank,"of", size
Run Code Online (Sandbox Code Playgroud)

我试图用mpiexec和mpirun来运行它,但运行不好.输出:

$ mpirun -c 4 python hello.py 
hello world from process  0 of 1
hello world from process  0 of 1
hello world from process  0 of 1
hello world from process  0 of 1
Run Code Online (Sandbox Code Playgroud)

从mpiexec:

$ mpiexec -n 4 python hello.py 
hello world from process  0 of 1
hello world from …
Run Code Online (Sandbox Code Playgroud)

python mpi mpiexec mpi4py

8
推荐指数
1
解决办法
4971
查看次数

标签 统计

mpi ×1

mpi4py ×1

mpiexec ×1

python ×1