zwembad package¶
Submodules¶
zwembad.pool module¶
-
class
zwembad.pool.ExitObject¶ Bases:
objectObject returned from the context manager to all non-master processes. Any attribute access on this object will raise a
WorkerExitSuiteSignalso that the context is exited.-
is_master()¶
-
is_worker()¶
-
workers_exit()¶
-
-
class
zwembad.pool.MPIPoolExecutor(master=0, comm=None)¶ Bases:
concurrent.futures._base.ExecutorMPI based Executor. Will use all available MPI processes to execute submissions to the pool. The MPI process with rank 0 will continue while all other ranks halt and
-
property
idling¶
-
is_master()¶
-
is_worker()¶
-
map(fn, *iterables)¶ Submits jobs for as long as all
iterablesprovide values and places the results in a list. The iterables are consumed greedily.
-
shutdown()¶ Close the pool and tell all workers to stop their work loop
-
property
size¶
-
submit(fn, *args, **kwargs)¶ Submit a task to the MPIPool.
fn(*args, **kwargs)will be called on an MPI process meaning that all data must be communicable over the MPI communicator, which by default uses pickle.- Parameters
fn (callable) – Function to call on the worker MPI process.
-
workers_exit()¶
-
property
-
exception
zwembad.pool.PoolGuardError¶ Bases:
ExceptionThis error is raised if a user forgets to guard their pool context with a :method:`~.pool.MPIPoolExecutor.workers_exit` call.
-
exception
zwembad.pool.WorkerExitSuiteSignal¶ Bases:
ExceptionThis signal is raised when a worker needs to exit before executing the suite of a
withstatement that only the master should execute.