[CMake] Explicitly error out if CuDNN older than 8.5 (#118235)

Also update README.md
Fixes https://github.com/pytorch/pytorch/issues/118193

Pull Request resolved: https://github.com/pytorch/pytorch/pull/118235
Approved by: https://github.com/zou3519
This commit is contained in:
Nikita Shulga 2024-01-25 23:41:01 +00:00 committed by PyTorch MergeBot
parent 71757093c5
commit 8c167f9fc3
2 changed files with 4 additions and 1 deletions

View File

@ -164,7 +164,7 @@ We highly recommend installing an [Anaconda](https://www.anaconda.com/download)
If you want to compile with CUDA support, [select a supported version of CUDA from our support matrix](https://pytorch.org/get-started/locally/), then install the following:
- [NVIDIA CUDA](https://developer.nvidia.com/cuda-downloads)
- [NVIDIA cuDNN](https://developer.nvidia.com/cudnn) v7 or above
- [NVIDIA cuDNN](https://developer.nvidia.com/cudnn) v8.5 or above
- [Compiler](https://gist.github.com/ax3l/9489132) compatible with CUDA
Note: You could refer to the [cuDNN Support Matrix](https://docs.nvidia.com/deeplearning/cudnn/pdf/cuDNN-Support-Matrix.pdf) for cuDNN versions with the various supported CUDA, CUDA driver and NVIDIA hardware

View File

@ -1222,6 +1222,9 @@ endif(USE_LLVM)
# ---[ cuDNN
if(USE_CUDNN)
if(CUDNN_VERSION VERSION_LESS 8.5)
message(FATAL_ERROR "PyTorch needs CuDNN-8.5 or above, but found ${CUDNN_VERSION}. Builds are still possible with `USE_CUDNN=0`")
endif()
set(CUDNN_FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../third_party/cudnn_frontend/include)
target_include_directories(torch::cudnn INTERFACE ${CUDNN_FRONTEND_INCLUDE_DIR})
endif()