CuCalc icon indicating copy to clipboard operation
CuCalc copied to clipboard

To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU"

Open billpage opened this issue 6 years ago • 3 comments

With Jyptyer worksheet anaconda_kernel:

import theano
from theano import tensor

I get the following error message:

RuntimeErrorTraceback (most recent call last)
<ipython-input-1-78067c42f5c0> in <module>()
----> 1 import theano
      2 from theano import tensor
/opt/conda/lib/python2.7/site-packages/theano/__init__.pyc in <module>()
    122 from theano.printing import pprint, pp
    123 
--> 124 from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
    125                                 scan_checkpoints)
    126 
/opt/conda/lib/python2.7/site-packages/theano/scan_module/__init__.py in <module>()
     39 __contact__ = "Razvan Pascanu <r.pascanu@gmail>"
     40 
---> 41 from theano.scan_module import scan_opt
     42 from theano.scan_module.scan import scan
     43 from theano.scan_module.scan_checkpoints import scan_checkpoints
/opt/conda/lib/python2.7/site-packages/theano/scan_module/scan_opt.py in <module>()
     58 
     59 import theano
---> 60 from theano import tensor, scalar
     61 from theano.tensor import opt, get_scalar_constant_value, Alloc, AllocEmpty
     62 from theano import gof
/opt/conda/lib/python2.7/site-packages/theano/tensor/__init__.py in <module>()
     15 from theano.tensor import opt
     16 from theano.tensor import opt_uncanonicalize
---> 17 from theano.tensor import blas
     18 from theano.tensor import blas_scipy
     19 from theano.tensor import blas_c
/opt/conda/lib/python2.7/site-packages/theano/tensor/blas.py in <module>()
    153 from theano.scalar import bool as bool_t
    154 from theano.tensor import basic as T
--> 155 from theano.tensor.blas_headers import blas_header_text
    156 from theano.tensor.blas_headers import blas_header_version
    157 from theano.tensor.opt import in2out, local_dimshuffle_lift
/opt/conda/lib/python2.7/site-packages/theano/tensor/blas_headers.py in <module>()
    985 
    986 
--> 987 if not config.blas.ldflags:
    988     _logger.warning('Using NumPy C-API based implementation for BLAS functions.')
    989 
/opt/conda/lib/python2.7/site-packages/theano/configparser.pyc in __get__(self, cls, type_, delete_key)
    330             except KeyError:
    331                 if callable(self.default):
--> 332                     val_str = self.default()
    333                 else:
    334                     val_str = self.default
/opt/conda/lib/python2.7/site-packages/theano/configdefaults.pyc in default_blas_ldflags()
   1406             res = try_blas_flag(flags)
   1407             if res:
-> 1408                 check_mkl_openmp()
   1409                 maybe_add_to_os_environ_pathlist('PATH', lib_path[0])
   1410                 return res
/opt/conda/lib/python2.7/site-packages/theano/configdefaults.pyc in check_mkl_openmp()
   1250         import mkl
   1251         if '2018' in mkl.get_version_string():
-> 1252             raise RuntimeError('To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU" in your environement.')
   1253     except ImportError:
   1254         raise RuntimeError("""
RuntimeError: To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU" in your environement.

billpage avatar Jan 15 '18 17:01 billpage

Work-round:

import os
os.environ["MKL_THREADING_LAYER"] = "GNU"

Restart kernel.

billpage avatar Jan 15 '18 17:01 billpage

I could not verify the problem with the latest version. My output is:

Using cuDNN version 7005 on context None
Mapped name None to device cuda0: GeForce GTX 780 (0000:02:00.0)

ktaletsk avatar Feb 01 '18 02:02 ktaletsk

I could not verify the problem with the latest version. My output is:

Using cuDNN version 7005 on context None
Mapped name None to device cuda0: GeForce GTX 780 (0000:02:00.0)

If someone else came to here from Google search. One solution could be defining cuda first.

[global]
device = cuda
floatX = float32

MohamedElashri avatar Sep 09 '21 04:09 MohamedElashri