File tree Expand file tree Collapse file tree 11 files changed +25
-26
lines changed
Expand file tree Collapse file tree 11 files changed +25
-26
lines changed Original file line number Diff line number Diff line change 157157[submodule "third_party/mimalloc "]
158158 path = third_party/mimalloc
159159 url = https://github.com/microsoft/mimalloc.git
160+ [submodule "third_party/NVTX "]
161+ path = third_party/NVTX
162+ url = https://github.com/NVIDIA/NVTX.git
Original file line number Diff line number Diff line change @@ -1516,7 +1516,8 @@ if(USE_CUDA)
15161516 target_link_libraries (torch_cpu PRIVATE torch::cudart)
15171517 endif ()
15181518 target_link_libraries (torch_cuda INTERFACE torch::cudart)
1519- target_link_libraries (torch_cuda PUBLIC c10_cuda torch::nvtoolsext)
1519+ target_link_libraries (torch_cuda PUBLIC c10_cuda)
1520+ target_link_libraries (torch_cuda PRIVATE torch::nvtoolsext)
15201521
15211522 target_include_directories (
15221523 torch_cuda INTERFACE $<INSTALL_INTERFACE:include >)
@@ -1571,7 +1572,7 @@ if(BUILD_SHARED_LIBS)
15711572 # not find them, because they're usually in non-standard locations)
15721573 if (USE_CUDA)
15731574 target_link_libraries (torch_global_deps ${Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS} )
1574- target_link_libraries (torch_global_deps torch::cudart torch::nvtoolsext )
1575+ target_link_libraries (torch_global_deps torch::cudart)
15751576 endif ()
15761577 if (USE_TBB)
15771578 target_link_libraries (torch_global_deps TBB::tbb)
Original file line number Diff line number Diff line change @@ -129,30 +129,18 @@ endif()
129129
130130if (@USE_CUDA@)
131131 if (MSVC )
132- if (NOT NVTOOLEXT_HOME)
133- set (NVTOOLEXT_HOME "C:/Program Files/NVIDIA Corporation/NvToolsExt" )
134- endif ()
135- if (DEFINED ENV{NVTOOLSEXT_PATH})
136- set (NVTOOLEXT_HOME $ENV{NVTOOLSEXT_PATH} )
137- endif ()
138- set (TORCH_CUDA_LIBRARIES
139- ${NVTOOLEXT_HOME} /lib/x64/nvToolsExt64_1.lib
140- ${CUDA_LIBRARIES} )
141- list (APPEND TORCH_INCLUDE_DIRS ${NVTOOLEXT_HOME} /include )
132+ set (TORCH_CUDA_LIBRARIES ${CUDA_LIBRARIES} )
142133 find_library (CAFFE2_NVRTC_LIBRARY caffe2_nvrtc PATHS "${TORCH_INSTALL_PREFIX} /lib" )
143134 list (APPEND TORCH_CUDA_LIBRARIES ${CAFFE2_NVRTC_LIBRARY} )
144135 elseif (APPLE )
145136 set (TORCH_CUDA_LIBRARIES
146137 ${CUDA_TOOLKIT_ROOT_DIR} /lib/libcudart.dylib
147138 ${CUDA_TOOLKIT_ROOT_DIR} /lib/libnvrtc.dylib
148- ${CUDA_TOOLKIT_ROOT_DIR} /lib/libnvToolsExt.dylib
149139 ${CUDA_LIBRARIES} )
150140 else ()
151- find_library (LIBNVTOOLSEXT libnvToolsExt.so PATHS ${CUDA_TOOLKIT_ROOT_DIR} /lib64/)
152141 set (TORCH_CUDA_LIBRARIES
153142 ${CUDA_CUDA_LIB}
154143 ${CUDA_NVRTC_LIB}
155- ${LIBNVTOOLSEXT}
156144 ${CUDA_LIBRARIES} )
157145 endif ()
158146 if (@BUILD_SHARED_LIBS @)
Original file line number Diff line number Diff line change @@ -67,10 +67,6 @@ if(NOT CMAKE_CUDA_COMPILER_VERSION STREQUAL CUDAToolkit_VERSION OR
6767 "V${CUDAToolkit_VERSION} in '${CUDAToolkit_INCLUDE_DIR} '" )
6868endif ()
6969
70- if (NOT TARGET CUDA::nvToolsExt)
71- message (FATAL_ERROR "Failed to find nvToolsExt" )
72- endif ()
73-
7470message (STATUS "Caffe2: CUDA detected: " ${CUDA_VERSION} )
7571message (STATUS "Caffe2: CUDA nvcc is: " ${CUDA_NVCC_EXECUTABLE} )
7672message (STATUS "Caffe2: CUDA toolkit directory: " ${CUDA_TOOLKIT_ROOT_DIR} )
@@ -216,9 +212,10 @@ endif()
216212
217213# nvToolsExt
218214add_library (torch::nvtoolsext INTERFACE IMPORTED )
219- set_property (
220- TARGET torch::nvtoolsext PROPERTY INTERFACE_LINK_LIBRARIES
221- CUDA::nvToolsExt)
215+ find_path (nvtx3_dir NAMES nvtx3 PATHS "${CUDA_INCLUDE_DIRS} " "${CMAKE_CURRENT_LIST_DIR} /../../third_party/NVTX/c/include" NO_DEFAULT_PATH)
216+ find_package_handle_standard_args(nvtx3 DEFAULT_MSG nvtx3_dir)
217+ target_include_directories (torch::nvtoolsext INTERFACE "${nvtx3_dir} " )
218+
222219
223220# cublas
224221add_library (caffe2::cublas INTERFACE IMPORTED )
Original file line number Diff line number Diff line change 186186# NVFUSER_SOURCE_DIR
187187# specify nvfuser root directory
188188#
189- # NVTOOLSEXT_PATH (Windows only)
190- # specify where nvtoolsext is installed
191- #
192189# ACL_ROOT_DIR
193190# specify where Compute Library is installed
194191#
Original file line number Diff line number Diff line change 22
33#include < utils.h>
44
5+ #ifndef FBCODE_CAFFE2
6+ #include < nvtx3/nvToolsExt.h>
7+ #else
58#include < nvToolsExt.h>
9+ #endif
610
711// NOLINTNEXTLINE(modernize-deprecated-headers)
812#include < stdio.h>
Original file line number Diff line number Diff line change @@ -136,7 +136,6 @@ if(USE_CUDA)
136136 list (APPEND TORCH_PYTHON_LINK_LIBRARIES torch::cudnn)
137137 list (APPEND TORCH_PYTHON_COMPILE_DEFINITIONS USE_CUDNN)
138138 endif ()
139-
140139 list (APPEND TORCH_PYTHON_LINK_LIBRARIES torch::nvtoolsext)
141140endif ()
142141
Original file line number Diff line number Diff line change 11#ifdef _WIN32
22#include < wchar.h> // _wgetenv for nvtx
33#endif
4+ #ifndef FBCODE_CAFFE2
5+ #include < nvtx3/nvToolsExt.h>
6+ #else
47#include < nvToolsExt.h>
8+ #endif
59#include < torch/csrc/utils/pybind.h>
610
711namespace torch ::cuda::shared {
Original file line number Diff line number Diff line change 11#include < sstream>
22
3+ #ifndef FBCODE_CAFFE2
4+ #include < nvtx3/nvToolsExt.h>
5+ #else
36#include < nvToolsExt.h>
7+ #endif
48
59#include < c10/cuda/CUDAGuard.h>
610#include < c10/util/irange.h>
You can’t perform that action at this time.
0 commit comments