set_nb_cores
- pyoptex.utils.runtime.set_nb_cores(n=1)[source]
Set the runtime environment to use a specified number of cores. Setting the number of cores to one most often results in better performance due to the small dimensions of the matrices, especially when used in combination with
parallel_generation().Note
This function MUST ALWAYS be called before any imports. For example,
>>> from pyoptex.utils.runtime import set_nb_cores >>> set_nb_cores(1) >>> >>> import numba >>> import numpy as np
Parameters
- nint, optional
The number of cores to use. Default is 1.