donydchen / mvsplat

🌊 [ECCV'24] MVSplat: Efficient 3D Gaussian Splatting from Sparse Multi-View Images
https://donydchen.github.io/mvsplat
Other
498 stars 22 forks source link

About torch version #15

Closed jjlinghu closed 3 months ago

jjlinghu commented 3 months ago

Hi, thanks for your great work! The version of CUDA on my machine is 11.6. Does this mean I have to upgrade CUDA version at least to 11.8 to match torch==2.1.2? It is possible that I use the cu116 and torch==1.13.1 and the matched torchvision and torchaudio. Hopes your reply!

donydchen commented 3 months ago

Hi @jjlinghu, thanks for your interest in our work.

I think the pytorch-cuda==11.8 should be compatible with your CUDA 11.6, so you can go ahead and install our recommended version.

jjlinghu commented 3 months ago

Thanks for your quick reply! I installed the recommended version in README.md and pip install -v -e . in folder diff-gaussian-rasterization-modified/ but failed. I can't pip install git+https://github.com/dcharatan/diff-gaussian-rasterization-modified because of the network connect failure. Anyway, I get the diff-gaussian-rasterization-modified by git clone and try to pip install it. However, the error is raised as: File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 686, in unix_wrap_ninja_compile _write_ninja_file_and_compile_objects( File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects _run_ninja_build( File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2116, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension Does this mean that the versions do not match, and I have to use CUDA11.8?

donydchen commented 3 months ago

When using git clone, remember to use git clone --recursive since the diff-gaussian-rasterization-modified contains third-party submodules.

From the error log, it seems that the problem might be related to the GCC version. We use gcc=10.2.0 when compiling and installing diff-gaussian-rasterization-modified, and it works out fine. There could be other problems, though, but to me, it does not seem like the CUDA version issue.

jjlinghu commented 3 months ago

Hi, thanks for your sincere advice. I changed the version of gcc to gcc=10.2.0, but it failed to work. I retried the environment setup and kept the various versions consistent with this project. But something wrong happened.

(mvsplat) ly@ubuntu01:/data5/ly/mmdet/mvsplat$ pip install diff-gaussian-rasterization-modified/
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing ./diff-gaussian-rasterization-modified
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: diff-gaussian-rasterization
  Building wheel for diff-gaussian-rasterization (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [97 lines of output]
      running bdist_wheel
      running build
      running build_py
      running build_ext
      /data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/utils/cpp_extension.py:414: UserWarning: The detected CUDA version (11.6) has a minor version mismatch with the version that was used to compile PyTorch (11.8). Most likely this shouldn't be a problem.
        warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
      building 'diff_gaussian_rasterization._C' extension
      Emitting ninja build file /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/build/temp.linux-x86_64-cpython-310/build.ninja...
      Compiling objects...
      Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
      [1/3] /usr/local/cuda-11.6/bin/nvcc  -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/TH -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda-11.6/include -I/data2/ly/conda/envs/mvsplat/include/python3.10 -c -c /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/backward.cu -o /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/build/temp.linux-x86_64-cpython-310/cuda_rasterizer/backward.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -I/data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/third_party/glm/ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
      FAILED: /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/build/temp.linux-x86_64-cpython-310/cuda_rasterizer/backward.o
      /usr/local/cuda-11.6/bin/nvcc  -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/TH -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda-11.6/include -I/data2/ly/conda/envs/mvsplat/include/python3.10 -c -c /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/backward.cu -o /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/build/temp.linux-x86_64-cpython-310/cuda_rasterizer/backward.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -I/data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/third_party/glm/ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
      In file included from /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/backward.cu:12:
      /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/backward.h:19:10: fatal error: glm/glm.hpp: No such file or directory
         19 | #include <glm/glm.hpp>
            |          ^~~~~~~~~~~~~
      compilation terminated.
      [2/3] /usr/local/cuda-11.6/bin/nvcc  -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/TH -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda-11.6/include -I/data2/ly/conda/envs/mvsplat/include/python3.10 -c -c /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/forward.cu -o /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/build/temp.linux-x86_64-cpython-310/cuda_rasterizer/forward.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -I/data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/third_party/glm/ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
      FAILED: /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/build/temp.linux-x86_64-cpython-310/cuda_rasterizer/forward.o
      /usr/local/cuda-11.6/bin/nvcc  -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/TH -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda-11.6/include -I/data2/ly/conda/envs/mvsplat/include/python3.10 -c -c /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/forward.cu -o /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/build/temp.linux-x86_64-cpython-310/cuda_rasterizer/forward.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -I/data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/third_party/glm/ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
      In file included from /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/forward.cu:12:
      /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/forward.h:19:10: fatal error: glm/glm.hpp: No such file or directory
         19 | #include <glm/glm.hpp>
            |          ^~~~~~~~~~~~~
      compilation terminated.
      [3/3] /usr/local/cuda-11.6/bin/nvcc  -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/TH -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda-11.6/include -I/data2/ly/conda/envs/mvsplat/include/python3.10 -c -c /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/rasterizer_impl.cu -o /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/build/temp.linux-x86_64-cpython-310/cuda_rasterizer/rasterizer_impl.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -I/data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/third_party/glm/ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
      FAILED: /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/build/temp.linux-x86_64-cpython-310/cuda_rasterizer/rasterizer_impl.o
      /usr/local/cuda-11.6/bin/nvcc  -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/TH -I/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda-11.6/include -I/data2/ly/conda/envs/mvsplat/include/python3.10 -c -c /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/rasterizer_impl.cu -o /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/build/temp.linux-x86_64-cpython-310/cuda_rasterizer/rasterizer_impl.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -I/data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/third_party/glm/ -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
      /data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/cuda_rasterizer/rasterizer_impl.cu:23:10: fatal error: glm/glm.hpp: No such file or directory
         23 | #include <glm/glm.hpp>
            |          ^~~~~~~~~~~~~
      compilation terminated.
      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2100, in _run_ninja_build
          subprocess.run(
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/subprocess.py", line 526, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/data5/ly/mmdet/mvsplat/diff-gaussian-rasterization-modified/setup.py", line 17, in <module>
          setup(
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 364, in run
          self.run_command("build")
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 88, in run
          _build_ext.run(self)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 873, in build_extensions
          build_ext.build_extensions(self)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 249, in build_extension
          _build_ext.build_extension(self, ext)
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension
          objects = self.compiler.compile(
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 686, in unix_wrap_ninja_compile
          _write_ninja_file_and_compile_objects(
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects
          _run_ninja_build(
        File "/data2/ly/conda/envs/mvsplat/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2116, in _run_ninja_build
          raise RuntimeError(message) from e
      RuntimeError: Error compiling objects for extension
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for diff-gaussian-rasterization
  Running setup.py clean for diff-gaussian-rasterization
Failed to build diff-gaussian-rasterization
ERROR: Could not build wheels for diff-gaussian-rasterization, which is required to install pyproject.toml-based projects
(mvsplat) ly@ubuntu01:/data5/ly/mmdet/mvsplat$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/data2/ly/conda/envs/mvsplat/gcc102/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/data2/ly/conda/envs/mvsplat/gcc102 --enable-bootstrap --enable-checking=yes --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC) 
(mvsplat) ly@ubuntu01:/data5/ly/mmdet/mvsplat$ nvcc -V
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

I'm still unsure of what went wrong, and despite searching the internet, I couldn't find any helpful information regarding the fatal error: glm/glm.hpp: No such file or directoryin the error log. If you have relevant experience, please tell me. Thanks a lot!

donydchen commented 3 months ago

Hi @jjlinghu, no worries. GLM is actually included as a submodule in diff-gaussian-rasterization-modified, as shown in its .gitmodules.

The solution is: Remember to clone diff-gaussian-rasterization-modified using

git clone --recursive https://github.com/dcharatan/diff-gaussian-rasterization-modified.git

Note that there is a --recursive in the command. You should be able to find glm under third_party/glm.

jjlinghu commented 3 months ago

Thank you for your careful guidance; the issue has been resolved. Much appreciated!