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

运行setup.py出现Error compiling objects for extension #12

Open
xhhlll opened this issue Dec 19, 2021 · 1 comment
Open

运行setup.py出现Error compiling objects for extension #12

xhhlll opened this issue Dec 19, 2021 · 1 comment

Comments

@xhhlll
Copy link

xhhlll commented Dec 19, 2021

作者您好!
我运行python setup.py develop时候出现,运行环境cuda11.0 python3.6 pytorch1.7.1 .请问怎么解决呢?
running develop
running egg_info
creating focalloss.egg-info
writing focalloss.egg-info/PKG-INFO
writing dependency_links to focalloss.egg-info/dependency_links.txt
writing top-level names to focalloss.egg-info/top_level.txt
writing manifest file 'focalloss.egg-info/SOURCES.txt'
reading manifest file 'focalloss.egg-info/SOURCES.txt'
writing manifest file 'focalloss.egg-info/SOURCES.txt'
running build_ext
building 'modules.sigmoid_focal_loss.sigmoid_focal_loss_cuda' extension
Emitting ninja build file /home/yyy/音乐/pytorch_solov2-master/build/temp.linux-x86_64-3.6/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/1] /usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/include -I/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/include/TH -I/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/yyy/anaconda3/envs/solo2/include/python3.6m -c -c '/home/yyy/音乐/pytorch_solov2-master/modules/sigmoid_focal_loss/src/sigmoid_cal_loss_cuda.cu' -o '/home/yyy/音乐/pytorch_solov2-master/build/temp.linux-x86_64-3.6/modules/sigmoid_focal_loss/src/sigmoid_focal_loss_cuda.o' -D__CUDA_NO_HALF_OPERATORS__ -D__DA_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=sigmoid_focal_loss_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=sm_86 -std=c++14
FAILED: /home/yyy/音乐/pytorch_solov2-master/build/temp.linux-x86_64-3.6/modules/sigmoid_focal_loss/src/sigmoid_focal_loss_cuda.o
/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/include -I/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/include/TH -I/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/yyy/anaconda3/envs/solo2/include/python3.6m -c -c '/home/yyy/音乐/pytorch_solov2-master/modules/sigmoid_focal_loss/src/sigmoid_focal_ss_cuda.cu' -o '/home/yyy/音乐/pytorch_solov2-master/build/temp.linux-x86_64-3.6/modules/sigmoid_focal_loss/src/sigmoid_focal_loss_cuda.o' -D__CUDA_NO_HALF_OPERATORS
-D__CUDA_NHALF_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=sigmoid_focal_loss_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=sm_86 -std=c++14
nvcc fatal : Unsupported gpu architecture 'compute_86'
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1539, in _run_ninja_build
env=env)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/subprocess.py", line 418, 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 61, in
zip_safe=False)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/setuptools/command/develop.py", line 36, in run
self.install_for_development()
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/setuptools/command/develop.py", line 134, in install_for_development
self.run_command('build_ext')
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 75, in run
_build_ext.run(self)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 670, in build_extensions
build_ext.build_extensions(self)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
_build_ext.build_extension(self, ext)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
depends=ext.depends)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 500, in unix_wrap_ninja_compile
with_cuda=with_cuda)
File "/home/yyy/anaconda3/envs/solo2/lib/python3.6/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/yyy/anaconda3/envs/solo2/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1555, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

@ABlueLight
Copy link
Contributor

@xhhlll 我在rtx2xxx, gtx1xxx上测试过是可以的;你的显卡是什么型号,下面的连接可以参考一下:smile:
安装时要保证cuda的版本与pytorch中对应的cuda版本一致

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