When I run a py
script there is an error like this
RuntimeError: To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU"
in your environement.
I googled why and in the terminal tried
export MKL_THREADING_LAYER=GNU
and run again, but the problem still exists. I wanted to check whether the environment variable exists or not, so I tried
$ env MKL_THREADING_LAYER=GNU
env: ‘MKL_THREADING_LAYER’: No such file or directory
Does that mean I don't get the environment or what?
Back to the code of the original bug, the problem is this:
File "/home/chen/anaconda2/envs/rllab3/lib/python3.5/site-packages/theano/configdefaults.py", line 1251, in check_mkl_openmp
This is how the code of the library is designed:
def check_mkl_openmp():
if not theano.config.blas.check_openmp:
return
import os
if ('MKL_THREADING_LAYER' in os.environ and
os.environ['MKL_THREADING_LAYER'] == 'GNU'):
return
try:
import mkl
if '2018' in mkl.get_version_string():
raise RuntimeError('To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU" in your environement.')
except ImportError:
raise RuntimeError(""" Could not import 'mkl'. Either install mkl-service with conda or set MKL_THREADING_LAYER=GNU in your environment for MKL 2018.
If you have MKL 2017 install and are not in a conda environment you can set the Theano flag blas.check_openmp to False. Be warned that if you set this flag and don't set the appropriate environment or make sure you have the right version you *will* get wrong results.
""")
How can I set this environment variable and make the original code work?
Best Answer
I used
and it worked!