Centerpoint 论文复现中执行bash setup.sh遇到的问题
執行bash setup.sh,執行結如下:
(cp2) twilight@ORG: ~/project/cp2/CenterPoint$ bash setup.sh
running build_ext
building 'deform_conv_cuda' extension
Emitting ninja build file /home/twilight/project/cp2/CenterPoint/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/2] /usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/TH -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/twilight/anaconda3/envs/cp2/include/python3.7m -c -c /home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda_kernel.cu -o /home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/build/temp.linux-x86_64-3.7/src/deform_conv_cuda_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -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 -gencode=arch=compute_75,code=sm_75 -std=c++14
/home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda_kernel.cu: In lambda function:
/home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda_kernel.cu:259:247: warning: ‘T* at::Tensor::data() const [with T = double]’ is deprecated: Tensor.data<T>() is deprecated. Please use Tensor.data_ptr<T>() instead. [-Wdeprecated-declarations]
AT_DISPATCH_FLOATING_TYPES_AND_HALF(
^
/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/ATen/core/TensorBody.h:363:1: note: declared here
T * data() const {
^ ~~
/home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda_kernel.cu:846:2216: warning: ‘T* at::Tensor::data() const [with T = c10::Half]’ is deprecated: Tensor.data<T>() is deprecated. Please use Tensor.data_ptr<T>() instead. [-Wdeprecated-declarations]
AT_DISPATCH_FLOATING_TYPES_AND_HALF(
^
/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/ATen/core/TensorBody.h:363:1: note: declared here
T * data() const {
^ ~~
/home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda_kernel.cu:846:2278: warning: ‘T* at::Tensor::data() const [with T = c10::Half]’ is deprecated: Tensor.data<T>() is deprecated. Please use Tensor.data_ptr<T>() instead. [-Wdeprecated-declarations]
AT_DISPATCH_FLOATING_TYPES_AND_HALF(
^
/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/ATen/core/TensorBody.h:363:1: note: declared here
T * data() const {
^ ~~
...
...
...
^
/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/ATen/core/TensorBody.h:363:1: note: declared here
T * data() const {
^ ~~
[2/2] c++ -MMD -MF /home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/build/temp.linux-x86_64-3.7/src/deform_conv_cuda.o.d -pthread -B /home/twilight/anaconda3/envs/cp2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/TH -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/twilight/anaconda3/envs/cp2/include/python3.7m -c -c /home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp -o /home/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/det3d/ops/dcn/build/temp.linux-x86_64-3.7/src/deform_conv_cuda.o
c++ -MMD -MF /home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/build/temp.linux-x86_64-3.7/src/deform_conv_cuda.o.d -pthread -B /home/twilight/anaconda3/envs/cp2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/TH -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/twilight/anaconda3/envs/cp2/include/python3.7m -c -c /home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp -o /home/twilight/project/cp2/CenterPoint/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++
In file included from /home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/ATen/Parallel.h:149:0,
from /home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/utils.h:3,
from /home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5,
from /home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:3,
from /home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/all.h:12,
from /home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/torch/extension.h:4,
from /home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp:4:
/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/ATen/ParallelOpenMP.h:84:0: warning: ignoring
/home/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp:66:3: note: suggested alternative: ‘DCHECK’
AT_CHECK(weight.ndimension() == 4,
^~~~~~~~
DCHECK
/home/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp:194:3: note: suggested alternative: ‘DCHECK’
AT_CHECK((offset.size(0) == batchSize), "invalid batch size of offset");
^~~~~~~~
DCHECK
/home/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp:301:3: note: suggested alternative: ‘DCHECK’
AT_CHECK((offset.size(0) == batchSize), 3, "invalid batch size of offset");
^~~~~~~~
DCHECK
/home/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp:417:3: note: suggested alternative: ‘DCHECK’
AT_CHECK((offset.size(0) == batchSize), "invalid batch size of offset");
^~~~~~~~
DCHECK
/home/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp:497:3: note: suggested alternative: ‘DCHECK’
AT_CHECK(input.is_contiguous(), "input tensor has to be contiguous");
^~~~~~~~
DCHECK
/home/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/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/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp:579:3: note: suggested alternative: ‘DCHECK’
AT_CHECK(input.is_contiguous(), "input tensor has to be contiguous");
^~~~~~~~
DCHECK
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1539, in _run_ninja_build
env=env)
File "/home/twilight/anaconda3/envs/cp2/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 <module>
cmdclass={'build_ext': BuildExtension})
File "/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
。。。
。。。
.。。
with_cuda=with_cuda)
File "/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1255, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1555, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
running build_ext
building 'iou3d_nms_cuda' extension
Emitting ninja build file /home/twilight/project/cp2/CenterPoint/det3d/ops/iou3d_nms/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/4] /usr/local/cuda/bin/nvcc -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/TH -I/home/twilight/anaconda3/envs/cp2/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/twilight/anaconda3/envs/cp2/include/python3.7m -c -c /home/twilight/project/cp2/CenterPoint/det3d/ops/iou3d_nms/src/iou3d_nms_kernel.cu -o /home/twilight/project/cp2/CenterPoint/det3d/ops/iou3d_nms/build/temp.linux-x86_64-3.7/src/iou3d_nms_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O2 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=iou3d_nms_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75 -std=c++14
执行結果非常長,报错很多,而且bash中沒标红,所以error比较隐蔽。处理:复制在vscode中,通過find查找出來的。 可以看出,报错有如下几个:
1./home/twilight/project/cp2/CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp:66:3: ***error:*** ‘AT_CHECK’ was not declared in this scope
2.subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
3.RuntimeError: Error compiling objects for extension
running build_ext
处理: 复制 /CenterPoint/det3d/ops/dcn/src/deform_conv_cuda.cpp:66:3: error: ‘AT_CHECK’ was not declared in this scope google(百度里找不到,所还是google yyds),找到了Centerpoint作者在github上的回复: https://github.com/open-mmlab/mmediting/issues/84
![在这里插入图片描述](https://img-blog.csdnimg.cn/400dcea44ff94929a7a9e4f907f706c8.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1R3aWxpZ2h0enI=,size_16,color_FFFFFF,t_70)
因此得到解决办法: 将deform_conv_cuda.cpp 和deform_pool_cuda.cpp 这两个文件中的"AT_CHECK" 都替换成"TORCH _CHECK " 。
在https://github.com/open-mmlab/mmediting/issues/84中也可以得到这个问题的解答。这个问题是装det3D中的dcn的库的所产生的问题。
|