2

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

talonmies
  • 70,661
  • 34
  • 192
  • 269
Higgcz
  • 55
  • 2
  • 7
  • So I've tried to run it with **CNMeM** disabled (`cnmem=0`), which doesn't throw an error, but also doesn't solve that. However after importing the theano I'm getting a message the **cuDNN** is not available. `Using gpu device 0: GeForce GT 750M (CNMeM is disabled, cuDNN not available)` That's also weird, because I'm pretty sure I have everything ready in the CUDA folder. Apparently this problem is more deeper then I thought. – Higgcz Apr 21 '16 at 18:15
  • It works with GT 940M too. Thanks! imho you should've posted as an answer – Yohanes Gultom Sep 17 '16 at 14:23

1 Answers1

0

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

Higgcz
  • 55
  • 2
  • 7