pyUSID.processing.comp_utils.recommend_cpu_cores

pyUSID.processing.comp_utils.recommend_cpu_cores(num_jobs, requested_cores=None, min_free_cores=None, lengthy_computation=False, verbose=False)[source]

Decides the number of cores to use for parallel computing

Parameters:
  • num_jobs (unsigned int) – Number of times a parallel operation needs to be performed

  • requested_cores (unsigned int (Optional. Default = None)) – Number of logical cores to use for computation

  • lengthy_computation (Boolean (Optional. Default = False)) – Whether or not each computation takes a long time.

  • min_free_cores (uint (Optional, default = 1 if number of logical cores) – < 5 and 2 otherwise) Number of CPU cores that should not be used)

  • verbose (Boolean (Optional. Default = False)) – Whether or not to print statements that aid in debugging

Returns:

requested_cores – Number of logical cores to use for computation

Return type:

unsigned int

Notes

If each computation is quick, the overhead of starting and using a larger number of cores would defeat the benefits of parallel computation, so use fewer cores instead.

Eg- Band Excitation (BE) simple harmonic fitting is fast (~ few msec/spectrum) so set lengthy_computation to False, Eg- Bayesian Inference is very slow (~ 10-20 sec) so set lengthy_computation to True