-
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.
* pytorch/kineto@7a2a167 * patch for linux build
- Loading branch information
Showing
4 changed files
with
131 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,37 @@ | ||
diff --git a/libkineto/CMakeLists.txt b/libkineto/CMakeLists.txt | ||
index 140ee68..bc4d540 100644 | ||
--- a/libkineto/CMakeLists.txt | ||
+++ b/libkineto/CMakeLists.txt | ||
@@ -52,6 +52,13 @@ 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) | ||
+endif() | ||
if (KINETO_BUILD_TESTS) | ||
enable_testing() | ||
if (NOT CUDA_SOURCE_DIR) | ||
@@ -193,7 +200,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 +219,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) |
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,31 @@ | ||
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; | ||
diff --git a/libkineto/src/Logger.h b/libkineto/src/Logger.h | ||
index 3b9caaf..5b33b87 100644 | ||
--- a/libkineto/src/Logger.h | ||
+++ b/libkineto/src/Logger.h | ||
@@ -47,6 +47,9 @@ | ||
// unset a predefined ERROR (windows) | ||
#undef ERROR | ||
#endif // _MSC_VER | ||
+#ifdef __linux__ | ||
+using libkineto::ERROR; | ||
+#endif | ||
|
||
namespace KINETO_NAMESPACE { | ||
|
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,44 @@ | ||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY) | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO pytorch/kineto | ||
REF 660b5838acdf9d26c4259621b69fa2920903dfdc | ||
SHA512 652bf0380613e836da68f6edc8df361de68f04b0c80c1a6eed0403e55dafa55d458d10d288f98a87357eda39e293760a2d22a10a5c79c2bd53c47f42d0fb08f6 | ||
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=ON # todo: support CUDA feature | ||
-DLIBKINETO_NOROCTRACER=ON | ||
-DLIBKINETO_NOXPUPTI=ON | ||
) | ||
vcpkg_cmake_install() | ||
vcpkg_cmake_config_fixup(PACKAGE_NAME kinetoLibrary CONFIG_PATH "share/cmake/kineto") | ||
|
||
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,19 @@ | ||
{ | ||
"name": "libkineto", | ||
"version-date": "2024-10-24", | ||
"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": [ | ||
"fmt", | ||
"glog", | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
}, | ||
{ | ||
"name": "vcpkg-cmake-config", | ||
"host": true | ||
} | ||
] | ||
} |