编译环境, Ubuntu 18.04+Cuda 10.2+Cudnn8.2.1;cmake-3.14.0;gcc-7.5.0
编译Spconv时,报以下错误:
-- Found CUDNN: /usr/local/cuda-10.2/lib64/libcudnn.so
-- Found cuDNN: v? (include: /usr/local/cuda-10.2/include, library: /usr/local/cuda-10.2/lib64/libcudnn.so)
CMake Error at /home/xxx/.local/lib/python3.8/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:172 (message):
PyTorch requires cuDNN 7 and above.
Call Stack (most recent call first):
/home/xxx/.local/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
/home/xxx/.local/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:40 (find_package)
CMakeLists.txt:22 (find_package)
-- Configuring incomplete, errors occurred!
问题原因:
cudnn8及以上版本版本信息放到了上面指令中路径的另一个cudnn_version.h中,因此需要将/home/xxx/.local/lib/python3.8/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake 中的第150行:
file(READ ${CUDNN_INCLUDE_PATH}/cudnn.h CUDNN_HEADER_CONTENTS)修改为:
file(READ ${CUDNN_INCLUDE_PATH}/cudnn_version.h CUDNN_HEADER_CONTENTS)
保存后,重新执行python setup.py bdist_wheel,编译通过!