NVlabs / tiny-cuda-nn

Lightning fast C++/CUDA neural network framework
Other
3.77k stars 457 forks source link

Can't build on Windows - No CUDA toolset found error #164

Open dokluch opened 2 years ago

dokluch commented 2 years ago

I can't install tiny-cuda-nn neither with pip, nor building it with Cmake. However, Cmake produces at least a readable error:

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The CXX compiler identification is MSVC 19.29.30139.0
CMake Error at C:/Program Files/CMake/share/cmake-3.24/Modules/CMakeDetermineCompilerId.cmake:491 (message):
  No CUDA toolset found.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  C:/Program Files/CMake/share/cmake-3.24/Modules/CMakeDetermineCompilerId.cmake:48 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.24/Modules/CMakeDetermineCUDACompiler.cmake:307 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:25 (project)

-- Configuring incomplete, errors occurred!
See also "C:/Code/tiny-cuda-nn/build/CMakeFiles/CMakeOutput.log".

C:\Code\tiny-cuda-nn>cmake . -B build
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
CMake Error at C:/Program Files/CMake/share/cmake-3.24/Modules/CMakeDetermineCompilerId.cmake:491 (message):
  No CUDA toolset found.
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
  C:/Program Files/CMake/share/cmake-3.24/Modules/CMakeDetermineCompilerId.cmake:48 (__determine_compiler_id_test)
  C:/Program Files/CMake/share/cmake-3.24/Modules/CMakeDetermineCUDACompiler.cmake:307 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:25 (project)

-- Configuring incomplete, errors occurred!
See also "C:/Code/tiny-cuda-nn/build/CMakeFiles/CMakeOutput.log".

I have CUDA 11.8 installed, CUDA_PATH is set properly. Microsoft Visual Studio 2019, Community Edition Nvidia A6000

Dy111111 commented 2 years ago

you just need to copy all the four files from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\extras\visual_studio_integration\MSBuildExtensions, and paste them to C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\BuildCustomizations. These paths should be changed to your own.

tares003 commented 1 year ago

you just need to copy all the four files from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\extras\visual_studio_integration\MSBuildExtensions, and paste them to C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\BuildCustomizations. These paths should be changed to your own.

Man you saved a week trying to fix this issue!!! Finally solved it !!

what the reason behind this ?

wcneill commented 1 year ago

you just need to copy all the four files from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\extras\visual_studio_integration\MSBuildExtensions, and paste them to C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\BuildCustomizations. These paths should be changed to your own.

Edit: If you do not have the VS IDE installed but are only using the build tools, say in conjunction with VS Code, the solution is about the same. The same directory exists inside of Visual Studio Build Tools:

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\BuildCustomizations

I placed those 4 files there and it solved my problem. Thank you.

HenkPoley commented 1 year ago

Very similar paths for MS VS 2022:

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v160\BuildCustomizations
shasha1832 commented 1 year ago

Thanks for the info, I have MS VS 2017 build tools but the path C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC does not exists Could some one help here where i can copy the 4 files to which location ?

HenkPoley commented 1 year ago

The paths are described here: https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#sample-projects

Have you tried looking under:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations

The part between 2017 and Common7 might be different based on how much money you get to spend on MS VC 2017.

shasha1832 commented 1 year ago

Thanks @HenkPoley for the document link. There is a tweak here, we don't have IDE we have only build tools. Also i am able to find all 4 files in the location C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations but looks like its depreciated. Question is does the IDE is mandatory for cmake to find cuda. Source code used of CMakeLists.txt if (WIN32) message("Windows machine found CMAKE_CUDA_COMPILER will be set") set (CMAKE_CUDA_COMPILER "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/bin/nvcc.exe") endif() include(CheckLanguage) check_language(CUDA)

if (CMAKE_CUDA_COMPILER) message("Cuda verified ****") enable_language(CUDA) set(CUDA_MODE ON) message("Enabled Cuda") else() message(STATUS "No CUDA compiler found; disabling CUDA model") endif()

The cmake configuration fails with same error - No CUDA toolset found in enable_language(CUDA). I have already invested one day, but nothing helped. if you can help here will be really helpful.

Machine details - OS Windows 19 Server Cuda v11.8 Visual Studio build tools (IDE not allowed to be installed)

shasha1832 commented 1 year ago

Omg your hints saved my day if we copy that 4 files here C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\BuildCustomizations it works. zippy

shawn-peng commented 1 year ago

Here is my location, if you customized the install location and are not happy with the orphan dir. "G:\VS_BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations" This is for VSCode2022. Just search "BuildCustomizations" inside the build tools installation dir if the path is different for you.

jekeam commented 10 months ago

you just need to copy all the four files from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\extras\visual_studio_integration\MSBuildExtensions, and paste them to C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\BuildCustomizations. These paths should be changed to your own.

Edit: If you do not have the VS IDE installed but are only using the build tools, say in conjunction with VS Code, the solution is about the same. The same directory exists inside of Visual Studio Build Tools:

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\BuildCustomizations

I placed those 4 files there and it solved my problem. Thank you.

My error: No CUDA toolset found

Solution: I copied the four files from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\extras\visual_studio_integration\MSBuildExtensions And pasted into C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations

HankTheCrank commented 9 months ago

In case this helps someone else: I was running from an elevated PowerShell window which does not seem to use my account's environment variables. Once I ran in a normal PowerShell window, it all worked.

bo1230 commented 7 months ago

you just need to copy all the four files from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\extras\visual_studio_integration\MSBuildExtensions, and paste them to C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\BuildCustomizations. These paths should be changed to your own.

I copied four files to the following directory "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations ", which successfully solved the problem. Thanks so much!

Raghav-B commented 7 months ago

I copied four files to the following directory "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations ", which successfully solved the problem. Thanks so much!

Thank you, this is what finally worked for me! I had to take care I'm copying the files to the x86 directory on my PC for some reason. Would be cool if anyone could elaborate why this might be the case.

So in summary, copying the files to C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations or C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations

didn't work for me. What worked was copying them to: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations

abysee commented 1 month ago

Here is my location, if you customized the install location and are not happy with the orphan dir. "G:\VS_BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations" This is for VSCode2022. Just search "BuildCustomizations" inside the build tools installation dir if the path is different for you.

Thanks for your information, the path to "BuildCustomizations" is what really made it worked out for me.