Cudnn error occurs when installing pytorch from source

I’m trying to install torch from source and met the following problem. When I install the former version (pytorch0.3.0), everything is ok. Can someone help me?

[ 95%] Linking CXX executable verify_api_visibility
[ 95%] Linking CXX executable cudnn_test
[ 95%] Linking CXX executable dlconvertor_test
[ 96%] Linking CXX executable wrapdim_test
[ 96%] Linking CXX executable undefined_tensor_test
[ 96%] Built target verify_api_visibility
[ 96%] Built target cudnn_test
[ 97%] Linking CXX executable scalar_test
[ 98%] Linking CXX executable atest
[ 99%] Linking CXX executable broadcast_test
…/libATen.so.1: undefined reference to cudnnRestoreDropoutDescriptor' ../libATen.so.1: undefined reference to cudnnSetRNNDescriptor_v6’
…/libATen.so.1: undefined reference to cudnnSetConvolutionGroupCount' ../libATen.so.1: undefined reference to cudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
make[2]: *** [src/ATen/test/dlconvertor_test] Error 1
make[1]: *** [src/ATen/test/CMakeFiles/dlconvertor_test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
…/libATen.so.1: undefined reference to cudnnRestoreDropoutDescriptor' ../libATen.so.1: undefined reference to cudnnSetRNNDescriptor_v6’
…/libATen.so.1: undefined reference to cudnnSetConvolutionGroupCount' ../libATen.so.1: undefined reference to cudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
make[2]: *** [src/ATen/test/wrapdim_test] Error 1
make[1]: *** [src/ATen/test/CMakeFiles/wrapdim_test.dir/all] Error 2
[ 99%] Linking CXX executable scalar_tensor_test
…/libATen.so.1: undefined reference to cudnnRestoreDropoutDescriptor' ../libATen.so.1: undefined reference to cudnnSetRNNDescriptor_v6’
…/libATen.so.1: undefined reference to cudnnSetConvolutionGroupCount' ../libATen.so.1: undefined reference to cudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
make[2]: *** [src/ATen/test/undefined_tensor_test] Error 1
make[1]: *** [src/ATen/test/CMakeFiles/undefined_tensor_test.dir/all] Error 2
…/libATen.so.1: undefined reference to cudnnRestoreDropoutDescriptor' ../libATen.so.1: undefined reference to cudnnSetRNNDescriptor_v6’
…/libATen.so.1: undefined reference to cudnnSetConvolutionGroupCount' ../libATen.so.1: undefined reference to cudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
make[2]: *** [src/ATen/test/scalar_test] Error 1
make[1]: *** [src/ATen/test/CMakeFiles/scalar_test.dir/all] Error 2
…/libATen.so.1: undefined reference to cudnnRestoreDropoutDescriptor' ../libATen.so.1: undefined reference to cudnnSetRNNDescriptor_v6’
…/libATen.so.1: undefined reference to cudnnSetConvolutionGroupCount' ../libATen.so.1: undefined reference to cudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
make[2]: *** [src/ATen/test/atest] Error 1
make[1]: *** [src/ATen/test/CMakeFiles/atest.dir/all] Error 2
…/libATen.so.1: undefined reference to cudnnRestoreDropoutDescriptor' ../libATen.so.1: undefined reference to cudnnSetRNNDescriptor_v6’
…/libATen.so.1: undefined reference to cudnnSetConvolutionGroupCount' ../libATen.so.1: undefined reference to cudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
make[2]: *** [src/ATen/test/broadcast_test] Error 1
make[1]: *** [src/ATen/test/CMakeFiles/broadcast_test.dir/all] Error 2
…/libATen.so.1: undefined reference to cudnnRestoreDropoutDescriptor' ../libATen.so.1: undefined reference to cudnnSetRNNDescriptor_v6’
…/libATen.so.1: undefined reference to cudnnSetConvolutionGroupCount' ../libATen.so.1: undefined reference to cudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
make[2]: *** [src/ATen/test/scalar_tensor_test] Error 1
make[1]: *** [src/ATen/test/CMakeFiles/scalar_tensor_test.dir/all] Error 2
[ 99%] Linking CXX executable basic
[100%] Linking CXX executable native_test
…/libATen.so.1: undefined reference to cudnnRestoreDropoutDescriptor' ../libATen.so.1: undefined reference to cudnnSetRNNDescriptor_v6’
…/libATen.so.1: undefined reference to cudnnSetConvolutionGroupCount' ../libATen.so.1: undefined reference to cudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
make[2]: *** [src/ATen/test/basic] Error 1
make[1]: *** [src/ATen/test/CMakeFiles/basic.dir/all] Error 2
…/libATen.so.1: undefined reference to cudnnRestoreDropoutDescriptor' ../libATen.so.1: undefined reference to cudnnSetRNNDescriptor_v6’
…/libATen.so.1: undefined reference to cudnnSetConvolutionGroupCount' ../libATen.so.1: undefined reference to cudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
make[2]: *** [src/ATen/test/native_test] Error 1
make[1]: *** [src/ATen/test/CMakeFiles/native_test.dir/all] Error 2
make: *** [all] Error 2

The packages I installed are list as follows:

conda list
bzip2 1.0.6 h9a117a8_4
ca-certificates 2017.08.26 h1d4fec5_0
certifi 2018.1.18 py36_0
cffi 1.11.4 py36h9745a5d_0
cloog 0.18.1 1 serge-sans-paille
cmake 3.7.1 700 biobuilds
cudatoolkit 8.0 3
cudnn 7.0.5 cuda8.0_0
curl 7.58.0 h84994c4_0
expat 2.2.5 he0dffb1_0
freetype 2.8 hab7d2ae_1
gmp 5.1.3 0 serge-sans-paille
intel-openmp 2018.0.0 hc7b2577_8
isl 0.12.2 0
jpeg 9b h024ee3a_2
libcurl 7.58.0 h1ad7b7a_0
libedit 3.1 heed3624_0
libffi 3.2.1 hd88cf55_4
libgcc 7.2.0 h69d50b8_2
libgcc-ng 7.2.0 h7cc24e2_2
libgfortran-ng 7.2.0 h9f7466a_2
libpng 1.6.34 hb9fc6fc_0
libssh2 1.8.0 h9cfc8f7_4
libstdcxx-ng 7.2.0 h7a57d05_2
libtiff 4.0.9 h28f6b97_0
libuv 1.14.0 h56b52c2_0
magma-cuda80 2.2.0 h39f1f8d_1 pytorch
mkl 2018.0.1 h19d6760_4
mpc 1.0.3 hf803216_4
mpfr 3.1.5 h12ff648_1
ncurses 6.0 h9df7e31_2
numpy 1.14.0 py36h3dfced4_1
olefile 0.45.1 py36_0
openssl 1.0.2n hb7f436b_0
pillow 5.0.0 py36h3deb7b8_0
pip 9.0.1 py36h6c6f9ce_4
pycparser 2.18 py36hf9f622e_1
python 3.6.4 hc3d631a_1
pyyaml 3.12 py36hafb9ca4_1
readline 7.0 ha6073c6_4
rhash 1.3.5 hbf7ad62_1
setuptools 38.4.0 py36_0
six 1.11.0 py36h372c433_1
sqlite 3.22.0 h1bed415_0
tk 8.6.7 hc745277_3
wheel 0.30.0 py36hfd4bba0_1
xz 5.2.3 h55aa19d_2
yaml 0.1.7 had09818_2
zlib 1.2.11 ha838bed_2

1 Like

I had the same issue on pytorch v0.4 when compiling from source.

Which version of cuDNN have you installed? Also, do you have more than one cuDNN version installed?
If so, try to remove one and run the build process again.

delete or clear some older torch\pytorch