How to build with cuDNN

HI,
There is cudnn5.0 lib on my PC, however I got warning:

UserWarning: PyTorch was compiled without cuDNN support. To use cuDNN, rebuild PyTorch making sure the library is visible to the build system.
  "PyTorch was compiled without cuDNN support. To use cuDNN, rebuild "

How to build pytorch with cuDNN support?
cudnn.h is in /usr/local/cuda-8.0/include/cudnnv5/ and cudnn.so.5 is in /usr/local/cuda-8.0/lib64/cuDNNv5/. The path has been added in system environment variable.

export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64/cuDNNv5:$LD_LIBRARY_PATH

I build the pytorch from source code.

cd pytorch-root/ & python setup.py install

THANKS

1 Like
export CUDNN_INCLUDE_DIR="/usr/local/cuda-8.0/include/cudnnv5/"
export CUDNN_LIB_DIR="/usr/local/cuda-8.0/lib64/cuDNNv5/"

Thanks for your reply. However it does not work, and blow is buidling log

running build_ext
-- Building with NumPy bindings
-- Not using cuDNN
-- Detected CUDA at /usr/local/cuda
-- Building NCCL library
building 'torch._C' extension

Is there any other variable needed to specify CUDNN? I just build the pytorch: python setup.py build

that’s weird. do you also have cudnn.so apart from cudnn.so.5?

Yes, There are cudnn.so, cudnn.so.5 and cudnn.so.5.0.5.

oh, i realized that when you mentioned the paths, for include dir you said it’s cudnnv5 but for lib dir it’s cuDNNv5. The paths are case-sensitive, so check if one of them is the wrong case.

Path is right and that is not the reason. So strange.

cudnn is not being detected even after exporting the paths.

I tried the following:

My cudnn libraries are in ~/cuda/

export CUDNN_INCLUDE_DIR=~/cuda/include/
export CUDNN_LIB_DIR=~/cuda/lib64/

And then in python3, it returns nothing when I query for the cudnn version.

>>> import torch
>>> torch.backends.cudnn.version()
>>>