wutong16 / Voxurf

[ ICLR 2023 Spotlight ] Pytorch implementation for "Voxurf: Voxel-based Efficient and Accurate Neural Surface Reconstruction"
Other
403 stars 27 forks source link

Error building "render_utils_cuda" #1

Closed carlosedubarreto closed 1 year ago

carlosedubarreto commented 1 year ago

Hello, I ws trying to use the code, but I end up getting an error when trying to run it.

When it goes to compile it shows this error

D:\AI\3d_objects\Voxurf\Voxurf-main>python run.py --config configs/dtu_e2e_womask/coarse.py -p exp --no_reload --no_dvgo_init --sdf_mode voxurf_womask_coarse --scene 122
C:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\mmcv\__init__.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.
  warnings.warn(
Using C:\Users\carlo\AppData\Local\torch_extensions\torch_extensions\Cache\py39_cu116 as PyTorch extensions root...
Detected CUDA files, patching ldflags
Emitting ninja build file C:\Users\carlo\AppData\Local\torch_extensions\torch_extensions\Cache\py39_cu116\render_utils_cuda\build.ninja...
Building extension module render_utils_cuda...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin\nvcc --generate-dependencies-with-compile --dependency-output render_utils_kernel.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=render_utils_cuda -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\include -IC:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\include\TH -IC:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include" -IC:\Users\carlo\.conda\envs\3ddfa\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -c D:\AI\3d_objects\Voxurf\Voxurf-main\lib\cuda\render_utils_kernel.cu -o render_utils_kernel.cuda.o
FAILED: render_utils_kernel.cuda.o
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin\nvcc --generate-dependencies-with-compile --dependency-output render_utils_kernel.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=render_utils_cuda -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\include -IC:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\include\TH -IC:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include" -IC:\Users\carlo\.conda\envs\3ddfa\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -c D:\AI\3d_objects\Voxurf\Voxurf-main\lib\cuda\render_utils_kernel.cu -o render_utils_kernel.cuda.o
C:/Users/carlo/.conda/envs/3ddfa/lib/site-packages/torch/include\c10/macros/Macros.h(138): warning C4067: tokens inesperados após diretiva de pré-processador - esperado um newline
C:/Users/carlo/.conda/envs/3ddfa/lib/site-packages/torch/include\c10/macros/Macros.h(138): warning C4067: tokens inesperados após diretiva de pré-processador - esperado um newline
C:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\include\pybind11\cast.h(624): error: too few arguments for template template parameter "Tuple"
          detected during instantiation of class "pybind11::detail::tuple_caster<Tuple, Ts...> [with Tuple=std::pair, Ts=<T1, T2>]"
(721): here

C:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\include\pybind11\cast.h(717): error: too few arguments for template template parameter "Tuple"
          detected during instantiation of class "pybind11::detail::tuple_caster<Tuple, Ts...> [with Tuple=std::pair, Ts=<T1, T2>]"
(721): here

2 errors detected in the compilation of "D:/AI/3d_objects/Voxurf/Voxurf-main/lib/cuda/render_utils_kernel.cu".
render_utils_kernel.cu
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "C:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\utils\cpp_extension.py", line 1900, in _run_ninja_build
    subprocess.run(
  File "C:\Users\carlo\.conda\envs\3ddfa\lib\subprocess.py", line 528, 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 "D:\AI\3d_objects\Voxurf\Voxurf-main\run.py", line 15, in <module>
    from lib import utils, dtu_eval
  File "D:\AI\3d_objects\Voxurf\Voxurf-main\lib\utils.py", line 20, in <module>
    from . import grid
  File "D:\AI\3d_objects\Voxurf\Voxurf-main\lib\grid.py", line 12, in <module>
    render_utils_cuda = load(
  File "C:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\utils\cpp_extension.py", line 1284, in load
    return _jit_compile(
  File "C:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\utils\cpp_extension.py", line 1508, in _jit_compile
    _write_ninja_file_and_build_library(
  File "C:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\utils\cpp_extension.py", line 1623, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "C:\Users\carlo\.conda\envs\3ddfa\lib\site-packages\torch\utils\cpp_extension.py", line 1916, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'render_utils_cuda'

I'm using pytorch 1.13.1 Cuda 11.6 torch-scatter==2.1.0+pt113cu116

maybe its a problem with the cuda version I'm using? what version did you use?

I'm trying it on windows. thanks.

carlosedubarreto commented 1 year ago

One update, I also tested with torch 1.12.1+cu113 and had the same error

PS.: I had this error because I installed CUDA11.3 and didnt restart the cmd, so it was pointing to CUDA11.6 the next day (the comment below) with the pc restarted, the paths to cuda 11.3 were updated, so it worked 😊

carlosedubarreto commented 1 year ago

correcting, today I tried again with the env that had torch 1.12.1 CUDA11.3, and its working.

To install those dependencies on windows I used

pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.12.0+cu113.html
SensenGao commented 1 month ago

correcting, today I tried again with the env that had torch 1.12.1 CUDA11.3, and its working.

To install those dependencies on windows I used

pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.12.0+cu113.html

How about your version of python? I also encountered this question. Thank you.