tfep.utils.parallel.ProcessPoolStrategy
- class tfep.utils.parallel.ProcessPoolStrategy(pool)[source]
Bases:
ParallelizationStrategyParallelization over a pool of processes using
Pool.starmap.- Parameters:
pool (multiprocessing.Pool) – The pool of processes to use to map the arguments.
Methods
__init__(pool)run(func, args)Parallelize the function over the arguments.
- run(func, args)[source]
Parallelize the function over the arguments.
- Parameters:
func (Callable) – The function to parallelize over the arguments.
args (Iterable) – The arguments to distribute across parallel executions of the function.
args[i]are the arguments of thei-th execution, and they are passed to the function asfunc(*args[i]).
- Returns:
results –
results[i]is the return value of the function called withargs[i].- Return type:
List