Engines¶
The execution of the multistarts can be parallelized in different ways, e.g. multi-threaded or cluster-based. Note that it is not checked whether a single multistart itself is parallelized.
-
class
pypesto.engine.
SingleCoreEngine
¶ Bases:
pypesto.engine.base.Engine
Dummy engine for sequential execution on one core. Note that the objective itself may be multithreaded.
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
execute
(tasks)¶ Execute all tasks in a simple for loop sequentially.
-
-
class
pypesto.engine.
MultiProcessEngine
(n_procs: int = None)¶ Bases:
pypesto.engine.base.Engine
Parallelize the task execution using the multiprocessing.Pool environment.
-
n_procs
¶ int, optional – The number of cores to use. Defaults to the number of cpus available on the system according to
os.cpu_count()
. The effectively used number of cores will be the minimum of n_procs and the number of tasks submitted (and the number of CPUs available).
-
__init__
(n_procs: int = None)¶ Initialize self. See help(type(self)) for accurate signature.
-
execute
(tasks)¶
-
-
class
pypesto.engine.
OptimizerTask
(optimizer, problem, startpoint, j_start, options, handle_exception)¶ Bases:
pypesto.engine.task.Task
A multistart optimization task, performed in pypesto.minimize.
-
__init__
(optimizer, problem, startpoint, j_start, options, handle_exception)¶ Create the task object.
Parameters: - optimizer (the optimizer to use.) –
- problem (the problem to solve.) –
- startpoint (the point from which to start.) –
- j_start (the index of the multistart.) –
- options (options object applying to optimization.) –
- handle_exception (callable to apply when the optimization fails.) –
-
execute
()¶ Execute the task and return its results.
-