mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 00:20:18 +01:00
Revert "Upgrade NVTX to NVTX3 (#90689)"
This reverts commit e64ddd1ab9.
Reverted https://github.com/pytorch/pytorch/pull/90689 on behalf of https://github.com/osalpekar due to Build Failures due to not being able to find one nvtx3 header in FRL jobs: [D42332540](https://www.internalfb.com/diff/D42332540)
This commit is contained in:
parent
a96ccaa362
commit
5170995b2a
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -154,6 +154,3 @@
|
||||||
[submodule "third_party/cutlass"]
|
[submodule "third_party/cutlass"]
|
||||||
path = third_party/cutlass
|
path = third_party/cutlass
|
||||||
url = https://github.com/NVIDIA/cutlass.git
|
url = https://github.com/NVIDIA/cutlass.git
|
||||||
[submodule "third_party/NVTX"]
|
|
||||||
path = third_party/NVTX
|
|
||||||
url = https://github.com/NVIDIA/NVTX.git
|
|
||||||
|
|
|
||||||
|
|
@ -1475,8 +1475,7 @@ if(USE_CUDA)
|
||||||
target_link_libraries(torch_cpu PRIVATE torch::cudart)
|
target_link_libraries(torch_cpu PRIVATE torch::cudart)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(torch_cuda INTERFACE torch::cudart)
|
target_link_libraries(torch_cuda INTERFACE torch::cudart)
|
||||||
target_link_libraries(torch_cuda PUBLIC c10_cuda)
|
target_link_libraries(torch_cuda PUBLIC c10_cuda torch::nvtoolsext)
|
||||||
target_link_libraries(torch_cuda PRIVATE torch::nvtoolsext)
|
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
torch_cuda INTERFACE $<INSTALL_INTERFACE:include>)
|
torch_cuda INTERFACE $<INSTALL_INTERFACE:include>)
|
||||||
|
|
@ -1531,7 +1530,7 @@ if(BUILD_SHARED_LIBS)
|
||||||
# not find them, because they're usually in non-standard locations)
|
# not find them, because they're usually in non-standard locations)
|
||||||
if(USE_CUDA)
|
if(USE_CUDA)
|
||||||
target_link_libraries(torch_global_deps ${Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS})
|
target_link_libraries(torch_global_deps ${Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS})
|
||||||
target_link_libraries(torch_global_deps torch::cudart)
|
target_link_libraries(torch_global_deps torch::cudart torch::nvtoolsext)
|
||||||
endif()
|
endif()
|
||||||
if(USE_TBB)
|
if(USE_TBB)
|
||||||
target_link_libraries(torch_global_deps TBB::tbb)
|
target_link_libraries(torch_global_deps TBB::tbb)
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,13 @@ if sys.platform == "win32":
|
||||||
th_root = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'torch')
|
th_root = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'torch')
|
||||||
th_dll_path = os.path.join(th_root, 'lib')
|
th_dll_path = os.path.join(th_root, 'lib')
|
||||||
|
|
||||||
|
if not os.path.exists(os.path.join(th_dll_path, 'nvToolsExt64_1.dll')) and \
|
||||||
|
not os.path.exists(os.path.join(py_dll_path, 'nvToolsExt64_1.dll')):
|
||||||
|
nvtoolsext_dll_path = os.path.join(
|
||||||
|
os.getenv('NVTOOLSEXT_PATH', 'C:\\Program Files\\NVIDIA Corporation\\NvToolsExt'), 'bin', 'x64')
|
||||||
|
else:
|
||||||
|
nvtoolsext_dll_path = ''
|
||||||
|
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import glob
|
import glob
|
||||||
spec = importlib.util.spec_from_file_location('torch_version', os.path.join(th_root, 'version.py'))
|
spec = importlib.util.spec_from_file_location('torch_version', os.path.join(th_root, 'version.py'))
|
||||||
|
|
@ -43,7 +50,7 @@ if sys.platform == "win32":
|
||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
kernel32 = ctypes.WinDLL('kernel32.dll', use_last_error=True)
|
kernel32 = ctypes.WinDLL('kernel32.dll', use_last_error=True)
|
||||||
dll_paths = list(filter(os.path.exists, [th_dll_path, py_dll_path, cuda_path]))
|
dll_paths = list(filter(os.path.exists, [th_dll_path, py_dll_path, nvtoolsext_dll_path, cuda_path]))
|
||||||
with_load_library_flags = hasattr(kernel32, 'AddDllDirectory')
|
with_load_library_flags = hasattr(kernel32, 'AddDllDirectory')
|
||||||
prev_error_mode = kernel32.SetErrorMode(0x0001)
|
prev_error_mode = kernel32.SetErrorMode(0x0001)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,18 +129,30 @@ endif()
|
||||||
|
|
||||||
if(@USE_CUDA@)
|
if(@USE_CUDA@)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(TORCH_CUDA_LIBRARIES ${CUDA_LIBRARIES})
|
if(NOT NVTOOLEXT_HOME)
|
||||||
|
set(NVTOOLEXT_HOME "C:/Program Files/NVIDIA Corporation/NvToolsExt")
|
||||||
|
endif()
|
||||||
|
if(DEFINED ENV{NVTOOLSEXT_PATH})
|
||||||
|
set(NVTOOLEXT_HOME $ENV{NVTOOLSEXT_PATH})
|
||||||
|
endif()
|
||||||
|
set(TORCH_CUDA_LIBRARIES
|
||||||
|
${NVTOOLEXT_HOME}/lib/x64/nvToolsExt64_1.lib
|
||||||
|
${CUDA_LIBRARIES})
|
||||||
|
list(APPEND TORCH_INCLUDE_DIRS ${NVTOOLEXT_HOME}/include)
|
||||||
find_library(CAFFE2_NVRTC_LIBRARY caffe2_nvrtc PATHS "${TORCH_INSTALL_PREFIX}/lib")
|
find_library(CAFFE2_NVRTC_LIBRARY caffe2_nvrtc PATHS "${TORCH_INSTALL_PREFIX}/lib")
|
||||||
list(APPEND TORCH_CUDA_LIBRARIES ${CAFFE2_NVRTC_LIBRARY})
|
list(APPEND TORCH_CUDA_LIBRARIES ${CAFFE2_NVRTC_LIBRARY})
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
set(TORCH_CUDA_LIBRARIES
|
set(TORCH_CUDA_LIBRARIES
|
||||||
${CUDA_TOOLKIT_ROOT_DIR}/lib/libcudart.dylib
|
${CUDA_TOOLKIT_ROOT_DIR}/lib/libcudart.dylib
|
||||||
${CUDA_TOOLKIT_ROOT_DIR}/lib/libnvrtc.dylib
|
${CUDA_TOOLKIT_ROOT_DIR}/lib/libnvrtc.dylib
|
||||||
|
${CUDA_TOOLKIT_ROOT_DIR}/lib/libnvToolsExt.dylib
|
||||||
${CUDA_LIBRARIES})
|
${CUDA_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
|
find_library(LIBNVTOOLSEXT libnvToolsExt.so PATHS ${CUDA_TOOLKIT_ROOT_DIR}/lib64/)
|
||||||
set(TORCH_CUDA_LIBRARIES
|
set(TORCH_CUDA_LIBRARIES
|
||||||
${CUDA_CUDA_LIB}
|
${CUDA_CUDA_LIB}
|
||||||
${CUDA_NVRTC_LIB}
|
${CUDA_NVRTC_LIB}
|
||||||
|
${LIBNVTOOLSEXT}
|
||||||
${CUDA_LIBRARIES})
|
${CUDA_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
if(@BUILD_SHARED_LIBS@)
|
if(@BUILD_SHARED_LIBS@)
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,10 @@ if(NOT CMAKE_CUDA_COMPILER_VERSION STREQUAL CUDAToolkit_VERSION OR
|
||||||
"V${CUDAToolkit_VERSION} in '${CUDAToolkit_INCLUDE_DIR}'")
|
"V${CUDAToolkit_VERSION} in '${CUDAToolkit_INCLUDE_DIR}'")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET CUDA::nvToolsExt)
|
||||||
|
message(FATAL_ERROR "Failed to find nvToolsExt")
|
||||||
|
endif()
|
||||||
|
|
||||||
message(STATUS "Caffe2: CUDA detected: " ${CUDA_VERSION})
|
message(STATUS "Caffe2: CUDA detected: " ${CUDA_VERSION})
|
||||||
message(STATUS "Caffe2: CUDA nvcc is: " ${CUDA_NVCC_EXECUTABLE})
|
message(STATUS "Caffe2: CUDA nvcc is: " ${CUDA_NVCC_EXECUTABLE})
|
||||||
message(STATUS "Caffe2: CUDA toolkit directory: " ${CUDA_TOOLKIT_ROOT_DIR})
|
message(STATUS "Caffe2: CUDA toolkit directory: " ${CUDA_TOOLKIT_ROOT_DIR})
|
||||||
|
|
@ -210,19 +214,9 @@ endif()
|
||||||
|
|
||||||
# nvToolsExt
|
# nvToolsExt
|
||||||
add_library(torch::nvtoolsext INTERFACE IMPORTED)
|
add_library(torch::nvtoolsext INTERFACE IMPORTED)
|
||||||
find_path(
|
set_property(
|
||||||
nvtx3_dir
|
TARGET torch::nvtoolsext PROPERTY INTERFACE_LINK_LIBRARIES
|
||||||
NAMES nvtx3
|
CUDA::nvToolsExt)
|
||||||
PATHS ${CUDA_INCLUDE_DIRS}
|
|
||||||
NO_DEFAULT_PATH)
|
|
||||||
find_package_handle_standard_args(nvtx3 DEFAULT_MSG nvtx3_dir)
|
|
||||||
if(NOT nvtx3_FOUND)
|
|
||||||
set(nvtx3_dir "${CMAKE_CURRENT_LIST_DIR}/../../third_party/NVTX/c/include")
|
|
||||||
message(WARNING "use NVTX library in ${nvtx3_dir}")
|
|
||||||
include_directories(SYSTEM "${nvtx3_dir}")
|
|
||||||
target_include_directories(torch::nvtoolsext INTERFACE "${nvtx3_dir}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# cublas
|
# cublas
|
||||||
add_library(caffe2::cublas INTERFACE IMPORTED)
|
add_library(caffe2::cublas INTERFACE IMPORTED)
|
||||||
|
|
|
||||||
3
setup.py
3
setup.py
|
|
@ -178,6 +178,9 @@
|
||||||
# NVFUSER_SOURCE_DIR
|
# NVFUSER_SOURCE_DIR
|
||||||
# specify nvfuser root directory
|
# specify nvfuser root directory
|
||||||
#
|
#
|
||||||
|
# NVTOOLSEXT_PATH (Windows only)
|
||||||
|
# specify where nvtoolsext is installed
|
||||||
|
#
|
||||||
# ACL_ROOT_DIR
|
# ACL_ROOT_DIR
|
||||||
# specify where Compute Library is installed
|
# specify where Compute Library is installed
|
||||||
#
|
#
|
||||||
|
|
|
||||||
1
third_party/NVTX
vendored
1
third_party/NVTX
vendored
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit e170594ac7cf1dac584da473d4ca9301087090c1
|
|
||||||
4
third_party/nvfuser/csrc/instrumentation.h
vendored
4
third_party/nvfuser/csrc/instrumentation.h
vendored
|
|
@ -2,11 +2,7 @@
|
||||||
|
|
||||||
#include <utils.h>
|
#include <utils.h>
|
||||||
|
|
||||||
#ifndef FBCODE_CAFFE2
|
|
||||||
#include <nvtx3/nvToolsExt.h>
|
|
||||||
#else
|
|
||||||
#include <nvToolsExt.h>
|
#include <nvToolsExt.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
// NOLINTNEXTLINE(modernize-deprecated-headers)
|
// NOLINTNEXTLINE(modernize-deprecated-headers)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,8 @@ if(USE_CUDA)
|
||||||
list(APPEND TORCH_PYTHON_LINK_LIBRARIES torch::cudnn)
|
list(APPEND TORCH_PYTHON_LINK_LIBRARIES torch::cudnn)
|
||||||
list(APPEND TORCH_PYTHON_COMPILE_DEFINITIONS USE_CUDNN)
|
list(APPEND TORCH_PYTHON_COMPILE_DEFINITIONS USE_CUDNN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
list(APPEND TORCH_PYTHON_LINK_LIBRARIES torch::nvtoolsext)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_ROCM)
|
if(USE_ROCM)
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,12 @@ if sys.platform == 'win32':
|
||||||
|
|
||||||
dll_paths = list(filter(os.path.exists, [th_dll_path, py_dll_path, base_py_dll_path]))
|
dll_paths = list(filter(os.path.exists, [th_dll_path, py_dll_path, base_py_dll_path]))
|
||||||
|
|
||||||
|
if all([not os.path.exists(os.path.join(p, 'nvToolsExt64_1.dll')) for p in dll_paths]):
|
||||||
|
nvtoolsext_dll_path = os.path.join(
|
||||||
|
os.getenv('NVTOOLSEXT_PATH', os.path.join(pfiles_path, 'NVIDIA Corporation', 'NvToolsExt')), 'bin', 'x64')
|
||||||
|
else:
|
||||||
|
nvtoolsext_dll_path = ''
|
||||||
|
|
||||||
from .version import cuda as cuda_version
|
from .version import cuda as cuda_version
|
||||||
import glob
|
import glob
|
||||||
if cuda_version and all([not glob.glob(os.path.join(p, 'cudart64*.dll')) for p in dll_paths]):
|
if cuda_version and all([not glob.glob(os.path.join(p, 'cudart64*.dll')) for p in dll_paths]):
|
||||||
|
|
@ -82,7 +88,7 @@ if sys.platform == 'win32':
|
||||||
else:
|
else:
|
||||||
cuda_path = ''
|
cuda_path = ''
|
||||||
|
|
||||||
dll_paths.extend(filter(os.path.exists, [cuda_path]))
|
dll_paths.extend(filter(os.path.exists, [nvtoolsext_dll_path, cuda_path]))
|
||||||
|
|
||||||
kernel32 = ctypes.WinDLL('kernel32.dll', use_last_error=True)
|
kernel32 = ctypes.WinDLL('kernel32.dll', use_last_error=True)
|
||||||
with_load_library_flags = hasattr(kernel32, 'AddDllDirectory')
|
with_load_library_flags = hasattr(kernel32, 'AddDllDirectory')
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <wchar.h> // _wgetenv for nvtx
|
#include <wchar.h> // _wgetenv for nvtx
|
||||||
#endif
|
#endif
|
||||||
#ifndef FBCODE_CAFFE2
|
|
||||||
#include <nvtx3/nvToolsExt.h>
|
|
||||||
#else
|
|
||||||
#include <nvToolsExt.h>
|
#include <nvToolsExt.h>
|
||||||
#endif
|
|
||||||
#include <torch/csrc/utils/pybind.h>
|
#include <torch/csrc/utils/pybind.h>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#ifndef FBCODE_CAFFE2
|
|
||||||
#include <nvtx3/nvToolsExt.h>
|
|
||||||
#else
|
|
||||||
#include <nvToolsExt.h>
|
#include <nvToolsExt.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <c10/cuda/CUDAGuard.h>
|
#include <c10/cuda/CUDAGuard.h>
|
||||||
#include <c10/util/irange.h>
|
#include <c10/util/irange.h>
|
||||||
|
|
|
||||||
|
|
@ -635,7 +635,7 @@ CUDA_INCLUDE_MAP = collections.OrderedDict(
|
||||||
("cub/device/device_radix_sort.cuh", ("hipcub/hipcub.hpp", CONV_INCLUDE, API_BLAS)),
|
("cub/device/device_radix_sort.cuh", ("hipcub/hipcub.hpp", CONV_INCLUDE, API_BLAS)),
|
||||||
("cub/device/device_reduce.cuh", ("hipcub/hipcub.hpp", CONV_INCLUDE, API_BLAS)),
|
("cub/device/device_reduce.cuh", ("hipcub/hipcub.hpp", CONV_INCLUDE, API_BLAS)),
|
||||||
("cub/device/device_scan.cuh", ("hipcub/hipcub.hpp", CONV_INCLUDE, API_BLAS)),
|
("cub/device/device_scan.cuh", ("hipcub/hipcub.hpp", CONV_INCLUDE, API_BLAS)),
|
||||||
("nvtx3/nvToolsExt.h", ("roctracer/roctx.h", CONV_INCLUDE, API_ROCTX)),
|
("nvToolsExt.h", ("roctracer/roctx.h", CONV_INCLUDE, API_ROCTX)),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user