mpi4py: Idle process occupies 100

When only one node is computing, the IDLE process occupies 100% of the CPU. A workaround is to replace COMM.barrier() by this function:

Example usage:

from mpi4py import MPI
import time
comm = MPI.COMM_WORLD
tic = MPI.Wtime()
if comm.rank==0:
    time.sleep(10)
barrier(comm) # Instead of comm.barrier()
toc = MPI.Wtime()
print comm.rank, toc-tic
If you want to ask me a question or leave me a message add @bougui505 in your comment.