libparallel: multiprocessing helping functions
Module in charge of parallelizing the execution of tasks.
- class haddock.libs.libparallel.GenericTask(function, *args, **kwargs)[source]
Bases:
object
Generic task to be executed.
- class haddock.libs.libparallel.Scheduler(tasks: list[SupportsRunT], ncores: int | None = None, max_cpus: bool = False)[source]
Bases:
object
Schedules tasks to run in multiprocessing.
- class haddock.libs.libparallel.Worker(tasks: Sequence[SupportsRunT], results: Queue)[source]
Bases:
Process
Work on tasks.
- haddock.libs.libparallel.get_index_list(nmodels, ncores)[source]
Optimal distribution of models among cores
- Parameters:
nmodels (int) – Number of models to be distributed.
ncores (int) – Number of cores to be used.
- Returns:
index_list (list) – List of model indexes to be used for the parallel scanning.