Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Error compiling objects for extension #405

Open
githigher opened this issue Nov 28, 2023 · 1 comment
Open

RuntimeError: Error compiling objects for extension #405

githigher opened this issue Nov 28, 2023 · 1 comment

Comments

@githigher
Copy link

When I run ‘python setup.py build_ext --inplace’, it made an error:

running build_ext
/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/cpp_extension.py:813: UserWarning: The detected CUDA version (11.2) has a minor version mismatch with the version that was used to compile PyTorch (11.3). Most likely this shouldn't be a problem.
warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
Emitting ninja build file /home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/build/temp.linux-x86_64-3.7/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/1] c++ -MMD -MF /home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/build/temp.linux-x86_64-3.7/src/deform_conv_cuda.o.d -pthread -B /home/coop/anaconda3/envs/v2xvit/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /home/coop/gyt/software/ncurses/include -fPIC -DWITH_CUDA -I/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/include -I/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/include/TH -I/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-11.2/include -I/home/coop/anaconda3/envs/v2xvit/include/python3.7m -c -c /home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp -o /home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/build/temp.linux-x86_64-3.7/src/deform_conv_cuda.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=deform_conv_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/build/temp.linux-x86_64-3.7/src/deform_conv_cuda.o
c++ -MMD -MF /home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/build/temp.linux-x86_64-3.7/src/deform_conv_cuda.o.d -pthread -B /home/coop/anaconda3/envs/v2xvit/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /home/coop/gyt/software/ncurses/include -fPIC -DWITH_CUDA -I/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/include -I/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/include/TH -I/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-11.2/include -I/home/coop/anaconda3/envs/v2xvit/include/python3.7m -c -c /home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp -o /home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/build/temp.linux-x86_64-3.7/src/deform_conv_cuda.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=deform_conv_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp: In function ‘void shape_check(at::Tensor, at::Tensor, at::Tensor*, at::Tensor, int, int, int, int, int, int, int, int, int, int)’:
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:66:3: error: ‘AT_CHECK’ was not declared in this scope
AT_CHECK(weight.ndimension() == 4,
^~~~~~~~
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:66:3: note: suggested alternative: ‘CHECK’
AT_CHECK(weight.ndimension() == 4,
^~~~~~~~
CHECK
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp: In function ‘int deform_conv_forward_cuda(at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, int, int, int, int, int, int, int, int, int, int, int)’:
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:194:3: error: ‘AT_CHECK’ was not declared in this scope
AT_CHECK((offset.size(0) == batchSize), "invalid batch size of offset");
^~~~~~~~
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:194:3: note: suggested alternative: ‘CHECK’
AT_CHECK((offset.size(0) == batchSize), "invalid batch size of offset");
^~~~~~~~
CHECK
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp: In function ‘int deform_conv_backward_input_cuda(at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, int, int, int, int, int, int, int, int, int, int, int)’:
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:301:3: error: ‘AT_CHECK’ was not declared in this scope
AT_CHECK((offset.size(0) == batchSize), 3, "invalid batch size of offset");
^~~~~~~~
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:301:3: note: suggested alternative: ‘CHECK’
AT_CHECK((offset.size(0) == batchSize), 3, "invalid batch size of offset");
^~~~~~~~
CHECK
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp: In function ‘int deform_conv_backward_parameters_cuda(at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, int, int, int, int, int, int, int, int, int, int, float, int)’:
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:417:3: error: ‘AT_CHECK’ was not declared in this scope
AT_CHECK((offset.size(0) == batchSize), "invalid batch size of offset");
^~~~~~~~
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:417:3: note: suggested alternative: ‘CHECK’
AT_CHECK((offset.size(0) == batchSize), "invalid batch size of offset");
^~~~~~~~
CHECK
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp: In function ‘void modulated_deform_conv_cuda_forward(at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, int, int, int, int, int, int, int, int, int, int, bool)’:
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:497:3: error: ‘AT_CHECK’ was not declared in this scope
AT_CHECK(input.is_contiguous(), "input tensor has to be contiguous");
^~~~~~~~
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:497:3: note: suggested alternative: ‘CHECK’
AT_CHECK(input.is_contiguous(), "input tensor has to be contiguous");
^~~~~~~~
CHECK
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp: In function ‘void modulated_deform_conv_cuda_backward(at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, int, int, int, int, int, int, int, int, int, int, bool)’:
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:579:3: error: ‘AT_CHECK’ was not declared in this scope
AT_CHECK(input.is_contiguous(), "input tensor has to be contiguous");
^~~~~~~~
/home/coop/gyt/OpenCOOD-main/det3d/ops/dcn/src/deform_conv_cuda.cpp:579:3: note: suggested alternative: ‘CHECK’
AT_CHECK(input.is_contiguous(), "input tensor has to be contiguous");
^~~~~~~~
CHECK
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1814, in _run_ninja_build
env=env)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/subprocess.py", line 512, in run
output=stdout, stderr=stderr)
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 "setup.py", line 19, in
cmdclass={'build_ext': BuildExtension})
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/init.py", line 155, in setup
return distutils.core.setup(**attrs)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 148, in setup
return run_commands(dist)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
dist.run_commands()
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 765, in build_extensions
build_ext.build_extensions(self)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
_build_ext.build_extension(self, ext)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/Cython/Distutils/build_ext.py", line 135, in build_extension
super(build_ext, self).build_extension(ext)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/setuptools/_distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 595, in unix_wrap_ninja_compile
with_cuda=with_cuda)
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1492, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/home/coop/anaconda3/envs/v2xvit/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1824, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

@YumengXiu
Copy link

In deform_conv_cuda.cpp, replace all "AT_CHECK" as "TORCH_CHECK "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants