clab / dynet

DyNet: The Dynamic Neural Network Toolkit
Apache License 2.0
3.42k stars 704 forks source link

Conv2D::forward_dev_impl error with regard to CUDNN #1110

Closed leej35 closed 6 years ago

leej35 commented 6 years ago

Hi, I tried to run this CNN on text demo at: https://github.com/neubig/nn4nlp2017-code/blob/master/05-cnn/cnn-class.py

When I run the code without GPU flag, it works without any problem. But when I run it with GPU flag, it gives me this error:

python cnn-class.py --dynet-devices GPU:0
[dynet] initializing CUDA
[dynet] Request for 1 specific GPU ...
[dynet] Device Number: 0
[dynet]   Device name: GeForce GTX 1060 6GB
[dynet]   Memory Clock Rate (KHz): 4004000
[dynet]   Memory Bus Width (bits): 192
[dynet]   Peak Memory Bandwidth (GB/s): 192.192
[dynet]   Memory Free (GB): 6.28143/6.36636
[dynet]
[dynet] Device(s) selected: 0
[dynet] random seed: 3556292422
[dynet] allocating memory: 512MB
[dynet] memory allocation done.
Traceback (most recent call last):
  File "cnn-class.py", line 67, in <module>
    predict = np.argmax(scores.npvalue())
  File "_dynet.pyx", line 1724, in _dynet.Expression.npvalue
  File "_dynet.pyx", line 1739, in _dynet.Expression.npvalue
RuntimeError: Conv2D::forward_dev_impl not supported without CUDNN

To confirm that CUDNN installation is okay, I ran these codes on language model (https://github.com/neubig/nn4nlp2017-code/blob/master/02-lm/nn-lm-batch.py) and LSTM-sentiment modeling (https://github.com/neubig/nn4nlp2017-code/blob/master/06-rnn/sentiment-lstm.py) with GPU flag and these were executed without problem.

So I suspect probably there can be some issue on CUDNN backed convolution layer of Dynet.

FYI, I use Ubuntu 17.04 with CUDA 8.0 and CuDNN 5.1.

Thanks, Jeongmin

zhisbug commented 6 years ago

DId you compile DyNet with cuDNN?

neubig commented 6 years ago

And also: DyNet only uses cuDNN for a small subset of the functions, including Conv2D. You can run a regular LSTM without cuDNN, so it's likely that cuDNN simply wasn't installed w/ DyNet.

leej35 commented 6 years ago

Thanks for advices. I reinstalled Dynet with cuDNN path explicitly fed in and it works well now.