PointNet++ CUDA layers fail to build on pytorch 1.5.0+
btalb opened this issue · 4 comments
Building CUDA layers fails with the following error when running python setup.py install
from inside the pointnet2
directory:
running install
running bdist_egg
running egg_info
creating pointnet2.egg-info
writing pointnet2.egg-info/PKG-INFO
writing dependency_links to pointnet2.egg-info/dependency_links.txt
writing top-level names to pointnet2.egg-info/top_level.txt
writing manifest file 'pointnet2.egg-info/SOURCES.txt'
/usr/local/lib/python3.6/dist-packages/torch/utils/cpp_extension.py:304: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'pointnet2.egg-info/SOURCES.txt'
writing manifest file 'pointnet2.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'pointnet2._ext' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/_ext_src
creating build/temp.linux-x86_64-3.6/_ext_src/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c _ext_src/src/ball_query.cpp -o build/temp.linux-x86_64-3.6/_ext_src/src/ball_query.o -O2 -I_ext_src/include -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
In file included from _ext_src/src/ball_query.cpp:7:0:
_ext_src/src/ball_query.cpp: In function 'at::Tensor ball_query(at::Tensor, at::Tensor, float, int)':
_ext_src/include/utils.h:17:5: error: 'AT_CHECK' was not declared in this scope
AT_CHECK(x.is_contiguous(), #x " must be a contiguous tensor"); \
^
_ext_src/include/utils.h:17:5: note: in definition of macro 'CHECK_CONTIGUOUS'
AT_CHECK(x.is_contiguous(), #x " must be a contiguous tensor"); \
^~~~~~~~
_ext_src/include/utils.h:17:5: note: suggested alternative: 'DCHECK'
AT_CHECK(x.is_contiguous(), #x " must be a contiguous tensor"); \
^
_ext_src/include/utils.h:17:5: note: in definition of macro 'CHECK_CONTIGUOUS'
AT_CHECK(x.is_contiguous(), #x " must be a contiguous tensor"); \
^~~~~~~~
_ext_src/include/utils.h:17:5: error: 'AT_CHECK' was not declared in this scope
AT_CHECK(x.is_contiguous(), #x " must be a contiguous tensor"); \
^
_ext_src/include/utils.h:17:5: note: in definition of macro 'CHECK_CONTIGUOUS'
AT_CHECK(x.is_contiguous(), #x " must be a contiguous tensor"); \
^~~~~~~~
_ext_src/include/utils.h:17:5: note: suggested alternative: 'DCHECK'
AT_CHECK(x.is_contiguous(), #x " must be a contiguous tensor"); \
^
_ext_src/include/utils.h:17:5: note: in definition of macro 'CHECK_CONTIGUOUS'
AT_CHECK(x.is_contiguous(), #x " must be a contiguous tensor"); \
^~~~~~~~
_ext_src/include/utils.h:28:5: error: 'AT_CHECK' was not declared in this scope
AT_CHECK(x.scalar_type() == at::ScalarType::Float, \
^
_ext_src/include/utils.h:28:5: note: in definition of macro 'CHECK_IS_FLOAT'
AT_CHECK(x.scalar_type() == at::ScalarType::Float, \
^~~~~~~~
_ext_src/include/utils.h:28:5: note: suggested alternative: 'DCHECK'
AT_CHECK(x.scalar_type() == at::ScalarType::Float, \
^
_ext_src/include/utils.h:28:5: note: in definition of macro 'CHECK_IS_FLOAT'
AT_CHECK(x.scalar_type() == at::ScalarType::Float, \
^~~~~~~~
_ext_src/include/utils.h:28:5: error: 'AT_CHECK' was not declared in this scope
AT_CHECK(x.scalar_type() == at::ScalarType::Float, \
^
_ext_src/include/utils.h:28:5: note: in definition of macro 'CHECK_IS_FLOAT'
AT_CHECK(x.scalar_type() == at::ScalarType::Float, \
^~~~~~~~
_ext_src/include/utils.h:28:5: note: suggested alternative: 'DCHECK'
AT_CHECK(x.scalar_type() == at::ScalarType::Float, \
^
_ext_src/include/utils.h:28:5: note: in definition of macro 'CHECK_IS_FLOAT'
AT_CHECK(x.scalar_type() == at::ScalarType::Float, \
^~~~~~~~
_ext_src/src/ball_query.cpp:20:20: warning: 'at::DeprecatedTypeProperties& at::Tensor::type() const' is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
if (new_xyz.type().is_cuda()) {
^
In file included from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Tensor.h:11:0,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Context.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/ATen.h:5,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/extension.h:4,
from _ext_src/include/ball_query.h:7,
from _ext_src/src/ball_query.cpp:6:
/usr/local/lib/python3.6/dist-packages/torch/include/ATen/core/TensorBody.h:262:30: note: declared here
DeprecatedTypeProperties & type() const {
^~~~
In file included from _ext_src/src/ball_query.cpp:7:0:
_ext_src/include/utils.h:12:21: warning: 'at::DeprecatedTypeProperties& at::Tensor::type() const' is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor"); \
^
_ext_src/src/ball_query.cpp:21:5: note: in expansion of macro 'CHECK_CUDA'
CHECK_CUDA(xyz);
^
In file included from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Tensor.h:11:0,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Context.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/ATen.h:5,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/extension.h:4,
from _ext_src/include/ball_query.h:7,
from _ext_src/src/ball_query.cpp:6:
/usr/local/lib/python3.6/dist-packages/torch/include/ATen/core/TensorBody.h:262:30: note: declared here
DeprecatedTypeProperties & type() const {
^~~~
In file included from _ext_src/src/ball_query.cpp:7:0:
_ext_src/include/utils.h:12:5: error: 'AT_CHECK' was not declared in this scope
AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor"); \
^
_ext_src/include/utils.h:12:5: note: in definition of macro 'CHECK_CUDA'
AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor"); \
^~~~~~~~
_ext_src/include/utils.h:12:5: note: suggested alternative: 'DCHECK'
AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor"); \
^
_ext_src/include/utils.h:12:5: note: in definition of macro 'CHECK_CUDA'
AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor"); \
^~~~~~~~
_ext_src/src/ball_query.cpp:28:20: warning: 'at::DeprecatedTypeProperties& at::Tensor::type() const' is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
if (new_xyz.type().is_cuda()) {
^
In file included from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Tensor.h:11:0,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Context.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/ATen.h:5,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/extension.h:4,
from _ext_src/include/ball_query.h:7,
from _ext_src/src/ball_query.cpp:6:
/usr/local/lib/python3.6/dist-packages/torch/include/ATen/core/TensorBody.h:262:30: note: declared here
DeprecatedTypeProperties & type() const {
^~~~
_ext_src/src/ball_query.cpp:30:74: warning: 'T* at::Tensor::data() const [with T = float]' is deprecated: Tensor.data<T>() is deprecated. Please use Tensor.data_ptr<T>() instead. [-Wdeprecated-declarations]
radius, nsample, new_xyz.data<float>(),
^
In file included from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Tensor.h:11:0,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Context.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/ATen.h:5,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/extension.h:4,
from _ext_src/include/ball_query.h:7,
from _ext_src/src/ball_query.cpp:6:
/usr/local/lib/python3.6/dist-packages/torch/include/ATen/core/TensorBody.h:341:7: note: declared here
T * data() const {
^~~~
_ext_src/src/ball_query.cpp:31:53: warning: 'T* at::Tensor::data() const [with T = float]' is deprecated: Tensor.data<T>() is deprecated. Please use Tensor.data_ptr<T>() instead. [-Wdeprecated-declarations]
xyz.data<float>(), idx.data<int>());
^
In file included from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Tensor.h:11:0,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Context.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/ATen.h:5,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/extension.h:4,
from _ext_src/include/ball_query.h:7,
from _ext_src/src/ball_query.cpp:6:
/usr/local/lib/python3.6/dist-packages/torch/include/ATen/core/TensorBody.h:341:7: note: declared here
T * data() const {
^~~~
_ext_src/src/ball_query.cpp:31:70: warning: 'T* at::Tensor::data() const [with T = int]' is deprecated: Tensor.data<T>() is deprecated. Please use Tensor.data_ptr<T>() instead. [-Wdeprecated-declarations]
xyz.data<float>(), idx.data<int>());
^
In file included from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Tensor.h:11:0,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Context.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/ATen.h:5,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/extension.h:4,
from _ext_src/include/ball_query.h:7,
from _ext_src/src/ball_query.cpp:6:
/usr/local/lib/python3.6/dist-packages/torch/include/ATen/core/TensorBody.h:341:7: note: declared here
T * data() const {
^~~~
_ext_src/src/ball_query.cpp:33:5: error: 'AT_CHECK' was not declared in this scope
AT_CHECK(false, "CPU not supported");
^~~~~~~~
_ext_src/src/ball_query.cpp:33:5: note: suggested alternative: 'DCHECK'
AT_CHECK(false, "CPU not supported");
^~~~~~~~
DCHECK
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Issue is resolved by downgrading torch installation to version 1.4.0
.
When I change torch to version to 1.4.0, there are other problems as follows:
Traceback (most recent call last):
File "models/votenet.py", line 19, in
from backbone_module import Pointnet2Backbone
File "/home/hll/hllhome/code/votenet/models/backbone_module.py", line 19, in
from pointnet2_modules import PointnetSAModuleVotes, PointnetFPModule
File "/home/hll/hllhome/code/votenet/pointnet2/pointnet2_modules.py", line 21, in
import pointnet2_utils
File "/home/hll/hllhome/code/votenet/pointnet2/pointnet2_utils.py", line 30, in
"Could not import _ext module.\n"
ImportError: Could not import _ext module.
Thanks, After I replaced all the C++ code into python code, the problem was solved.
@houlili1357-9 hello, when you changed the code to python from c++, was there any performance issue found?