tfep.utils.parallel.ParallelizationStrategy

class tfep.utils.parallel.ParallelizationStrategy[source]

Bases: ABC

The API of a ParallelizationStrategy object.

To implement a new parallelization strategy compatible with the tfep library, the object must implement the run method, which encapsulate the parallelization of a function over the arguments to distribute.

__init__()

Methods

__init__()

run(func, args)

Parallelize the function over the arguments.

abstract 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 the i-th execution, and they are passed to the function as func(*args[i]).

Returns:

resultsresults[i] is the return value of the function called with args[i].

Return type:

List