Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NVIDIA] Add CUDNN_INCLUDE_DIR #831

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions modules/nvidia_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ find_library(CUDNN_PATH
${HAS_REQUIRED}
HINTS "$ENV{CUDNN_PATH}" "${CUDA_TOOLKIT_ROOT_DIR}" "${CUDA_PATH}" "$ENV{CUDA_PATH}"
PATH_SUFFIXES nvidia/current lib64 lib/x64 lib)
get_filename_component(CUDNN_INCLUDE_DIR "${CUDNN_PATH}" DIRECTORY)
get_filename_component(CUDNN_INCLUDE_DIR "${CUDNN_INCLUDE_DIR}/../../include" REALPATH)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we need to find headers instead of simple relative paths..


if(CUDAToolkit_VERSION_MAJOR LESS_EQUAL 10)
set(CUTENSOR_LIB_DIRS lib/10.2 libcutensor/10.2)
Expand All @@ -118,14 +120,18 @@ endif()
message("-- [nvidia_gpu] CUTENSOR_PATH ${CUTENSOR_PATH}")
message("-- [nvidia_gpu] CUTENSOR_INCLUDE_DIR ${CUTENSOR_INCLUDE_DIR}")
message("-- [nvidia_gpu] CUDNN_PATH ${CUDNN_PATH}")
message("-- [nvidia_gpu] CUDNN_INCLUDE_DIR ${CUDNN_INCLUDE_DIR}")
message("-- [nvidia_gpu] CUBLAS_PATH ${CUBLAS_PATH}")

add_library(CUDA::cudnn SHARED IMPORTED)
set_target_properties(CUDA::cudnn PROPERTIES IMPORTED_LOCATION "${CUDNN_PATH}")
set_target_properties(CUDA::cudnn PROPERTIES IMPORTED_IMPLIB "${CUDNN_PATH}")
set_target_properties(CUDA::cudnn PROPERTIES IMPORTED_LOCATION "${CUDNN_PATH}"
IMPORTED_IMPLIB "${CUDNN_PATH}"
INTERFACE_INCLUDE_DIRECTORIES "${CUDNN_INCLUDE_DIR}")

add_library(CUDA::cutensor SHARED IMPORTED)
set_target_properties(CUDA::cutensor PROPERTIES IMPORTED_LOCATION "${CUTENSOR_PATH}")
set_target_properties(CUDA::cutensor PROPERTIES IMPORTED_IMPLIB "${CUTENSOR_PATH}")
set_target_properties(CUDA::cutensor PROPERTIES IMPORTED_LOCATION "${CUTENSOR_PATH}"
IMPORTED_IMPLIB "${CUTENSOR_PATH}"
INTERFACE_INCLUDE_DIRECTORIES "${CUTENSOR_INCLUDE_DIR}")

if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
if(CUDAToolkit_VERSION_MAJOR LESS_EQUAL 10)
Expand Down
1 change: 1 addition & 0 deletions modules/nvidia_plugin/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ target_include_directories(${OBJ_NAME}
)
target_include_directories(${OBJ_NAME}
PUBLIC
"${CUDNN_INCLUDE_DIR}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ilya-lavrenov could you take a look? Without it cudnn.h wasn't found even if I specified INTERFACE_INCLUDE_DIRECTORIES "${CUDNN_INCLUDE_DIR}"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange because we have linkage with CUDA::cutensor below and it should populate headers we set before.
But let's avoid spending extra time on it :)

"${CUTENSOR_INCLUDE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${OpenVINONVIDIAGpuPlugin_SOURCE_DIR}/include"
Expand Down
Loading