tiny-cuda-nn icon indicating copy to clipboard operation
tiny-cuda-nn copied to clipboard

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

Open dokluch opened this issue 2 years ago • 14 comments

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

dokluch avatar Oct 07 '22 13:10 dokluch

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.

Dy111111 avatar Oct 17 '22 12:10 Dy111111

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 ?

tares003 avatar Apr 30 '23 23:04 tares003

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.

wcneill avatar May 26 '23 22:05 wcneill

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

HenkPoley avatar Jul 31 '23 08:07 HenkPoley

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 ?

shasha1832 avatar Sep 05 '23 08:09 shasha1832

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.

HenkPoley avatar Sep 05 '23 09:09 HenkPoley

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 avatar Sep 05 '23 10:09 shasha1832

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

shasha1832 avatar Sep 05 '23 11:09 shasha1832

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.

shawn-peng avatar Sep 14 '23 21:09 shawn-peng

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

jekeam avatar Jan 18 '24 21:01 jekeam

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.

HankTheCrank avatar Feb 01 '24 18:02 HankTheCrank

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!

bo1230 avatar Apr 01 '24 10:04 bo1230

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

Raghav-B avatar Apr 10 '24 09:04 Raghav-B