From 9ebbe661e521d1adc8b1a70241c8683477da424c Mon Sep 17 00:00:00 2001 From: bjjwwang Date: Tue, 19 Oct 2021 07:40:40 +0000 Subject: [PATCH] fix cudnn cmake --- cmake/external/cudnn.cmake | 7 +++++-- cmake/paddlepaddle.cmake | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/external/cudnn.cmake b/cmake/external/cudnn.cmake index 98466d44..f560d872 100644 --- a/cmake/external/cudnn.cmake +++ b/cmake/external/cudnn.cmake @@ -61,8 +61,11 @@ else() endif() if(CUDNN_FOUND) - file(READ ${CUDNN_INCLUDE_DIR}/cudnn.h CUDNN_VERSION_FILE_CONTENTS) - + if(EXISTS "${CUDNN_INCLUDE_DIR}/cudnn_version.h") + file(READ ${CUDNN_INCLUDE_DIR}/cudnn_version.h CUDNN_VERSION_FILE_CONTENTS) + elseif(EXISTS "${CUDNN_INCLUDE_DIR}/cudnn.h") + file(READ ${CUDNN_INCLUDE_DIR}/cudnn.h CUDNN_VERSION_FILE_CONTENTS) + endif() get_filename_component(CUDNN_LIB_PATH ${CUDNN_LIBRARY} DIRECTORY) string(REGEX MATCH "define CUDNN_VERSION +([0-9]+)" diff --git a/cmake/paddlepaddle.cmake b/cmake/paddlepaddle.cmake index 240c8576..67594621 100644 --- a/cmake/paddlepaddle.cmake +++ b/cmake/paddlepaddle.cmake @@ -27,7 +27,7 @@ set(prefix_path "${THIRD_PARTY_PATH}/install/gflags|${THIRD_PARTY_PATH}/install/ message( "WITH_GPU = ${WITH_GPU}") - +message("CUDA: ${CUDA_VERSION}, CUDNN_MAJOR_VERSION: ${CUDNN_MAJOR_VERSION}" ) # Paddle Version should be one of: # latest: latest develop build # version number like 1.5.2 -- GitLab