sunset1995 / DirectVoxGO

Direct voxel grid optimization for fast radiance field reconstruction.
https://sunset1995.github.io/dvgo
Other
1.05k stars 110 forks source link

Loading adam_upd_cuda extension failure on Windows 10 (Pytorch with Cuda11.6) Python3.10 #54

Open mrsaleh opened 1 year ago

mrsaleh commented 1 year ago

I get the following error on windows 10 (Pytorch with Cuda 11.6, Python 3.10), It seems that the extensions built, but couldn't get loaded.

  warnings.warn(
Using C:\Users\Saleh\AppData\Local\torch_extensions\torch_extensions\Cache\py310_cu116 as PyTorch extensions root...
Detected CUDA files, patching ldflags
Emitting ninja build file C:\Users\Saleh\AppData\Local\torch_extensions\torch_extensions\Cache\py310_cu116\adam_upd_cuda\build.ninja...
Building extension module adam_upd_cuda...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
1.11.1
Loading extension module adam_upd_cuda...
Traceback (most recent call last):
  File "E:\3D-Reconstruction\DirectVoxGO\run.py", line 13, in <module>
    from lib import utils, dvgo, dcvgo, dmpigo
  File "E:\3D-Reconstruction\DirectVoxGO\lib\utils.py", line 11, in <module>
    from .masked_adam import MaskedAdam
  File "E:\3D-Reconstruction\DirectVoxGO\lib\masked_adam.py", line 7, in <module>
    adam_upd_cuda = load(
  File "D:\Program Files\Python310\lib\site-packages\torch\utils\cpp_extension.py", line 1284, in load
    return _jit_compile(
  File "D:\Program Files\Python310\lib\site-packages\torch\utils\cpp_extension.py", line 1534, in _jit_compile
    return _import_module_from_library(name, build_directory, is_python_module)
  File "D:\Program Files\Python310\lib\site-packages\torch\utils\cpp_extension.py", line 1936, in _import_module_from_library
    module = importlib.util.module_from_spec(spec)
ImportError: DLL load failed while importing adam_upd_cuda: The specified module could not be found.
mrsaleh commented 1 year ago

I was wrong , extension failed to build with Cuda 11.6 and Visual Studio 2022, I just ran ninja build file manually. If you wonder where it is , its at the following address. C:\Users\[Your Username]\AppData\Local\torch_extensions\torch_extensions\Cache\py310_cu116\adam_upd_cuda You probably need to run "vcvarsall.bat x86_amd64" before running ninja , or you get weird messages like "Can't find cassert file" After all, I stuck at the following error.

[2/3] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v...xGO\lib\cuda\adam_upd_kernel.cu -o adam_upd_kernel.cuda.o
FAILED: adam_upd_kernel.cuda.o
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin\nvcc --generate-dependencies-with-compile --dependency-output adam_upd_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=adam_upd_cuda -DTORCH_API_INCLUDE_EXTENSION_H "-ID:\Program Files\Python310\lib\site-packages\torch\include" "-ID:\Program Files\Python310\lib\site-packages\torch\include\torch\csrc\api\include" "-ID:\Program Files\Python310\lib\site-packages\torch\include\TH" "-ID:\Program Files\Python310\lib\site-packages\torch\include\THC" "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include" "-ID:\Program Files\Python310\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_52,code=compute_52 -gencode=arch=compute_52,code=sm_52 -c E:\3D-Reconstruction\DirectVoxGO\lib\cuda\adam_upd_kernel.cu -o adam_upd_kernel.cuda.o
D:/Program Files/Python310/lib/site-packages/torch/include\c10/macros/Macros.h(138): warning C4067: unexpected tokens following preprocessor directive - expected a newline
D:/Program Files/Python310/lib/site-packages/torch/include\c10/macros/Macros.h(138): warning C4067: unexpected tokens following preprocessor directive - expected a newline
D:\Program Files\Python310\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

D:\Program Files\Python310\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 "E:/3D-Reconstruction/DirectVoxGO/lib/cuda/adam_upd_kernel.cu".
adam_upd_kernel.cu
ninja: build stopped: subcommand failed.

It seems that is has something to do with Cuda 11.6 and pybind11.

tourbliu commented 1 year ago

Hello, have you solved this problem?