Build pytorch v0.4.0 with CuDNN

I was trying to build pytorch 0.4.0 on my linux with cuda 9.1. However, after doing python install, I found that cudnn is not included given UserWarning: PyTorch was compiled without cuDNN support. To use cuDNN, rebuild PyTorch making sure the library is visible to the build system.

I did some check:


Further, in terminal

-bash: /usr/local/cuda-9.1/lib64/: Is a directory
-bash: /usr/local/cuda-9.1/include/: Is a directory

Does anyone have some ideas on what I should do now? and cudnn.h have to be in their respective CUDNN_LIB_DIR and CUDNN_INCLUDE_DIR, make sure that this is the case.
Cudnn detection during compilation is done in this file, make sure that cudnn is actually found when you compile.

1 Like

It’s weird that they are not in the corresponding cuda dir. Any thoughts? Also, I once tried to install pytorch with a provided binary file, and I did not get errors when running the code. How does that happen?

You have to separately install cudnn either by downloading it from nvidia’s site or from deb package or via conda package. Cudnn is not a part of cuda toolkit. Pytorch binaries include cudnn, so when you are using pytorch binaries, you don’t have to separately install cudnn.