As soon as I try to import theano library I get this error:
>>> import theano
ERROR (theano.sandbox.cuda): ERROR: Not using GPU. Initialisation of device gpu failed:
initCnmem: cnmemInit call failed! Reason=CNMEM_STATUS_OUT_OF_MEMORY. numdev=1
Content of my .theanorc:
[global]
floatX = float32
device = gpu
optimizer = fast_run
[lib]
cnmem = 0.9
[nvcc]
fastmath = True
[blas]
ldflags = -llapack -lblas
[cmodule]
mac_framework_link=True
I've also tried to run python environment with theano flags, but still the same problem:
$ THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32,lib.cnmem=0.9 python3
They're also mentioning similar issue on Theano Github page: Initialisation of device gpu failed!, however they're talking about float
vs int
value for CNMeM
, which I supposed I have correctly setted to 0.9
(for no special reason, I've actually tried 1.0
, 0.95
, 0.5
and some other values, with same results).
My setup:
- Mac OS X 10.11.4
- Xcode 7.2 (I had to downgrade it from 7.3)
- Cuda 7.5.19
- Python 3.5.1
Solution:
First of all I didn't realize that value of CNMeM
is % of total memory and because I was using the gpu with two monitors I actually didn't have much memory to spare, anyway I've tried 0.1
and it works.
The second problem with cuDNN disabled I solved by adding this line to the theano config:
optimizer_including = cudnn
See this page for more details: sandbox/cuda/dnn