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 44# This source code is licensed under the BSD-style license found in the
55# LICENSE file in the root directory of this source tree.
66
7- cmake_minimum_required (VERSION 3.22 FATAL_ERROR)
7+ cmake_minimum_required (VERSION 3.24 FATAL_ERROR)
88project (kineto VERSION 0.1 LANGUAGES CXX C)
99
1010#install libraries into correct locations on all platforms
@@ -79,8 +79,32 @@ if(NOT LIBKINETO_NOCUPTI)
7979 if (NOT TARGET CUDA::cupti)
8080 add_library (CUDA::cupti INTERFACE IMPORTED )
8181 target_link_libraries (CUDA::cupti INTERFACE "${CUDA_cupti_LIBRARY} " )
82+ else ()
83+ set (CUDA_cupti_LIBRARY "$<TARGET_FILE:CUDA::cupti>" )
8284 endif ()
8385 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+
84108 else ()
85109 set (LIBKINETO_NOCUPTI ON CACHE BOOL "" FORCE)
86110 message (STATUS "Could not find CUPTI library" )
You can’t perform that action at this time.
0 commit comments