qml.concurrency.executors.external.mpi.MPIPoolExec¶
- class MPIPoolExec(max_workers=None, persist=False, **kwargs)[source]¶
Bases:
ExtExec
MPIPoolExecutor abstraction class executor.
This executor wraps the mpi4py.futures.MPIPoolExecutor class, and provides support for execution using multiple processes launched using MPI. For an example script
my_script.py
, and an installed mpi4py library with the active MPI environment, the executor can be used as follows:$ mpirun -n 4 -m mpi4py.futures my_script.py
See mpi4py.futures - Command line for additional details on launching jobs.
Note
All calls to the executor are synchronous, and do not currently support the use of futures as a return object.
- Parameters:
*args – non keyword arguments to pass through to the executor backend.
**kwargs – keyword arguments to pass through to the executor backend.
Attributes
Indicates whether the executor will maintain its configured state between calls.
The size of the worker pool for the given executor.
- persist¶
Indicates whether the executor will maintain its configured state between calls.
- size¶
Methods
map
(fn, *args, **kwargs)Single iterable map for batching execution of fn over data entries.
shutdown
()Shutdown the executor backend, if valid.
starmap
(fn, args, **kwargs)Single iterable map for batching execution of fn over data entries, with each entry being a tuple of arguments to fn.
submit
(fn, *args, **kwargs)Single function submission for remote execution with provided args.
- map(fn, *args, **kwargs)[source]¶
Single iterable map for batching execution of fn over data entries. Length of every entry in
*args
must be consistent. kwargs are assumed as broadcastable to each function call.