skyhehe123 / SA-SSD

SA-SSD: Structure Aware Single-stage 3D Object Detection from Point Cloud (CVPR 2020)
492 stars 106 forks source link

setup.py build_ext fail RuntimeError: Error compiling objects for extension #79

Open stephen20190822 opened 3 years ago

stephen20190822 commented 3 years ago

I met such errors. Can anybody help me how to fix this problem? Thanks advance! My cuda =10.1,pytorch=1.7 (SASSD) a3168@3168:~/SUN/SA-SSD-master/mmdet/ops/points_op$ python setup.py build_ext --inplace running build_ext building 'points_op_cpu' extension Emitting ninja build file /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/build/temp.linux-x86_64-3.8/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/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/build/temp.linux-x86_64-3.8/src/points_op.o.d -pthread -B /home/a3168/anaconda3/envs/SASSD/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/pybind11/include -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/pybind11/include -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/TH -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/THC -I/home/a3168/anaconda3/envs/SASSD/include/python3.8 -c -c /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp -o /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/build/temp.linux-x86_64-3.8/src/points_op.o -g -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=points_op_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14 FAILED: /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/build/temp.linux-x86_64-3.8/src/points_op.o c++ -MMD -MF /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/build/temp.linux-x86_64-3.8/src/points_op.o.d -pthread -B /home/a3168/anaconda3/envs/SASSD/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/pybind11/include -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/pybind11/include -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/TH -I/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/THC -I/home/a3168/anaconda3/envs/SASSD/include/python3.8 -c -c /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp -o /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/build/temp.linux-x86_64-3.8/src/points_op.o -g -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=points_op_cpu -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/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/Parallel.h:149:0, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/utils.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:12, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/extension.h:4, from /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:10: /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/ParallelOpenMP.h:84:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]

pragma omp parallel for if ((end - begin) >= grain_size)

/home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp: In function ‘int pts_in_boxes3d_cpu(at::Tensor, at::Tensor, at::Tensor, at::Tensor)’: /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:15:29: error: ‘AT_CHECK’ was not declared in this scope

define CHECK_CONTIGUOUS(x) AT_CHECK(x.is_contiguous(), #x, " must be contiguous ")

                         ^

/home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:113:5: note: in expansion of macro ‘CHECK_CONTIGUOUS’ CHECK_CONTIGUOUS(pts_flag); ^~~~ /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:15:29: note: suggested alternative: ‘DCHECK’

define CHECK_CONTIGUOUS(x) AT_CHECK(x.is_contiguous(), #x, " must be contiguous ")

                         ^

/home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:113:5: note: in expansion of macro ‘CHECK_CONTIGUOUS’ CHECK_CONTIGUOUS(pts_flag); ^~~~ /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:121:46: warning: ‘T at::Tensor::data() const [with T = int]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] int pts_flag_flat = pts_flag.data(); ^ In file included from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3:0, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/extension.h:4, from /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:10: /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here T data() const { ^~~~ /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:122:40: warning: ‘T at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] float pts_flat = pts.data(); ^ In file included from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3:0, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/extension.h:4, from /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:10: /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here T data() const { ^~~~ /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:123:48: warning: ‘T at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] float boxes3d_flat = boxes3d.data(); ^ In file included from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3:0, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/extension.h:4, from /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:10: /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here T data() const { ^~~~ /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:124:54: warning: ‘T at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] float reg_target_flat = reg_target.data(); ^ In file included from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/Tensor.h:3:0, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/Context.h:4, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/ATen.h:9, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8, from /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/torch/extension.h:4, from /home/a3168/SUN/SA-SSD-master/mmdet/ops/points_op/src/points_op.cpp:10: /home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here T data() const { ^~~~ ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1516, in _run_ninja_build subprocess.run( File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/subprocess.py", line 512, 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 "setup.py", line 30, in setup( File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/setuptools/init.py", line 153, in setup return distutils.core.setup(**attrs) File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/distutils/core.py", line 148, in setup dist.run_commands() File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run _build_ext.run(self) File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 653, in build_extensions build_ext.build_extensions(self) File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial self.build_extension(ext) File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 196, in build_extension _build_ext.build_extension(self, ext) File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension objects = self.compiler.compile(sources, File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 473, in unix_wrap_ninja_compile _write_ninja_file_and_compile_objects( File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1233, in _write_ninja_file_and_compile_objects _run_ninja_build( File "/home/a3168/anaconda3/envs/SASSD/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1538, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension

oreo-lp commented 3 years ago

me too!

oreo-lp commented 3 years ago

Hi, i have solved this problem. i change my torch version to pytorch=1.4.0 and torchvision=0.5.0. now my environment is : ubuntu 16.04 pytorch 1.4.0 torchvision 0.5.0 reference: https://github.com/facebookresearch/maskrcnn-benchmark/issues/1236#

eshoyuan commented 3 years ago

me too! And I use RTX3090 only support cuda11. I can't change my torch version to 1.4.0

hhd-shuai commented 3 years ago

I had the same problem. RTX3090 and cuda11.0 Please let me know if you can solve it. Thanks

eshoyuan commented 3 years ago

I had the same problem. RTX3090 and cuda11.0 I have solved the problem, but I forgot the solution. Sorry. However, the problem can be solved and google will help you.

hhd-shuai commented 3 years ago

I had the same problem. RTX3090 and cuda11.0 I have solved the problem, but I forgot the solution. Sorry. However, the problem can be solved and google will help you.我也有同样的问题。RTX3090和 cuda11.0我已经解决了这个问题,但是我忘记了解决方案。对不起。然而,这个问题是可以解决的,谷歌会帮助你。

okk Thanks a lot.

hhd-shuai commented 3 years ago

I had the same problem. RTX3090 and cuda11.0 I have solved the problem, but I forgot the solution. Sorry. However, the problem can be solved and google will help you.

I have downgrade pytorch version to 1.7 stable,but it doesn't work for me. And now I got a same error like this: runtimeerror

Do you have any advice? Could you tell me your pytorch version and cuda version? Thank you in advance.

eshoyuan commented 3 years ago

I had the same problem. RTX3090 and cuda11.0 I have solved the problem, but I forgot the solution. Sorry. However, the problem can be solved and google will help you.

I have downgrade pytorch version to 1.7 stable,but it doesn't work for me. And now I got a same error like this: runtimeerror

Do you have any advice? Could you tell me your pytorch version and cuda version? Thank you in advance.

I am sorry. I searched through my chorme history, but i really forgot the solution. maybe you can look on this page https://github.com/CharlesShang/DCNv2/pull/92 . This page appeared in my chrome history after I comented.

eshoyuan commented 3 years ago

I had the same problem. RTX3090 and cuda11.0 I have solved the problem, but I forgot the solution. Sorry. However, the problem can be solved and google will help you.

I have downgrade pytorch version to 1.7 stable,but it doesn't work for me. And now I got a same error like this: runtimeerror Do you have any advice? Could you tell me your pytorch version and cuda version? Thank you in advance.

I am sorry. I searched through my chorme history, but i really forgot the solution. maybe you can look on this page CharlesShang/DCNv2#92 . This page appeared in my chrome history after I comented.

My pytorch is 1.8.1.

hhd-shuai commented 3 years ago

I had the same problem. RTX3090 and cuda11.0 I have solved the problem, but I forgot the solution. Sorry. However, the problem can be solved and google will help you.

I have downgrade pytorch version to 1.7 stable,but it doesn't work for me. And now I got a same error like this: runtimeerror Do you have any advice? Could you tell me your pytorch version and cuda version? Thank you in advance.

I am sorry. I searched through my chorme history, but i really forgot the solution. maybe you can look on this page CharlesShang/DCNv2#92 . This page appeared in my chrome history after I comented. Thanks for the clue!

hhd-shuai commented 3 years ago

I had the same problem. RTX3090 and cuda11.0 I have solved the problem, but I forgot the solution. Sorry. However, the problem can be solved and google will help you.

I have downgrade pytorch version to 1.7 stable,but it doesn't work for me. And now I got a same error like this: runtimeerror Do you have any advice? Could you tell me your pytorch version and cuda version? Thank you in advance.

I am sorry. I searched through my chorme history, but i really forgot the solution. maybe you can look on this page CharlesShang/DCNv2#92 . This page appeared in my chrome history after I comented.

My pytorch is 1.8.1.

Thanks AGAIN!

hhd-shuai commented 3 years ago

you can try Modify SA-SSD/mmdet/ops/points_op/src/points_op.cpp #define CHECK_CONTIGUOUS(x) AT_CHECK(x.is_contiguous(), #x, " must be contiguous ") to #define CHECK_CONTIGUOUS(x) AT_ASSERT(x.is_contiguous())

SA-SSD/mmdet/ops/pointnet2/src/interpolate.cpp cudaStream_t stream = THCState_getCurrentStream(state); to cudaStream_t stream = at::cuda::getCurrentCUDAStream();

SA-SSD/mmdet/ops/iou3d/src/iou3d.cpp #define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ") #define CHECK_CONTIGUOUS(x) AT_CHECK(x.is_contiguous(), #x, " must be contiguous ") to #define CHECK_CUDA(x) AT_ASSERT(x.type().is_cuda()) #define CHECK_CONTIGUOUS(x) AT_ASSERT(x.is_contiguous())

quan-dao commented 3 years ago

Thanks @hhd-shuai, your solution works for me. My environment is:

AOOOOOA commented 1 year ago

Thanks @hhd-shuai, your solution works for me. My environment is:

  • ubuntu 18.04
  • pytorch 1.7.0
  • cuda 10.2
  • python 3.7

My GPU is rtx390 and my system is ubuntu 20. I also successfully ran the code with the above configuration.