Reputation: 469
I am running the following Python Script with mpi4py
version 3.0.1a0
:
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
and submitting it via mpiexec -n 16 python test_run.py
to the cluster. It seems that everything works, because I do not get any error, however, it does not do what I expect, meaning it does not recognize the barrier:
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
I also tried to add comm.bcast(bla,root=0)
, but this also did not do anything. Why is mpi4py
not able to perform these tasks?
Upvotes: 1
Views: 1853
Reputation: 469
The problem was the with the MPI. Using mopish/3.1.4/intel
instead of openmpi
and recompiling mpi4py
with this works, so it seems to have been a platform/infrastructure-dependent issue.
Upvotes: 1