pierotofy / OpenSplat

Production-grade 3D gaussian splatting with CPU/GPU support for Windows, Mac and Linux 🚀
https://antimatter15.com/splat/?url=https://splat.uav4geo.com/banana.splat
GNU Affero General Public License v3.0
933 stars 87 forks source link

Windows Installation CUDA Errors #117

Closed l-fungus-l closed 4 months ago

l-fungus-l commented 4 months ago

I am trying to install OpenSplat on Windows, it recognizes the correct location for the CUDA nvcc but finds that is broken when trying to enable_language. I have reinstalled CUDA and validated it. It is the version provided on the home page. Where could the issue be stemming from?

C:\opensplat\OpenSplat\build>cmake -DCMAKE_PREFIX_PATH=C:\opensplat\libtorch -DOPENCV_DIR=C:\Users\20221123\OpenCV\opencv\build -DCMAKE_BUILD_TYPE=Release ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.40.33812.0
-- The CXX compiler identification is MSVC 19.40.33812.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/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/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
OpenSplat Version: 1.1.3 (git commit 7c9a9cc)
-- Using the multi-header code from C:/opensplat/OpenSplat/build/_deps/nlohmann_json-src/include/
-- nanoflann version: 1.5.5
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- GLM: Version 1.0.1
-- GLM: Build with C++ features auto detection
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/include (found version "11.8.89")
-- ** Updated TORCH_CUDA_ARCH_LIST to 7.0 7.5 8.0 **
-- The CUDA compiler identification is NVIDIA 11.8.89
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - failed
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/bin/nvcc.exe
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/bin/nvcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeTestCUDACompiler.cmake:59 (message):
  The CUDA compiler

    "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/bin/nvcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: 'C:/opensplat/OpenSplat/build/CMakeFiles/CMakeScratch/TryCompile-403fgl'

    Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe" cmTC_8ad53.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n
    MSBuild version 17.10.4+10fbfbf2e for .NET Framework
    Build started 19/07/2024 20:29:06.

    Project "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj" on node 1 (default targets).
    PrepareForBuild:
      Creating directory "cmTC_8ad53.dir\Debug\".
      Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.
      Creating directory "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\Debug\".
      Creating directory "cmTC_8ad53.dir\Debug\cmTC_8ad53.tlog\".
    InitializeBuildStatus:
      Creating "cmTC_8ad53.dir\Debug\cmTC_8ad53.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
      Touching "cmTC_8ad53.dir\Debug\cmTC_8ad53.tlog\unsuccessfulbuild".
    AddCudaCompileDeps:
      C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D__CUDACC_VER_MAJOR__=11 /D__CUDACC_VER_MINOR__=8 /D_WINDOWS /DCMAKE_INTDIR="Debug" /D_MBCS /DCMAKE_INTDIR="Debug" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include" /I. /FIcuda_runtime.h /c C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\main.cu
    Project "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj" (1) is building "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj" (1:2) on node 1 (CudaBuildCore target(s)).
    CudaBuildCore:
      Compiling CUDA source file main.cu...
      cmd.exe /C "C:\Users\20221123\AppData\Local\Temp\tmpaa5b5afa3fee4144bfb2d2b391136bb7.cmd"
      "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe"  --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu    -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include"     --keep-dir cmTC_8ad53\x64\Debug  -maxrregcount=0  --machine 64 --compile -cudart static --generate-code=arch=compute_70,code=[compute_70,sm_70] --generate-code=arch=compute_75,code=[compute_75,sm_75] --generate-code=arch=compute_80,code=[compute_80,sm_80] -Xcompiler="/EHsc -Zi -Ob0" -g  -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -D"CMAKE_INTDIR=\"Debug\"" -Xcompiler "/EHsc /W1 /nologo /Od /FdcmTC_8ad53.dir\Debug\vc143.pdb /FS /Zi /RTC1 /MDd " -o cmTC_8ad53.dir\Debug\main.obj "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\main.cu"

      C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe"  --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu    -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include"     --keep-dir cmTC_8ad53\x64\Debug  -maxrregcount=0  --machine 64 --compile -cudart static --generate-code=arch=compute_70,code=[compute_70,sm_70] --generate-code=arch=compute_75,code=[compute_75,sm_75] --generate-code=arch=compute_80,code=[compute_80,sm_80] -Xcompiler="/EHsc -Zi -Ob0" -g  -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -D"CMAKE_INTDIR=\"Debug\"" -Xcompiler "/EHsc /W1 /nologo /Od /FdcmTC_8ad53.dir\Debug\vc143.pdb /FS /Zi /RTC1 /MDd " -o cmTC_8ad53.dir\Debug\main.obj "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\main.cu"
    C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include\crt/host_config.h(153): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. [C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj]
      main.cu
    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 11.8.targets(785,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe"  --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu    -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include"     --keep-dir cmTC_8ad53\x64\Debug  -maxrregcount=0  --machine 64 --compile -cudart static --generate-code=arch=compute_70,code=[compute_70,sm_70] --generate-code=arch=compute_75,code=[compute_75,sm_75] --generate-code=arch=compute_80,code=[compute_80,sm_80] -Xcompiler="/EHsc -Zi -Ob0" -g  -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -D"CMAKE_INTDIR=\"Debug\"" -Xcompiler "/EHsc /W1 /nologo /Od /FdcmTC_8ad53.dir\Debug\vc143.pdb /FS /Zi /RTC1 /MDd " -o cmTC_8ad53.dir\Debug\main.obj "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\main.cu"" exited with code 2. [C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj]
    Done Building Project "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj" (CudaBuildCore target(s)) -- FAILED.
    Done Building Project "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj" (default targets) -- FAILED.

    Build FAILED.

    "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj" (default target) (1) ->
    "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj" (CudaBuildCore target) (1:2) ->
    (CudaBuildCore target) ->
      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include\crt/host_config.h(153): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. [C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj]
      C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 11.8.targets(785,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe"  --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64" -x cu    -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include"     --keep-dir cmTC_8ad53\x64\Debug  -maxrregcount=0  --machine 64 --compile -cudart static --generate-code=arch=compute_70,code=[compute_70,sm_70] --generate-code=arch=compute_75,code=[compute_75,sm_75] --generate-code=arch=compute_80,code=[compute_80,sm_80] -Xcompiler="/EHsc -Zi -Ob0" -g  -D_WINDOWS -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -D"CMAKE_INTDIR=\"Debug\"" -Xcompiler "/EHsc /W1 /nologo /Od /FdcmTC_8ad53.dir\Debug\vc143.pdb /FS /Zi /RTC1 /MDd " -o cmTC_8ad53.dir\Debug\main.obj "C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\main.cu"" exited with code 2. [C:\opensplat\OpenSplat\build\CMakeFiles\CMakeScratch\TryCompile-403fgl\cmTC_8ad53.vcxproj]

        0 Warning(s)
        2 Error(s)

    Time Elapsed 00:00:01.45

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:155 (enable_language)

-- Configuring incomplete, errors occurred!
pfxuan commented 4 months ago

Bump CUDA version (e.g. 12.4.0) should be able to resolve the problem. For reference, see this fix: https://github.com/pierotofy/OpenSplat/pull/110

l-fungus-l commented 4 months ago

I tried it as well but it gave me this error, which i found had to do with the CUDA version as well, so i thought 11.8 was necessary.

C:\opensplat\OpenSplat\build>cmake -DCMAKE_PREFIX_PATH=C:\opensplat\libtorch -DOPENCV_DIR=C:\Users\20221123\OpenCV\opencv\build -DCMAKE_BUILD_TYPE=Release ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.40.33812.0
-- The CXX compiler identification is MSVC 19.40.33812.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/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/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
OpenSplat Version: 1.1.3 (git commit 7c9a9cc)
-- Using the multi-header code from C:/opensplat/OpenSplat/build/_deps/nlohmann_json-src/include/
-- nanoflann version: 1.5.5
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- GLM: Version 1.0.1
-- GLM: Build with C++ features auto detection
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/include (found version "12.4.99")
-- ** Updated TORCH_CUDA_ARCH_LIST to 7.0 7.5 8.0 **
-- The CUDA compiler identification is NVIDIA 12.4.99
-- 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.4/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4 (found version "12.4")
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/include (found version "12.4.99")
CMake Error at C:/opensplat/libtorch/share/cmake/Caffe2/public/cuda.cmake:71 (message):
  Failed to find nvToolsExt
Call Stack (most recent call first):
  C:/opensplat/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:87 (include)
  C:/opensplat/libtorch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:164 (find_package)
pfxuan commented 4 months ago

It seems like you need nvToosExt. The new version of Windows CUDA does include it. You have to install it manually. References:

l-fungus-l commented 4 months ago

I fixed it. CUDA 12.4 comes with NVTX as a library in the compiler, rather than with Nsight NVTX, which means the location of the library is different, and since I wiped CUDA 11.8, libtorch could not find it correctly. I was able to fix it in two ways:

  1. specifying the location of the new NVTX library before the find_package(Torch REQUIRED) with link_directories("_path_to_NVTX_") in the CMakeLists.txt.
  2. Installing CUDA 11.8 with a custom build that only includes Nsight NVTX and nothing else, and libtorch will be able to reference the NVTX library in the 11.8 installation, but will build with CUDA 12.4.