lfranke / TRIPS

https://lfranke.github.io/trips/
MIT License
518 stars 31 forks source link

Does not build with compute_89 #8

Open MrNeRF opened 9 months ago

MrNeRF commented 9 months ago

Hey Linus, thank you for this great work. I try to run TRIPS on my own scene but it took me a while to get it build. The setup as described does not work with more recent NVIDIA cards. The autodetection of the compute capability causes the build to fail. It pops up first in tiny-cuda-nn but then also in libtorch and saiga.

Globally setting it did not work either. Finally I had to hack every CMakeLists.txt. I would contribute it back but it is very dirty and also affects External repos.

I think I let it here for reference. But everybody with a 4090 or so will run into the same issue. Best Janusch

lfranke commented 9 months ago

Hi Janusch, thanks so much :)

That's odd. I tested the code on a 4090 and the compute architecture autodetect worked for me (but I only tested on Linux). I will look into this soon! In the meantime, does it work if you set the compute architecture for all three modules (saiga, tiny-cuda-nn and libtorch) manually for cmake? -DSAIGA_CUDA_ARCH=8.9 -DTCNN_CUDA_ARCHITECTURES=8.9 -DTORCH_CUDA_ARCH_LIST=8.9

MrNeRF commented 9 months ago

I am on Ubuntu 22.04 and tried to precisely follow the build instruction in the Readme.

nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:33:58_PDT_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0

If I use the cmake flags -DSAIGA_CUDA_ARCH=8.9 -DTCNN_CUDA_ARCHITECTURES=8.9 -DTORCH_CUDA_ARCH_LIST=8.9 it also does not build. So setting -DTCNN_CUDA_ARCHITECTURES seems to fix tiny-cuda-nn (I set it directly in the respective CMakeLists.txt) but the errors go like this:

nvcc fatal : Unsupported gpu architecture 'compute_89' nvcc fatal : Unsupported gpu architecture 'compute_89' nvcc fatal : Unsupported gpu architecture 'compute_89' make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:107: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/ORBExtractorGPU.cu.o] Error 1 make[2]: Waiting for unfinished jobs.... make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:77: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/cusparseHelper.cu.o] Error 1 make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:92: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/Fast.cu.o] Error 1 [ 70%] Building CUDA object External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/scale.cu.o [ 70%] Building CXX object External/saiga/src/saiga/opengl/CMakeFiles/saiga_opengl.dir/animation/boneShader.cpp.o nvcc fatal : Unsupported gpu architecture 'compute_89' nvcc fatal : Unsupported gpu architecture 'compute_89' make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:182: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/convolution_row.cu.o] Error 1 nvcc fatal : Unsupported gpu architecture 'compute_89' nvcc fatal : Unsupported gpu architecture 'compute_89' [ 71%] Building CXX object External/saiga/src/saiga/opengl/CMakeFiles/saiga_opengl.dir/assets/AssetRenderSystem.cpp.o [ 71%] Building CXX object External/saiga/src/saiga/opengl/CMakeFiles/saiga_opengl.dir/assets/animatedAsset.cpp.o [ 71%] Building CUDA object External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/scale_down.cu.o nvcc fatal : Unsupported gpu architecture 'compute_89' make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:137: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/conversion.cu.o] Error 1 [ 71%] Building CUDA object External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/stream.cu.o [ 71%] Building CUDA object External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/random.cu.o nvcc fatal : Unsupported gpu architecture 'compute_89' [ 71%] Building CXX object External/saiga/src/saiga/opengl/CMakeFiles/saiga_opengl.dir/animation/boneVertex.cpp.o nvcc fatal : Unsupported gpu architecture 'compute_89' [ 71%] Building CXX object External/saiga/src/saiga/opengl/CMakeFiles/saiga_opengl.dir/assets/asset.cpp.o nvcc fatal : Unsupported gpu architecture 'compute_89' [ 71%] Building CXX object External/saiga/src/saiga/opengl/CMakeFiles/saiga_opengl.dir/assets/coloredAsset.cpp.o [ 71%] Building CXX object External/saiga/src/saiga/opengl/CMakeFiles/saiga_opengl.dir/assets/animatedAssetObject.cpp.o nvcc fatal : Unsupported gpu architecture 'compute_89' make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:122: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/OrbDescriptors.cu.o] Error 1 make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:152: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/convolution.cu.o] Error 1 make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:212: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/filter.cu.o] Error 1 make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:167: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/convolution_col.cu.o] Error 1 make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:227: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/image.cu.o] Error 1 make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:197: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/difference.cu.o] Error 1 make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:242: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/scale.cu.o] Error 1 [ 71%] Building CXX object External/saiga/src/saiga/opengl/CMakeFiles/saiga_opengl.dir/assets/simpleAssetObject.cpp.o [ 72%] Building CXX object External/saiga/src/saiga/opengl/CMakeFiles/saiga_opengl.dir/egl/offscreen_window.cpp.o nvcc fatal : Unsupported gpu architecture 'compute_89' make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:257: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/imageProcessing/scale_down.cu.o] Error 1 nvcc fatal : Unsupported gpu architecture 'compute_89' make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:272: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/random.cu.o] Error 1 [ 72%] Building CXX object External/saiga/src/saiga/opengl/CMakeFiles/saiga_opengl.dir/assimp/assimpAssetLoader.cpp.o nvcc fatal : Unsupported gpu architecture 'compute_89' make[2]: [External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/build.make:287: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/stream.cu.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:2571: External/saiga/src/saiga/cuda/CMakeFiles/saiga_cuda.dir/all] Error 2

So, somehow it does not like the 89 architecture. But setting it that way:

cmake -DCMAKE_PREFIX_PATH="./External/libtorch/;${CONDA}" -DSAIGA_CUDA_ARCH=8.6 -DTCNN_CUDA_ARCHITECTURES=8.6 -DTORCH_CUDA_ARCH_LIST=8.6 ..

it builds also successfully as is without my other hacks. This might be maybe a very easy workaround for anybody who also runs into the same issue.

dm-de commented 9 months ago

I had similar issue on Windows. The main problem was, that my gfx card has only Cuda Compute Capability 3.0. And some lib (saiga or torch) failed to build, because nvidia compiler detected my gfx-card with CC 3.0 and set the level to 3.0. But this build is for another computer with higher CC level 7.5 It seems that TRIPS do not compile for lower than 7.5 - so this is the minimum level.

I simple did this search & replace for all files inside build from: -gencode arch=compute_30,code=sm_30 to: -gencode arch=compute_75,code=sm_75

works!