File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 4
4
# This source code is licensed under the BSD-style license found in the
5
5
# LICENSE file in the root directory of this source tree.
6
6
7
- cmake_minimum_required (VERSION 3.22 FATAL_ERROR)
7
+ cmake_minimum_required (VERSION 3.24 FATAL_ERROR)
8
8
project (kineto VERSION 0.1 LANGUAGES CXX C)
9
9
10
10
#install libraries into correct locations on all platforms
@@ -79,8 +79,32 @@ if(NOT LIBKINETO_NOCUPTI)
79
79
if (NOT TARGET CUDA::cupti)
80
80
add_library (CUDA::cupti INTERFACE IMPORTED )
81
81
target_link_libraries (CUDA::cupti INTERFACE "${CUDA_cupti_LIBRARY} " )
82
+ else ()
83
+ set (CUDA_cupti_LIBRARY "$<TARGET_FILE:CUDA::cupti>" )
82
84
endif ()
83
85
target_include_directories (CUDA::cupti INTERFACE "${CUPTI_INCLUDE_DIR} " )
86
+
87
+ if ("${CUDA_cupti_LIBRARY} " MATCHES "[.]a" )
88
+ include (CheckCXXSourceRuns)
89
+ set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "dl" "pthread" $<LINK_LIBRARY:WHOLE_ARCHIVE,"${CUDA_cupti_LIBRARY} " >)
90
+
91
+ check_cxx_source_runs("#include <stdexcept>
92
+ int main() {
93
+ try {
94
+ throw std::runtime_error(\" error\" );
95
+ } catch (...) {
96
+ return 0;
97
+ }
98
+ return 1;
99
+ }" EXCEPTIONS_WORK)
100
+ set (CMAKE_REQUIRED_LINK_OPTIONS "" )
101
+ if (NOT EXCEPTIONS_WORK)
102
+ message (FATAL_ERROR
103
+ "Detected that statically linking against CUPTI causes exceptions to stop working. "
104
+ "See https://github.com/pytorch/pytorch/issues/57744 for more details. " )
105
+ endif ()
106
+ endif ()
107
+
84
108
else ()
85
109
set (LIBKINETO_NOCUPTI ON CACHE BOOL "" FORCE)
86
110
message (STATUS "Could not find CUPTI library" )
You can’t perform that action at this time.
0 commit comments