autonomousvision / monosdf

[NeurIPS'22] MonoSDF: Exploring Monocular Geometric Cues for Neural Implicit Surface Reconstruction
MIT License
565 stars 52 forks source link

IndexError: list index out of range #55

Closed YJ-142150 closed 1 year ago

YJ-142150 commented 1 year ago

Thanks for your great work.

But I have problem when I evaluate pretrained models. When I entered the evauation command python evaluation/eval.py --conf confs/dtu_mlp_3views.conf --checkpoint ../pretrained_models/dtu_3views_mlp/scan65.pth --scan_id 65 --resolution 512 --eval_rendering --evals_folder ../pretrained_results, this error comes out.

No CUDA runtime is found, using CUDA_HOME='/home/lambdasix/anaconda3/envs/monosdf'
Detected CUDA files, patching ldflags
Emitting ninja build file ./tmp_build/build.ninja...
Traceback (most recent call last):
  File "evaluation/eval.py", line 147, in <module>
    evaluate(conf=opt.conf,
  File "evaluation/eval.py", line 38, in evaluate
    model = utils.get_class(conf.get_string('train.model_class'))(conf=conf_model)
  File "/home/lambdasix/monosdf/code/../code/utils/general.py", line 17, in get_class
    m = __import__(module)
  File "/home/lambdasix/monosdf/code/../code/model/network.py", line 140, in <module>
    from hashencoder.hashgrid import _hash_encode, HashEncoder
  File "/home/lambdasix/monosdf/code/../code/hashencoder/__init__.py", line 1, in <module>
    from .hashgrid import HashEncoder
  File "/home/lambdasix/monosdf/code/../code/hashencoder/hashgrid.py", line 12, in <module>
    from .backend import _backend
  File "/home/lambdasix/monosdf/code/../code/hashencoder/backend.py", line 10, in <module>
    _backend = load(name='_hash_encoder',
  File "/home/lambdasix/anaconda3/envs/monosdf/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1284, in load
    return _jit_compile(
  File "/home/lambdasix/anaconda3/envs/monosdf/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1508, in _jit_compile
    _write_ninja_file_and_build_library(
  File "/home/lambdasix/anaconda3/envs/monosdf/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1610, in _write_ninja_file_and_build_library
    _write_ninja_file_to_build_library(
  File "/home/lambdasix/anaconda3/envs/monosdf/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 2014, in _write_ninja_file_to_build_library
    cuda_flags = common_cflags + COMMON_NVCC_FLAGS + _get_cuda_arch_flags()
  File "/home/lambdasix/anaconda3/envs/monosdf/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1780, in _get_cuda_arch_flags
    arch_list[-1] += '+PTX'
IndexError: list index out of range

Thanks for any assistance.

niujinshuchong commented 1 year ago

Hi, looks like cuda is missing. You could try conda install cudatoolkit-dev=11.3 -c conda-forge if you use conda.

YJ-142150 commented 1 year ago

Actually I use CUDA 11.7. Does conda install cudatoolkit-dev=11.3 -c conda-forge works on CUDA 11.7, too?

YJ-142150 commented 1 year ago

I tried conda install cudatoolkit-dev=11.3 -c conda-forge, but it also produce same error...

niujinshuchong commented 1 year ago

Hi, do you also install torch with cuda 11.3?

YJ-142150 commented 1 year ago
cd monosdf

conda create -y -n monosdf python=3.8
conda activate monosdf

conda install pytorch torchvision cudatoolkit=11.3 -c pytorch
conda install cudatoolkit-dev=11.3 -c conda-forge

pip install -r requirements.txt

and conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch I followed these commends, but it also results same error...

YJ-142150 commented 1 year ago

Well, I tried conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia instead of

conda install pytorch torchvision cudatoolkit=11.3 -c pytorch
conda install cudatoolkit-dev=11.3 -c conda-forge

it solves the index error, but it also results new error..

Detected CUDA files, patching ldflags
Emitting ninja build file ./tmp_build/build.ninja...
Building extension module _hash_encoder...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/3] c++ -MMD -MF bindings.o.d -DTORCH_EXTENSION_NAME=_hash_encoder -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/TH -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/THC -isystem /home/lambdasix/anaconda3/envs/monosdf2/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -O3 -std=c++14 -c /home/lambdasix/monosdf/code/hashencoder/src/bindings.cpp -o bindings.o 
[2/3] /home/lambdasix/anaconda3/envs/monosdf2/bin/nvcc  -DTORCH_EXTENSION_NAME=_hash_encoder -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/TH -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/THC -isystem /home/lambdasix/anaconda3/envs/monosdf2/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/include/python3.8 -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 --compiler-options '-fPIC' -O3 -std=c++14 -allow-unsupported-compiler -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -c /home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu -o hashencoder.cuda.o 
[3/3] c++ hashencoder.cuda.o bindings.o -shared -L/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/lib -lc10 -lc10_cuda -ltorch_cpu -ltorch_cuda_cu -ltorch_cuda_cpp -ltorch -ltorch_python -L/home/lambdasix/anaconda3/envs/monosdf2/lib64 -lcudart -o _hash_encoder.so
FAILED: _hash_encoder.so 
c++ hashencoder.cuda.o bindings.o -shared -L/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/lib -lc10 -lc10_cuda -ltorch_cpu -ltorch_cuda_cu -ltorch_cuda_cpp -ltorch -ltorch_python -L/home/lambdasix/anaconda3/envs/monosdf2/lib64 -lcudart -o _hash_encoder.so
/usr/bin/ld: cannot find -lcudart: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1900, in _run_ninja_build
    subprocess.run(
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/subprocess.py", line 516, 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 "evaluation/eval.py", line 147, in <module>
    evaluate(conf=opt.conf,
  File "evaluation/eval.py", line 38, in evaluate
    model = utils.get_class(conf.get_string('train.model_class'))(conf=conf_model)
  File "/home/lambdasix/monosdf/code/../code/utils/general.py", line 17, in get_class
    m = __import__(module)
  File "/home/lambdasix/monosdf/code/../code/model/network.py", line 140, in <module>
    from hashencoder.hashgrid import _hash_encode, HashEncoder
  File "/home/lambdasix/monosdf/code/../code/hashencoder/__init__.py", line 1, in <module>
    from .hashgrid import HashEncoder
  File "/home/lambdasix/monosdf/code/../code/hashencoder/hashgrid.py", line 12, in <module>
    from .backend import _backend
  File "/home/lambdasix/monosdf/code/../code/hashencoder/backend.py", line 10, in <module>
    _backend = load(name='_hash_encoder',
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1284, in load
    return _jit_compile(
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1508, in _jit_compile
    _write_ninja_file_and_build_library(
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1623, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1916, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension '_hash_encoder'

Is there specific version of ninja module required?

niujinshuchong commented 1 year ago

Hi, could you try

conda create -y -n monosdf python=3.8
conda activate monosdf

pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 -f https://download.pytorch.org/whl/torch_stable.html
conda install cudatoolkit-dev=11.3 -c conda-forge

pip install -r requirements.txt
YJ-142150 commented 1 year ago

I tried the command, but it results other error.

Detected CUDA files, patching ldflags
Emitting ninja build file ./tmp_build/build.ninja...
Building extension module _hash_encoder...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
Loading extension module _hash_encoder...
Traceback (most recent call last):
  File "evaluation/eval.py", line 147, in <module>
    evaluate(conf=opt.conf,
  File "evaluation/eval.py", line 38, in evaluate
    model = utils.get_class(conf.get_string('train.model_class'))(conf=conf_model)
  File "/home/lambdasix/monosdf/code/../code/utils/general.py", line 17, in get_class
    m = __import__(module)
  File "/home/lambdasix/monosdf/code/../code/model/network.py", line 140, in <module>
    from hashencoder.hashgrid import _hash_encode, HashEncoder
  File "/home/lambdasix/monosdf/code/../code/hashencoder/__init__.py", line 1, in <module>
    from .hashgrid import HashEncoder
  File "/home/lambdasix/monosdf/code/../code/hashencoder/hashgrid.py", line 12, in <module>
    from .backend import _backend
  File "/home/lambdasix/monosdf/code/../code/hashencoder/backend.py", line 10, in <module>
    _backend = load(name='_hash_encoder',
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1202, in load
    return _jit_compile(
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1450, in _jit_compile
    return _import_module_from_library(name, build_directory, is_python_module)
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1844, in _import_module_from_library
    module = importlib.util.module_from_spec(spec)
ImportError: ./tmp_build/_hash_encoder.so: undefined symbol: _ZN8pybind116detail11type_casterIN2at6TensorEvE4loadENS_6handleEb

The input command was python evaluation/eval.py --conf confs/dtu_mlp_3views.conf --checkpoint ../pretrained_models/dtu_3views_mlp/scan65.pth --scan_id 65 --resolution 512 --eval_rendering --evals_folder ../pretrained_results for pretrained.

niujinshuchong commented 1 year ago

Could you delete the ./tmp_build folder and try again?

YJ-142150 commented 1 year ago

I deleted tmp_build folder, and also new error came out..

Detected CUDA files, patching ldflags
Emitting ninja build file ./tmp_build/build.ninja...
Building extension module _hash_encoder...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/3] /home/lambdasix/anaconda3/envs/monosdf2/bin/nvcc  -DTORCH_EXTENSION_NAME=_hash_encoder -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/TH -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/THC -isystem /home/lambdasix/anaconda3/envs/monosdf2/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/include/python3.8 -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 --compiler-options '-fPIC' -O3 -std=c++14 -allow-unsupported-compiler -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -c /home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu -o hashencoder.cuda.o 
FAILED: hashencoder.cuda.o 
/home/lambdasix/anaconda3/envs/monosdf2/bin/nvcc  -DTORCH_EXTENSION_NAME=_hash_encoder -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/TH -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/THC -isystem /home/lambdasix/anaconda3/envs/monosdf2/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/include/python3.8 -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 --compiler-options '-fPIC' -O3 -std=c++14 -allow-unsupported-compiler -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ -U__CUDA_NO_HALF2_OPERATORS__ -c /home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu -o hashencoder.cuda.o 
/usr/include/stdio.h(189): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(201): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(223): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(260): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(285): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(294): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(303): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(309): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(315): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(830): error: attribute "__malloc__" does not take arguments

/usr/include/stdlib.h(566): error: attribute "__malloc__" does not take arguments

/usr/include/stdlib.h(570): error: attribute "__malloc__" does not take arguments

/usr/include/stdlib.h(799): error: attribute "__malloc__" does not take arguments

/usr/include/wchar.h(155): error: attribute "__malloc__" does not take arguments

/usr/include/wchar.h(582): error: attribute "__malloc__" does not take arguments

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=double, D=2U, C=2U, N_C=2U]" 
(687): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double, D=2U]" 
(721): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=double, D=2U, C=4U, N_C=2U]" 
(692): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double, D=2U]" 
(721): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=double, D=2U, C=8U, N_C=2U]" 
(698): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double, D=2U]" 
(721): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=double, D=3U, C=2U, N_C=2U]" 
(687): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double, D=3U]" 
(722): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=double, D=3U, C=4U, N_C=2U]" 
(692): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double, D=3U]" 
(722): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=double, D=3U, C=8U, N_C=2U]" 
(698): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double, D=3U]" 
(722): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=double]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=float, D=2U, C=2U, N_C=2U]" 
(687): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float, D=2U]" 
(721): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=float, D=2U, C=4U, N_C=2U]" 
(692): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float, D=2U]" 
(721): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=float, D=2U, C=8U, N_C=2U]" 
(698): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float, D=2U]" 
(721): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=float, D=3U, C=2U, N_C=2U]" 
(687): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float, D=3U]" 
(722): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=float, D=3U, C=4U, N_C=2U]" 
(692): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float, D=3U]" 
(722): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float]" 
(817): here

/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu(513): warning: variable "results_grad" was declared but never referenced
          detected during:
            instantiation of "void kernel_grid_second_backward_embedding<scalar_t,D,C,N_C>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, const scalar_t *, const scalar_t *, scalar_t *, uint32_t, uint32_t, float, uint32_t) [with scalar_t=float, D=3U, C=8U, N_C=2U]" 
(698): here
            instantiation of "void kernel_grid_second_backward_wrapper<scalar_t,D>(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float, D=3U]" 
(722): here
            instantiation of "void hash_encode_second_backward_cuda(const scalar_t *, const scalar_t *, const scalar_t *, const int *, uint32_t, uint32_t, uint32_t, uint32_t, float, uint32_t, __nv_bool, const scalar_t *, const scalar_t *, scalar_t *, scalar_t *) [with scalar_t=float]" 
(817): here

15 errors detected in the compilation of "/home/lambdasix/monosdf/code/hashencoder/src/hashencoder.cu".
[2/3] c++ -MMD -MF bindings.o.d -DTORCH_EXTENSION_NAME=_hash_encoder -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/TH -isystem /home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/include/THC -isystem /home/lambdasix/anaconda3/envs/monosdf2/include -isystem /home/lambdasix/anaconda3/envs/monosdf2/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -O3 -std=c++14 -c /home/lambdasix/monosdf/code/hashencoder/src/bindings.cpp -o bindings.o 
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1808, in _run_ninja_build
    subprocess.run(
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/subprocess.py", line 516, 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 "evaluation/eval.py", line 147, in <module>
    evaluate(conf=opt.conf,
  File "evaluation/eval.py", line 38, in evaluate
    model = utils.get_class(conf.get_string('train.model_class'))(conf=conf_model)
  File "/home/lambdasix/monosdf/code/../code/utils/general.py", line 17, in get_class
    m = __import__(module)
  File "/home/lambdasix/monosdf/code/../code/model/network.py", line 140, in <module>
    from hashencoder.hashgrid import _hash_encode, HashEncoder
  File "/home/lambdasix/monosdf/code/../code/hashencoder/__init__.py", line 1, in <module>
    from .hashgrid import HashEncoder
  File "/home/lambdasix/monosdf/code/../code/hashencoder/hashgrid.py", line 12, in <module>
    from .backend import _backend
  File "/home/lambdasix/monosdf/code/../code/hashencoder/backend.py", line 10, in <module>
    _backend = load(name='_hash_encoder',
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1202, in load
    return _jit_compile(
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1425, in _jit_compile
    _write_ninja_file_and_build_library(
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1537, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "/home/lambdasix/anaconda3/envs/monosdf2/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1824, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension '_hash_encoder'
niujinshuchong commented 1 year ago

Maybe you should also install gcc/g++ with conda

conda install -c conda-forge gcc==9.5.0
conda install -c conda-forge gxx==9.5.0
YJ-142150 commented 1 year ago

It finally works! Thank you for every assistance!