我正在使用mpi4py
版本3.0.1a0
运行以下Python脚本:
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
print 'INIT',rank,size
comm.Barrier()
if rank==0:
bla=4
else:
bla=None
print 'BEFORE',rank,bla
comm.Barrier()
print 'AFTER',rank,bla
并通过mpiexec -n 16 python test_run.py
将其提交给群集。似乎一切正常,因为我没有得到任何错误,但是,它没有达到我的预期,这意味着它无法识别障碍:
INIT 1 16
BEFORE 1 None
AFTER 1 None
INIT 2 16
BEFORE 2 None
AFTER 2 None
INIT 3 16
BEFORE 3 None
AFTER 3 None
INIT 4 16
BEFORE 4 None
AFTER 4 None
INIT 5 16
BEFORE 5 None
AFTER 5 None
INIT 6 16
BEFORE 6 None
AFTER 6 None
INIT 7 16
BEFORE 7 None
AFTER 7 None
INIT 8 16
BEFORE 8 None
AFTER 8 None
INIT 9 16
BEFORE 9 None
AFTER 9 None
INIT 10 16
BEFORE 10 None
AFTER 10 None
INIT 11 16
BEFORE 11 None
AFTER 11 None
INIT 12 16
BEFORE 12 None
AFTER 12 None
INIT 13 16
BEFORE 13 None
AFTER 13 None
INIT 14 16
BEFORE 14 None
AFTER 14 None
INIT 15 16
BEFORE 15 None
AFTER 15 None
INIT 0 16
BEFORE 0 4
AFTER 0 4
我还尝试添加comm.bcast(bla,root=0)
,但这也没有做任何事情。为什么mpi4py
无法执行这些任务?
答案 0 :(得分:1)
问题在于MPI。使用mopish/3.1.4/intel
代替openmpi
并重新编译mpi4py
,这似乎是一个平台/基础架构相关的问题。