On Jan 11, 2016 5:05 AM, "Ed Mountjoy" <emou...@gmail.com> wrote:
>
> Hi,
>
> I looking to find a way to restrict the number of cores used when doing OLS regression. At the moment statsmodels is using all available cores. This is a problem as I'm using a trying to run jobs on a cluster with nodes that are shared with other users.
Yeah, this is your BLAS library, so it depends on which BLAS you're using.
For openblas, try setting the environment variable OMP_NUM_THREADS=1. (Technically this is how you tell OpenMP to be not-threaded, so watch out for that in case you're using OpenMP on purpose in your own code. But openblas also pays attention to it in all configurations. If for some reason you want OpenMP code to use multiple threads but openblas not to, then check the openblas docs, I think it's possible.)
If you're using MKL then check the MKL docs.
AFAIK those are the only popular multi-threaded BLAS libraries.
-n
import mkl
mkl.set_num_threads(1)