Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building project using libtorch results in "Failed to find nvToolsExt" #116242

Open
willjallen opened this issue Dec 21, 2023 · 5 comments
Open
Labels
module: cuda Related to torch.cuda, and CUDA support in general triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@willjallen
Copy link

willjallen commented Dec 21, 2023

馃悰 Describe the bug

Environment Variables:
CUDA_PATH = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1
CudaToolkitDir = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1

CMakeLists.txt:

cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(example-app)

find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

add_executable(example-app example-app.cpp)
target_link_libraries(example-app "${TORCH_LIBRARIES}")
set_property(TARGET example-app PROPERTY CXX_STANDARD 17)

# The following code block is suggested to be used on Windows.
# According to https://github.com/pytorch/pytorch/issues/25457,
# the DLLs need to be copied to avoid memory errors.
if (MSVC)
  file(GLOB TORCH_DLLS "${TORCH_INSTALL_PREFIX}/lib/*.dll")
  add_custom_command(TARGET example-app
                     POST_BUILD
                     COMMAND ${CMAKE_COMMAND} -E copy_if_different
                     ${TORCH_DLLS}
                     $<TARGET_FILE_DIR:example-app>)
endif (MSVC)

Execute commands

mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=libtorch/ ..

Get the output:

-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.31.31104.0
-- The CXX compiler identification is MSVC 19.31.31104.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1 (found version "12.1")
-- The CUDA compiler identification is NVIDIA 12.1.66
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/include (found version "12.1.66")
CMake Error at libtorch/share/cmake/Caffe2/public/cuda.cmake:71 (message):
  Failed to find nvToolsExt
Call Stack (most recent call first):
  libtorch/share/cmake/Caffe2/Caffe2Config.cmake:87 (include)
  libtorch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!

Versions

Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 10 Home
GCC version: (GCC) 11.3.0
Clang version: Could not collect
CMake version: version 3.27.0
Libc version: N/A

Python version: 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.19045-SP0
Is CUDA available: N/A
CUDA runtime version: 12.1.66
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1080 Ti
Nvidia driver version: 546.12
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

CPU:
Architecture=9
CurrentClockSpeed=3696
DeviceID=CPU0
Family=198
L2CacheSize=1536
L2CacheSpeed=
Manufacturer=GenuineIntel
MaxClockSpeed=3696
Name=Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
ProcessorType=3
Revision=

Versions of relevant libraries:
[pip3] numpy==1.26.1
[conda] Could not collect

cc @ptrblck

@janeyx99
Copy link
Contributor

Do the answers in https://discuss.pytorch.org/t/failed-to-find-nvtoolsext/179635 help?

Generally, these type of build questions would get faster and more responses through our forum (linked above)!

@janeyx99 janeyx99 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Dec 21, 2023
@willjallen
Copy link
Author

willjallen commented Dec 21, 2023

Unfortunately no. The Nsight NVTX option is missing from the CUDA installer and the nvToolsExt64_1.lib is nowhere to be found. Thanks for the suggestion, i'll try asking on the forums.

Edit: Upon closer inspection I see the 11.8 CUDA installer is specifically required, I was using 12.1. The Nsight NVTX option is present and after installing it the build works as expected.

It seems strange that I need to use two different CUDA installers to satisfy the build requirements, nonetheless this resolves the issue.

@BradXiao
Copy link

Identical problem encountered.
Solved by installing CUDA 11.8 (with Nsight NVTX) and CUDA 12.1 (missing Nsight NVTX option).
Using pytorch 2.1.2 (CUDA 12.1).

@janeyx99
Copy link
Contributor

cc鈥檌ng @ptrblck

@janeyx99 janeyx99 added the module: cuda Related to torch.cuda, and CUDA support in general label Dec 26, 2023
@patrikhuber
Copy link

See my comments here #116926 (comment) - NVTX is still present in CUDA 12, it's just header-only now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: cuda Related to torch.cuda, and CUDA support in general triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

4 participants