instant-ngp icon indicating copy to clipboard operation
instant-ngp copied to clipboard

how do I set the Cuda architecture to 86

Open Rotoslider opened this issue 2 years ago • 12 comments

I managed to get this working on another computer last month but can not remember how to get it to select the proper type of GPU. "Failed to detect a default CUDA architecture." The instructions say " set the TCNN_CUDA_ARCHITECTURES environment variable for the GPU you would like to use." I have windows 10. I set an environment variable name: TCNN_CUDA_ARCHITECTURES and value: 86 Rebooted and still get the error. I tried to set it in the CMakeLists.txt file. This caused a different error. Where do I set the value for the 3060ti card I have in the computer. Cmake version 3.23.2 Cuda 11.7 MSVC 19.29.30145.0 Using the Developer Command prompt for VS 2019 and running: cmake . -B build I get the following error: -- Building for: Ninja -- The C compiler identification is MSVC 19.29.30145.0 -- The CXX compiler identification is MSVC 19.29.30145.0 -- The CUDA compiler identification is unknown CMake Error at C:/msys64/mingw64/share/cmake/Modules/CMakeDetermineCUDACompiler.cmake:633 (message): Failed to detect a default CUDA architecture. Compiler output: Call Stack (most recent call first): CMakeLists.txt:11 (PROJECT) -- Configuring incomplete, errors occurred!

I know this has been asked a hundred times but after reading all of the incomplete answers I still have no idea.

Rotoslider avatar Jun 24 '22 01:06 Rotoslider

did you delete old build folder after setting variable? then build again.

also i had to downgrade cmake to 3.22.5 to get rid of some similar errors.. (although still havent managed to fully compile, due to other errors later)

unitycoder avatar Jul 02 '22 10:07 unitycoder

Yes I delete the build folder between builds. If I place the following into the CMakeLists.txt file: find_package(CUDAToolkit REQUIRED) if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) set(CMAKE_CUDA_ARCHITECTURES 86) endif() The CMAKE_CUDA_ARCHITECTURES: 86 do not all work with this compiler. If I type nvcc --version I get nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Tue_May__3_19:00:59_Pacific_Daylight_Time_2022 Cuda compilation tools, release 11.7, V11.7.64 Build cuda_11.7.r11.7/compiler.31294372_0

Seems it does not like the new nvidia compiler or the cmake compiler. I need to look into down grading cmake then I guess.

The old computer that instant-ngp built on had cmake version 3.23.2 which is the same version as the computer I cannot get to buid. The Cuda compiler that built correctly before was 11.6.124. Where now it is and 11.7.64. Seems it does not like the new toolkit. I went back to Cuda 11.6.124 and I still cannot get it to build. Compiler error as above. The C Compiler ,CMake and Cuda Compilers are the same versions as the computer before that was able to be built. Any suggestions?

Rotoslider avatar Jul 02 '22 13:07 Rotoslider

Hi! Same problem here. Have you managed to solve this error? I solved it with this: cmake . -D TCNN_CUDA_ARCHITECTURES=86 -B build

Rolliboy avatar Jul 05 '22 16:07 Rolliboy

sadly I still get the same error even with cmake . -D TCNN_CUDA_ARCHITECTURES=86 -B build Not sure whats going on. I deleted the build folder before trying it. results: `c:\Users\me\Documents\instant-ngp>cmake . -D TCNN_CUDA_ARCHITECTURES=86 -B build -- Building for: Ninja -- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/include (found version "11.6.124") -- The C compiler identification is MSVC 19.29.30145.0 -- The CXX compiler identification is MSVC 19.29.30145.0 -- The CUDA compiler identification is unknown CMake Error at C:/msys64/mingw64/share/cmake/Modules/CMakeDetermineCUDACompiler.cmake:654 (message): The CMAKE_CUDA_ARCHITECTURES:

86

do not all work with this compiler.`

Rotoslider avatar Jul 07 '22 00:07 Rotoslider

i added these into top of CMakeLists.txt (note custom folder for toolkit, use our own or remove that line)

set(TCNN_CUDA_ARCHITECTURES "86")
set(CUDA_ARCHITECTURES "86")
set(CMAKE_CUDA_ARCHITECTURES "86")
set(CudaToolkitDir "D:/sdk/CUDA/")

but in the end it brought new errors and then stuck at compiling "error : identifier "cublasComputeType_t" is undefined". (might be also relevant that i have vs, cuda, cmake and other tools in non-default install locations, not in c: drive)

unitycoder avatar Jul 07 '22 07:07 unitycoder

so finally got it to run, here's my notes.. https://gist.github.com/unitycoder/7e59247ad0f36f77bc8402cd9a22d4fb

but i think my solution was to install everything on default locations.. (had to get bigger c: drive, reinstalled windows, visual studio 2019, cuda 11.4, cmake 3.22.5 all in default c: locations)

unitycoder avatar Jul 07 '22 09:07 unitycoder

I encountered a similar issue and solved by setting CUDACXX to the correct executable. which is ...\cuda\bin\nvcc.

jundaf2 avatar Sep 26 '22 11:09 jundaf2

I encountered a similar issue and solved by setting CUDACXX to the correct executable. which is ...\cuda\bin\nvcc.

Hi! I am new to cmake, don't have much knowledge about it. How do I set set the executable like you said??

alandevkota avatar Dec 15 '22 11:12 alandevkota

set ~/.bashrc

export CUDACXX=/usr/local/cuda/bin/nvcc

shoeychi avatar Feb 14 '23 04:02 shoeychi

Hi, @shoeychi gives the solution, sorry for not replying, I missed the message.

jundaf2 avatar Feb 14 '23 04:02 jundaf2

Thanks!!

alandevkota avatar Feb 22 '23 07:02 alandevkota

Ensure that the CUDA bins are in your path. For me, they were installed to /usr/local/cuda-12/bin/ which was not in my path, so CMake couldn't find it while building llama.cpp.

Simply add a line like the following to your .zshrc or .bashrc, or add /usr/local/cuda-12/bin: to the end before $PATH if you already have a line like this.

export PATH=/usr/local/cuda-12/bin:$PATH

baughmann avatar Mar 21 '24 01:03 baughmann