Reputation: 3550
I'm running a Logistic Regression classifier on Lasagne/Theano with multiple cpu cores.
This is my ~/.theanorc file:
[global]
OMP_NUM_THREADS=20
theano/misc/check_blas.py consumes all 20 cores but my script doesn't. when I run:
python -c 'import theano; print(theano.config)'
I see that the value of openmp is False:
openmp () Doc: Allow (or not) parallel computation on the CPU with OpenMP. This is the default value used when creating an Op that supports OpenMP parallelization. It is preferable to define it via the Theano configuration file ~/.theanorc or with the environment variable THEANO_FLAGS. Parallelization is only done for some operations that implement it, and even for operations that implement parallelism, each operation is free to respect this flag or not. You can control the number of threads used with the environment variable OMP_NUM_THREADS. If it is set to 1, we disable openmp in Theano by default. Value: False
Does anybody know How I should enable the multi-core feature for my script?
blas, atlas, openmp, etc. are installed on my system and as I said work perfectly with check_blas.py.
Upvotes: 1
Views: 2224
Reputation: 3550
I found the reason. Besides OMP_NUM_THREADS=20, openmp=True should also be set in the ~/.theanorc file and now it consumes all the 20 cores. My ~/.theanorc file now looks like:
[global]
OMP_NUM_THREADS=20
openmp=True
Upvotes: 4