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

Import Error mmdet/ops/dcn/deform_conv_cuda/ undefined symbol: _ZNSt15__exception_ptr13exception_ptr9_M_addrefEv #61

Open
hiepbk opened this issue Apr 19, 2024 · 1 comment

Comments

@hiepbk
Copy link

hiepbk commented Apr 19, 2024

Hi,
Thanks for great work.
I tried to run cityscape_demo.py in tools and got this error.
Traceback (most recent call last):
File "cityscapes_demo.py", line 15, in
from mmdet.apis import (
File "/home/deltax/EfficientPS/mmdet/apis/init.py", line 1, in
from .inference import (async_inference_detector, inference_detector,
File "/home/deltax/EfficientPS/mmdet/apis/inference.py", line 11, in
from mmdet.core import get_classes
File "/home/deltax/EfficientPS/mmdet/core/init.py", line 7, in
from .post_processing import * # noqa: F401, F403
File "/home/deltax/EfficientPS/mmdet/core/post_processing/init.py", line 1, in
from .bbox_nms import multiclass_nms
File "/home/deltax/EfficientPS/mmdet/core/post_processing/bbox_nms.py", line 3, in
from mmdet.ops.nms import nms_wrapper
File "/home/deltax/EfficientPS/mmdet/ops/init.py", line 2, in
from .conv import build_conv_layer
File "/home/deltax/EfficientPS/mmdet/ops/conv.py", line 4, in
from .dcn import DeformConvPack, ModulatedDeformConvPack
File "/home/deltax/EfficientPS/mmdet/ops/dcn/init.py", line 1, in
from .deform_conv import (DeformConv, DeformConvPack, ModulatedDeformConv,
File "/home/deltax/EfficientPS/mmdet/ops/dcn/deform_conv.py", line 11, in
from . import deform_conv_cuda
ImportError: /home/deltax/EfficientPS/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZNSt15__exception_ptr13exception_ptr9_M_addrefEv

My conda env was built with Python 3.7, Pytorch 1.7.1+cud110.
I'm using RTX 3060 with cuda 11.6, ubuntu 22.04.
It was successfully built efficientNet and mmdet source when I run python setup.py develop.
I could see some .so files were generated in the mmdet/ops.
I searched some solution, this issue might come from new GPU like RTX 3060 could not work with old version of mmdet.
How can I solve this issues ?

@hiepbk
Copy link
Author

hiepbk commented Apr 19, 2024

I solved this problem:

  • Firstly, the Cuda version in host ubuntu and conda env should be same (in my case is cuda 11.0). I have some problems when I install cuda 11.0 in Ubuntu 22.04 because the default GCC version of Ubuntu 22.04 is GCC-11, and cuda 11.0 just supports the maximum version of GCC 9. So I need to change GCC 11 to GCC 9. Refer Using multiple G++. Then I could install cuda11.0 properly. Remember to change your cuda path in ~/.bashrc to 11.0 and source it again.
  • After installing cuda 11.0. If you use the RTX series, you might encounter the issues of nvcc fatal : Unsupported gpu architecture 'compute_86' when you run install setup.py develop. The solution is comment line 1441 in cpp_extension of pytorch package -> go to your python compiler directory, for example /home/user/miniconda3/envs/your_env/lib/python3.7/site-packages/torch/include/torch/extension.h, and comment this line flags.append('-gencode=arch=compute_{},code=sm_{}'.format(num, num))

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

1 participant