Import C++ extensions issue
LeopoldACC opened this issue · 0 comments
LeopoldACC commented
Solved by refer to link
hi, @zhijian-liu ,thanks for your sharing code, but when I run the command,it's log stop at the process of import the C++ extensions.
python train.py configs/kitti/frustum/pvcnne.py --devices 0 --evaluate --configs.evaluate.best_checkpoint_path kitti.frustum.pvcnne.pth.tar --configs.evaluate.num_tests [#measurements]
==> loading configs from ['configs/kitti/frustum/pvcnne.py']
I manually traced the stopped time is when it try to import C++extension modules in meters.kitti.frustum.py
import numpy as np
import torch
from modules.frustum import get_box_corners_3d
modules/ball_query.py
import torch
import torch.nn as nn
import modules.functional as F
modules/functional/__init__.py
from modules.functional.ball_query import ball_query
modules/functional/ball_query.py
from torch.autograd import Function
from modules.functional.backend import _backend
Finally,stop at _backend = load()
in modules/functional/backend.py
:
import os
from torch.utils.cpp_extension import load
_src_path = os.path.dirname(os.path.abspath(__file__))
_backend = load(name='_pvcnn_backend',
extra_cflags=['-O3', '-std=c++17'],
sources=[os.path.join(_src_path,'src', f) for f in [
'ball_query/ball_query.cpp',
'ball_query/ball_query.cu',
'grouping/grouping.cpp',
'grouping/grouping.cu',
'interpolate/neighbor_interpolate.cpp',
'interpolate/neighbor_interpolate.cu',
'interpolate/trilinear_devox.cpp',
'interpolate/trilinear_devox.cu',
'sampling/sampling.cpp',
'sampling/sampling.cu',
'voxelization/vox.cpp',
'voxelization/vox.cu',
'bindings.cpp',
]]
)
__all__ = ['_backend']
If I click on keyboard ctrl + c
, it lead to traceback as here:
Traceback (most recent call last):
File "train.py", line 268, in <module>
main()
File "train.py", line 81, in main
configs = prepare()
File "train.py", line 25, in prepare
configs.update_from_modules(*args.configs)
File "/home/gz/Desktop/3DCVcode/segmentation/pvcnn/utils/config.py", line 113, in update_from_modules
importlib.import_module(module)
File "/home/gz/anaconda3/envs/pvc/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/gz/Desktop/3DCVcode/segmentation/pvcnn/configs/kitti/frustum/__init__.py", line 7, in <module>
from meters.kitti import MeterFrustumKitti
File "/home/gz/Desktop/3DCVcode/segmentation/pvcnn/meters/kitti/__init__.py", line 1, in <module>
from meters.kitti.frustum import MeterFrustumKitti
File "/home/gz/Desktop/3DCVcode/segmentation/pvcnn/meters/kitti/frustum.py", line 4, in <module>
from modules.frustum import get_box_corners_3d
File "/home/gz/Desktop/3DCVcode/segmentation/pvcnn/modules/__init__.py", line 1, in <module>
from modules.ball_query import BallQuery
File "/home/gz/Desktop/3DCVcode/segmentation/pvcnn/modules/ball_query.py", line 4, in <module>
import modules.functional as F
File "/home/gz/Desktop/3DCVcode/segmentation/pvcnn/modules/functional/__init__.py", line 1, in <module>
from modules.functional.ball_query import ball_query
File "/home/gz/Desktop/3DCVcode/segmentation/pvcnn/modules/functional/ball_query.py", line 3, in <module>
from modules.functional.backend import _backend
File "/home/gz/Desktop/3DCVcode/segmentation/pvcnn/modules/functional/backend.py", line 6, in <module>
_backend = load(name='_pvcnn_backend',
File "/home/gz/anaconda3/envs/pvc/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1079, in load
return _jit_compile(
File "/home/gz/anaconda3/envs/pvc/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1306, in _jit_compile
baton.wait()
File "/home/gz/anaconda3/envs/pvc/lib/python3.8/site-packages/torch/utils/file_baton.py", line 42, in wait
time.sleep(self.wait_seconds)