mpi4py_ is a Python wrapper around MPI.
-.. _mpi4py: http://mpi4py.scipy.org/http://mpi4py.scipy.org/vb>
+.. _mpi4py: http://mpi4py.scipy.org/
The MPIManager data flow is a bit complicated, so I've made a
diagram::
nodes are free (and therefore ready to receive new jobs).
"""
+import os
from Queue import Queue, Empty
import sys
from threading import Thread
'w.run()',
'w.teardown()',
])
- if worker_pool == None:
- worker_pool = MPI.COMM_WORLD.Get_size()
+ if worker_pool is None:
+ worker_pool = int(os.environ.get('WORKER_POOL',
+ MPI.COMM_WORLD.Get_size()))
comm = MPI.COMM_SELF.Spawn( # locks with mpich2 if no mpd running
sys.executable, args=['-c', spawn_script], maxprocs=worker_pool)
rank = comm.Get_rank()