Open EricWiener opened 3 years ago
@EricWiener What is your gpu model? It is common to have promlem because RTX 30 series gpus works with cuda 11 or higher. Most of the people does not aware of that
@MBaranPeker I have a Nvidia RTX 2070 8 GB
Anybody have a fix for this? Also running CUDA 11.1, Python3.7, RTX 3090, Pytorch 1.7.0.
Found a fix:
1) change all instances of AT_CHECK
to TORCH_CHECK
inside all the source files inside pointnet2/_ext_src/src and pointnet2/_ext_src/include. This is due to an API change in PyTorch.
2) change pointnet2/setup.py:
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
import glob
import os
_ext_src_root = "_ext_src"
_ext_sources = glob.glob("{}/src/*.cpp".format(_ext_src_root)) + glob.glob(
"{}/src/*.cu".format(_ext_src_root)
)
_ext_headers = glob.glob("{}/include/*".format(_ext_src_root))
headers = "-I" + os.path.join(os.path.dirname(os.path.abspath(__file__)), '_ext_src', 'include')
setup(
name='pointnet2',
ext_modules=[
CUDAExtension(
name='pointnet2._ext',
sources=_ext_sources,
extra_compile_args={
"cxx": ["-O2", headers],
"nvcc": ["-O2", headers]
},
)
],
cmdclass={
'build_ext': BuildExtension
}
)
The issue here is that the extra_compile_args doesn't accept relative paths correctly (probably because the working directory changes). We need to make sure headers is an absolute path.
Found a fix:
- change all instances of
AT_CHECK
toTORCH_CHECK
inside all the source files inside pointnet2/_ext_src/src and pointnet2/_ext_src/include. This is due to an API change in PyTorch.- change pointnet2/setup.py:
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension import glob import os _ext_src_root = "_ext_src" _ext_sources = glob.glob("{}/src/*.cpp".format(_ext_src_root)) + glob.glob( "{}/src/*.cu".format(_ext_src_root) ) _ext_headers = glob.glob("{}/include/*".format(_ext_src_root)) headers = "-I" + os.path.join(os.path.dirname(os.path.abspath(__file__)), '_ext_src', 'include') setup( name='pointnet2', ext_modules=[ CUDAExtension( name='pointnet2._ext', sources=_ext_sources, extra_compile_args={ "cxx": ["-O2", headers], "nvcc": ["-O2", headers] }, ) ], cmdclass={ 'build_ext': BuildExtension } )
The issue here is that the extra_compile_args doesn't accept relative paths correctly (probably because the working directory changes). We need to make sure headers is an absolute path.
I want to ask how to change all instances of AT_CHECK to TORCH_CHECK inside all the source files inside pointnet2/_ext_src/src and pointnet2/_ext_src/include. This is due to an API change in PyTorch?
@EricWiener What is your gpu model? It is common to have promlem because RTX 30 series gpus works with cuda 11 or higher. Most of the people does not aware of that
yes my gpu is RTX 3080, do you know how to run the code in 3080gpu?
Found a fix:
- change all instances of
AT_CHECK
toTORCH_CHECK
inside all the source files inside pointnet2/_ext_src/src and pointnet2/_ext_src/include. This is due to an API change in PyTorch.- change pointnet2/setup.py:
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension import glob import os _ext_src_root = "_ext_src" _ext_sources = glob.glob("{}/src/*.cpp".format(_ext_src_root)) + glob.glob( "{}/src/*.cu".format(_ext_src_root) ) _ext_headers = glob.glob("{}/include/*".format(_ext_src_root)) headers = "-I" + os.path.join(os.path.dirname(os.path.abspath(__file__)), '_ext_src', 'include') setup( name='pointnet2', ext_modules=[ CUDAExtension( name='pointnet2._ext', sources=_ext_sources, extra_compile_args={ "cxx": ["-O2", headers], "nvcc": ["-O2", headers] }, ) ], cmdclass={ 'build_ext': BuildExtension } )
The issue here is that the extra_compile_args doesn't accept relative paths correctly (probably because the working directory changes). We need to make sure headers is an absolute path.
SO Great! thank you!and I success run my code(Imvotenet).
Great! I have solved this problem, my GPU is RTX3080, Pytorch 1.7.1
CUDAExtension( name='pointnet2._ext'
Should be changed to
CUDAExtension( name='pointnet2._ext_src'
I have change all instances of AT_CHECK to TORCH_CHECK, and rewrite setup.py but still got error like this: ext_src/src/group_points.cpp : 28 : 3 : error: expected 'while' before 'at' 28 | at::Tensor output= | ^~ ext_src/src/group_points.cpp : 28 : 3 : error: expected '(' before 'at' 28 | at::Tensor output= | ^~ | ( ext_src/src/group_points.cpp : 28 : 14 : error: expected primary-expression before 'output' 28 | at::Tensor output= | ^~~~~ ext_src/src/group_points.cpp : 28 : 13 : error: expected ')' before 'output' 28 | at::Tensor output= | ~~ ^~~~~ | ) ext_src/src/group_points.cpp : 28 : 13 : error: expected ':' before 'output' 28 | at::Tensor output= | ^~~~~ |
---|
ext_src/src/group_points.cpp : 28 : 14 : error: 'output' was not declared in this scope; did you mean 'c10::attr::output'? 28| at::Tensor output= | ^~~~~ | c10::attr::output
Thanks
Found a fix:
- change all instances of
AT_CHECK
toTORCH_CHECK
inside all the source files inside pointnet2/_ext_src/src and pointnet2/_ext_src/include. This is due to an API change in PyTorch.- change pointnet2/setup.py:
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension import glob import os _ext_src_root = "_ext_src" _ext_sources = glob.glob("{}/src/*.cpp".format(_ext_src_root)) + glob.glob( "{}/src/*.cu".format(_ext_src_root) ) _ext_headers = glob.glob("{}/include/*".format(_ext_src_root)) headers = "-I" + os.path.join(os.path.dirname(os.path.abspath(__file__)), '_ext_src', 'include') setup( name='pointnet2', ext_modules=[ CUDAExtension( name='pointnet2._ext', sources=_ext_sources, extra_compile_args={ "cxx": ["-O2", headers], "nvcc": ["-O2", headers] }, ) ], cmdclass={ 'build_ext': BuildExtension } )
The issue here is that the extra_compile_args doesn't accept relative paths correctly (probably because the working directory changes). We need to make sure headers is an absolute path.
Awesome! worked nicely, Kudos to you!!
That fix works for torch 1.10, thanks a lot!!!
I want to ask how to change all instances of AT_CHECK to TORCH_CHECK inside all the source files inside pointnet2/_ext_src/src and pointnet2/_ext_src/include. This is due to an API change in PyTorch?
@daxiongpro All the mentions in the extension source not the source of pytorch as a whole. Run this in your pointnet2 directiory.
grep -rl AT_CHECK | xargs sed -i 's/AT_CHECK/TORCH_CHECK/g'
Found a fix:
- change all instances of
AT_CHECK
toTORCH_CHECK
inside all the source files inside pointnet2/_ext_src/src and pointnet2/_ext_src/include. This is due to an API change in PyTorch.- change pointnet2/setup.py:
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension import glob import os _ext_src_root = "_ext_src" _ext_sources = glob.glob("{}/src/*.cpp".format(_ext_src_root)) + glob.glob( "{}/src/*.cu".format(_ext_src_root) ) _ext_headers = glob.glob("{}/include/*".format(_ext_src_root)) headers = "-I" + os.path.join(os.path.dirname(os.path.abspath(__file__)), '_ext_src', 'include') setup( name='pointnet2', ext_modules=[ CUDAExtension( name='pointnet2._ext', sources=_ext_sources, extra_compile_args={ "cxx": ["-O2", headers], "nvcc": ["-O2", headers] }, ) ], cmdclass={ 'build_ext': BuildExtension } )
The issue here is that the extra_compile_args doesn't accept relative paths correctly (probably because the working directory changes). We need to make sure headers is an absolute path.
That works for me. Maybe it because that cuda version question, New cuda version uses the TORCH_CHECK instead of the AT_CHECK.
I want to ask how to change all instances of AT_CHECK to TORCH_CHECK inside all the source files inside pointnet2/_ext_src/src and pointnet2/_ext_src/include. This is due to an API change in PyTorch?
@daxiongpro All the mentions in the extension source not the source of pytorch as a whole. Run this in your pointnet2 directiory.
grep -rl AT_CHECK | xargs sed -i 's/AT_CHECK/TORCH_CHECK/g'
operation system is win or Linux?
I want to ask how to change all instances of AT_CHECK to TORCH_CHECK inside all the source files inside pointnet2/_ext_src/src and pointnet2/_ext_src/include. This is due to an API change in PyTorch?
@daxiongpro All the mentions in the extension source not the source of pytorch as a whole. Run this in your pointnet2 directiory.
grep -rl AT_CHECK | xargs sed -i 's/AT_CHECK/TORCH_CHECK/g'
Thank U!
When running:
I get the error:
Here's my
conda list
:If you have any advice, I'd really appreciate it. Please let me know if you need more information.