relative_cores

sofia_redux.toolkit.utilities.multiprocessing.relative_cores(jobs)[source]

Return the actual number of cores to use for a given number of jobs.

Returns 1 in cases where jobs is None or 0. If jobs is less than zero, the returned value will be max_available_cores + jobs + 1. i.e., -1 will use all available cores.

Parameters:
jobsint or float or None
Returns:
n_coresint

The number of cores to use which will always be in the range 1 -> max_available_cores.