Search code examples
pythonscipyinterpolation

Limit CPU cores available to `scipy` when interpolating?


When using scipy RBF interpolation routines it seems that all the cores are used by default. This is ideal to speed up the computation but not ideal on machines where there are other jobs running and the resources are shared.

Is there any way to limit the number of CPU cores available to scipy for computation when interpolating?


Solution

  • Ok, as suggested doing

    os.environ["OPENBLAS_NUM_THREADS"] = "4"
    

    before importing anything else related to numpy or scipy fixed the issue