Lasagne/Theano 不消耗多核,而 check_blas.py 消耗多核

Lasagne/Theano doesn't consume multi cores while check_blas.py does

我运行在 Lasagne/Theano 上使用多个 cpu 核心进行逻辑回归分类器。

这是我的 ~/.theanorc 文件:

[global]
OMP_NUM_THREADS=20

theano/misc/check_blas.py 消耗所有 20 个内核,但我的脚本没有。 当我 运行:

python -c 'import theano; print(theano.config)' 

我看到openmp的值为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

有人知道我应该如何为我的脚本启用多核功能吗?

blas、atlas、openmp 等都安装在我的系统上,正如我所说,可以与 check_blas.py 完美配合。

找到原因了。除了 OMP_NUM_THREADS=20openmp=True 也应该在 ~/.theanorc 文件中设置,现在它消耗了所有 20核心。 我的 ~/.theanorc 文件现在看起来像:

[global]
OMP_NUM_THREADS=20
openmp=True