-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
diff --git a/libkineto/CMakeLists.txt b/libkineto/CMakeLists.txt | ||
index 140ee68..507e961 100644 | ||
--- a/libkineto/CMakeLists.txt | ||
+++ b/libkineto/CMakeLists.txt | ||
@@ -52,6 +52,14 @@ if (NOT ROCM_SOURCE_DIR) | ||
message(INFO " ROCM_SOURCE_DIR = ${ROCM_SOURCE_DIR}") | ||
endif() | ||
|
||
+if(NOT LIBKINETO_NOCUPTI) | ||
+ find_package(CUDAToolkit REQUIRED) | ||
+ math(EXPR CUDA_VERSION "${CUDAToolkit_VERSION_MAJOR}000 + ${CUDAToolkit_VERSION_MINOR}0" OUTPUT_FORMAT DECIMAL) | ||
+ add_compile_definitions(CUDA_VERSION=${CUDA_VERSION}) | ||
+ get_target_property(CUPTI_INCLUDE_DIR CUDA::cupti INTERFACE_INCLUDE_DIRECTORIES) | ||
+ get_target_property(CUDA_cupti_LIBRARY CUDA::cupti IMPORTED_LOCATION) | ||
+ link_libraries(CUDA::cudart CUDA::cupti) | ||
+endif() | ||
if (KINETO_BUILD_TESTS) | ||
enable_testing() | ||
if (NOT CUDA_SOURCE_DIR) | ||
@@ -193,7 +201,8 @@ endif() | ||
target_compile_options(kineto_base PRIVATE "${KINETO_COMPILE_OPTIONS}") | ||
target_compile_options(kineto_api PRIVATE "${KINETO_COMPILE_OPTIONS}") | ||
|
||
-if(NOT TARGET fmt) | ||
+find_package(fmt CONFIG REQUIRED) | ||
+if(FALSE) | ||
if(NOT FMT_SOURCE_DIR) | ||
set(FMT_SOURCE_DIR "${LIBKINETO_THIRDPARTY_DIR}/fmt" | ||
CACHE STRING "fmt source directory from submodules") | ||
@@ -211,7 +220,7 @@ if(NOT TARGET fmt) | ||
set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE) | ||
endif() | ||
|
||
-set(FMT_INCLUDE_DIR "${FMT_SOURCE_DIR}/include") | ||
+find_path(FMT_INCLUDE_DIR NAMES "fmt/format.h" REQUIRED) | ||
message(STATUS "Kineto: FMT_SOURCE_DIR = ${FMT_SOURCE_DIR}") | ||
message(STATUS "Kineto: FMT_INCLUDE_DIR = ${FMT_INCLUDE_DIR}") | ||
if (NOT CUPTI_INCLUDE_DIR) | ||
@@ -308,7 +317,7 @@ install(FILES ${LIBKINETO_PUBLIC_HEADERS} | ||
install(EXPORT kinetoLibraryConfig DESTINATION share/cmake/kineto | ||
FILE kinetoLibraryConfig.cmake) | ||
|
||
-if(KINETO_BUILD_TESTS) | ||
+if(FALSE) | ||
add_subdirectory(test) | ||
add_subdirectory("${LIBKINETO_THIRDPARTY_DIR}/googletest") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/libkineto/src/CuptiCallbackApi.cpp b/libkineto/src/CuptiCallbackApi.cpp | ||
index 9c8e0f4..e7e6226 100644 | ||
--- a/libkineto/src/CuptiCallbackApi.cpp | ||
+++ b/libkineto/src/CuptiCallbackApi.cpp | ||
@@ -100,10 +100,12 @@ void CuptiCallbackApi::__callback_switchboard( | ||
if (cbInfo->callbackSite == CUPTI_API_EXIT) { | ||
LOG(INFO) << " Calling cuptiFinalize in exit callsite"; | ||
// Teardown CUPTI calling cuptiFinalize() | ||
+#ifdef HAS_CUPTI | ||
CUPTI_CALL(cuptiUnsubscribe(subscriber_)); | ||
CUPTI_CALL(cuptiFinalize()); | ||
initSuccess_ = false; | ||
subscriber_ = nullptr; | ||
+#endif | ||
CuptiActivityApi::singleton().teardownCupti_ = 0; | ||
CuptiActivityApi::singleton().finalizeCond_.notify_all(); | ||
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY) | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO pytorch/kineto | ||
REF 7a2a167b7233e3a0294c2ebb94c458cccfed7f42 | ||
SHA512 297b19d518ae6eaaf4d2a869e47ed912fd8e0fac024fdde166d6e1b7b75728d8f3573faab6144252bb0a21de238b73b9119735ba26dc7d87c5b8adb9f2bc0e71 | ||
HEAD_REF main | ||
PATCHES | ||
fix-cmake.patch | ||
fix-sources.patch | ||
) | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH DYNOLOG_SOURCE_PATH | ||
REPO facebookincubator/dynolog | ||
REF b428ad3aaa86c7d8bdbb71e3e9dd2b8a4d4eab3f | ||
SHA512 d8a16e04655dcde9a654b8125e458000455ecf04f6eb4fb93b7773b166351a409a26358f0fa6c3845aab8bda922e8e9098d91cbb4b4c3b3879f5654b79e1414f | ||
HEAD_REF main | ||
) | ||
file(REMOVE_RECURSE "${SOURCE_PATH}/libkineto/third_party/dynolog") | ||
file(RENAME "${DYNOLOG_SOURCE_PATH}" "${SOURCE_PATH}/libkineto/third_party/dynolog") | ||
|
||
vcpkg_find_acquire_program(PYTHON3) | ||
message(STATUS "Using Python3: ${PYTHON3}") | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}/libkineto" | ||
OPTIONS | ||
-DPYTHON_EXECUTABLE:FILEPATH=${PYTHON3} | ||
-DKINETO_BUILD_TESTS=OFF | ||
-DLIBKINETO_NOCUPTI=OFF # use CUDA::cupti | ||
) | ||
vcpkg_cmake_install() | ||
|
||
file(REMOVE_RECURSE | ||
"${CURRENT_PACKAGES_DIR}/debug/include" | ||
"${CURRENT_PACKAGES_DIR}/debug/share" | ||
) | ||
|
||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "libkineto", | ||
"version-date": "2024-10-16", | ||
"description": "A CPU+GPU Profiling library that provides access to timeline traces and hardware performance counters", | ||
"homepage": "https://github.com/pytorch/kineto", | ||
"license": "BSD-3-Clause", | ||
"dependencies": [ | ||
"cuda", | ||
{ | ||
"name": "dynolog", | ||
"platform": "linux" | ||
}, | ||
"fmt", | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
}, | ||
{ | ||
"name": "vcpkg-cmake-config", | ||
"host": true | ||
} | ||
] | ||
} |