Skip to content

Commit

Permalink
Add USE_WHOLE_CUDNN option (pytorch#59744)
Browse files Browse the repository at this point in the history
Summary:
It is only enabled if USE_STATIC_CUDNN is enabled

Next step after pytorch#59721 towards resolving fast kernels stripping reported in pytorch#50153

Pull Request resolved: pytorch#59744

Reviewed By: seemethere, ngimel

Differential Revision: D29007314

Pulled By: malfet

fbshipit-source-id: 7091e299c0c6cc2a8aa82fbf49312cecf3bb861a
  • Loading branch information
malfet committed Jun 11, 2021
1 parent f4f5487 commit 6dc44ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ cmake_dependent_option(
cmake_dependent_option(
USE_STATIC_CUDNN "Use cuDNN static libraries" OFF
"USE_CUDNN" OFF)
cmake_dependent_option(
USE_WHOLE_CUDNN "Use whole-library linking for cuDNN" OFF
"USE_STATIC_CUDNN" OFF)
option(USE_FBGEMM "Use FBGEMM (quantized 8-bit server operators)" ON)
option(USE_KINETO "Use Kineto profiling library" ON)
option(USE_CUPTI_SO "Use CUPTI as a shared library" OFF)
Expand Down
12 changes: 9 additions & 3 deletions cmake/public/cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,15 @@ if(CAFFE2_USE_CUDNN)
TARGET caffe2::cudnn-private PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${CUDNN_INCLUDE_PATH})
if(CUDNN_STATIC AND NOT WIN32)
set_property(
TARGET caffe2::cudnn-private PROPERTY INTERFACE_LINK_LIBRARIES
${CUDNN_LIBRARY_PATH})
if(USE_WHOLE_CUDNN)
set_property(
TARGET caffe2::cudnn-private PROPERTY INTERFACE_LINK_LIBRARIES
"-Wl,--whole-archive,\"${CUDNN_LIBRARY_PATH}\" -Wl,--no-whole-archive")
else()
set_property(
TARGET caffe2::cudnn-private PROPERTY INTERFACE_LINK_LIBRARIES
${CUDNN_LIBRARY_PATH})
endif()
set_property(
TARGET caffe2::cudnn-private APPEND PROPERTY INTERFACE_LINK_LIBRARIES
"${CUDA_TOOLKIT_ROOT_DIR}/lib64/libculibos.a" dl)
Expand Down

0 comments on commit 6dc44ca

Please sign in to comment.