"tests/python/vscode:/vscode.git/clone" did not exist on "02e79a3da9d2dee480f66536f62dd408c1d71266"
Unverified Commit 13124304 authored by Kai Chen's avatar Kai Chen Committed by GitHub
Browse files

Merge pull request #113 from open-mmlab/migrage-collect-env

[refactor]: migrate to use collect_env in mmcv
parents 48011e56 6fd688a8
...@@ -23,9 +23,17 @@ project = 'MMDetection3D' ...@@ -23,9 +23,17 @@ project = 'MMDetection3D'
copyright = '2020-2023, OpenMMLab' copyright = '2020-2023, OpenMMLab'
author = 'MMDetection3D Authors' author = 'MMDetection3D Authors'
version_file = '../mmdet3d/version.py'
def get_version():
with open(version_file, 'r') as f:
exec(compile(f.read(), version_file, 'exec'))
return locals()['__version__']
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
with open('../mmdet3d/VERSION', 'r') as f: release = get_version()
release = f.read().strip()
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
...@@ -43,12 +51,7 @@ extensions = [ ...@@ -43,12 +51,7 @@ extensions = [
autodoc_mock_imports = [ autodoc_mock_imports = [
'cv2', 'matplotlib', 'nuscenes', 'PIL', 'pycocotools', 'pyquaternion', 'cv2', 'matplotlib', 'nuscenes', 'PIL', 'pycocotools', 'pyquaternion',
'terminaltables', 'mmcv', 'mmdet', 'mmdet3d.version', 'terminaltables', 'mmcv', 'mmdet', 'mmdet3d.version', 'mmdet3d.ops'
'mmdet3d.ops.ball_query', 'mmdet3d.ops.furthest_point_sample',
'mmdet3d.ops.gather_points', 'mmdet3d.ops.group_points',
'mmdet3d.ops.interpolate', 'mmdet3d.ops.roiaware_pool3d',
'mmdet3d.ops.spconv', 'mmdet3d.ops.voxel.voxel_layer', 'mmdet3d.ops.iou3d',
'mmdet3d.ops.utils'
] ]
autosectionlabel_prefix_document = True autosectionlabel_prefix_document = True
......
...@@ -97,13 +97,13 @@ class MultiBackbone(nn.Module): ...@@ -97,13 +97,13 @@ class MultiBackbone(nn.Module):
dict[str, list[torch.Tensor]]: Outputs from multiple backbones. dict[str, list[torch.Tensor]]: Outputs from multiple backbones.
- fp_xyz[suffix] (list[torch.Tensor]): The coordinates of - fp_xyz[suffix] (list[torch.Tensor]): The coordinates of
each fp features. each fp features.
- fp_features[suffix] (list[torch.Tensor]): The features - fp_features[suffix] (list[torch.Tensor]): The features
from each Feature Propagate Layers. from each Feature Propagate Layers.
- fp_indices[suffix] (list[torch.Tensor]): Indices of the - fp_indices[suffix] (list[torch.Tensor]): Indices of the
input points. input points.
- hd_feature (torch.Tensor): The aggregation feature - hd_feature (torch.Tensor): The aggregation feature
from multiple backbones. from multiple backbones.
""" """
ret = {} ret = {}
fp_features = [] fp_features = []
......
from mmcv.ops import (RoIAlign, SigmoidFocalLoss, nms, roi_align, from mmcv.ops import (RoIAlign, SigmoidFocalLoss, get_compiler_version,
get_compiling_cuda_version, nms, roi_align,
sigmoid_focal_loss) sigmoid_focal_loss)
from .ball_query import ball_query from .ball_query import ball_query
...@@ -15,7 +16,6 @@ from .roiaware_pool3d import (RoIAwarePool3d, points_in_boxes_batch, ...@@ -15,7 +16,6 @@ from .roiaware_pool3d import (RoIAwarePool3d, points_in_boxes_batch,
points_in_boxes_cpu, points_in_boxes_gpu) points_in_boxes_cpu, points_in_boxes_gpu)
from .sparse_block import (SparseBasicBlock, SparseBottleneck, from .sparse_block import (SparseBasicBlock, SparseBottleneck,
make_sparse_convmodule) make_sparse_convmodule)
from .utils import get_compiler_version, get_compiling_cuda_version
from .voxel import DynamicScatter, Voxelization, dynamic_scatter, voxelization from .voxel import DynamicScatter, Voxelization, dynamic_scatter, voxelization
__all__ = [ __all__ = [
......
# from . import compiling_info
from .compiling_info import get_compiler_version, get_compiling_cuda_version
__all__ = ['get_compiler_version', 'get_compiling_cuda_version']
// modified from
// https://github.com/facebookresearch/detectron2/blob/master/detectron2/layers/csrc/vision.cpp
#include <torch/extension.h>
#ifdef WITH_CUDA
#include <cuda_runtime_api.h>
int get_cudart_version() { return CUDART_VERSION; }
#endif
std::string get_compiling_cuda_version() {
#ifdef WITH_CUDA
std::ostringstream oss;
// copied from
// https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/cuda/detail/CUDAHooks.cpp#L231
auto printCudaStyleVersion = [&](int v) {
oss << (v / 1000) << "." << (v / 10 % 100);
if (v % 10 != 0) {
oss << "." << (v % 10);
}
};
printCudaStyleVersion(get_cudart_version());
return oss.str();
#else
return std::string("not available");
#endif
}
// similar to
// https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/Version.cpp
std::string get_compiler_version() {
std::ostringstream ss;
#if defined(__GNUC__)
#ifndef __clang__
{ ss << "GCC " << __GNUC__ << "." << __GNUC_MINOR__; }
#endif
#endif
#if defined(__clang_major__)
{
ss << "clang " << __clang_major__ << "." << __clang_minor__ << "."
<< __clang_patchlevel__;
}
#endif
#if defined(_MSC_VER)
{ ss << "MSVC " << _MSC_FULL_VER; }
#endif
return ss.str();
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def("get_compiler_version", &get_compiler_version, "get_compiler_version");
m.def("get_compiling_cuda_version", &get_compiling_cuda_version,
"get_compiling_cuda_version");
}
import cv2 from mmcv.utils import collect_env as collect_base_env
import mmcv from mmcv.utils import get_git_hash
import subprocess
import sys
import torch
import torchvision
from collections import defaultdict
from os import path as osp
import mmdet import mmdet
import mmdet3d import mmdet3d
def collect_env(): def collect_env():
"""Collect and print the information of running enviroments.""" """Collect the information of the running environments."""
env_info = {} env_info = collect_base_env()
env_info['sys.platform'] = sys.platform
env_info['Python'] = sys.version.replace('\n', '')
cuda_available = torch.cuda.is_available()
env_info['CUDA available'] = cuda_available
if cuda_available:
from torch.utils.cpp_extension import CUDA_HOME
env_info['CUDA_HOME'] = CUDA_HOME
if CUDA_HOME is not None and osp.isdir(CUDA_HOME):
try:
nvcc = osp.join(CUDA_HOME, 'bin/nvcc')
nvcc = subprocess.check_output(
'"{}" -V | tail -n1'.format(nvcc), shell=True)
nvcc = nvcc.decode('utf-8').strip()
except subprocess.SubprocessError:
nvcc = 'Not Available'
env_info['NVCC'] = nvcc
devices = defaultdict(list)
for k in range(torch.cuda.device_count()):
devices[torch.cuda.get_device_name(k)].append(str(k))
for name, devids in devices.items():
env_info['GPU ' + ','.join(devids)] = name
gcc = subprocess.check_output('gcc --version | head -n1', shell=True)
gcc = gcc.decode('utf-8').strip()
env_info['GCC'] = gcc
env_info['PyTorch'] = torch.__version__
env_info['PyTorch compiling details'] = torch.__config__.show()
env_info['TorchVision'] = torchvision.__version__
env_info['OpenCV'] = cv2.__version__
env_info['MMCV'] = mmcv.__version__
env_info['MMDetection'] = mmdet.__version__ env_info['MMDetection'] = mmdet.__version__
env_info['MMDetection3D'] = mmdet3d.__version__ env_info['MMDetection3D'] = mmdet3d.__version__ + '+' + get_git_hash()[:7]
from mmdet3d.ops import get_compiler_version, get_compiling_cuda_version
env_info['MMDetection3D Compiler'] = get_compiler_version()
env_info['MMDetection3D CUDA Compiler'] = get_compiling_cuda_version()
return env_info return env_info
if __name__ == '__main__': if __name__ == '__main__':
for name, val in collect_env().items(): for name, val in collect_env().items():
print('{}: {}'.format(name, val)) print(f'{name}: {val}')
...@@ -8,6 +8,6 @@ line_length = 79 ...@@ -8,6 +8,6 @@ line_length = 79
multi_line_output = 0 multi_line_output = 0
known_standard_library = setuptools known_standard_library = setuptools
known_first_party = mmdet,mmdet3d known_first_party = mmdet,mmdet3d
known_third_party = cv2,load_scannet_data,lyft_dataset_sdk,m2r,matplotlib,mmcv,nuimages,numba,numpy,nuscenes,pandas,plyfile,pycocotools,pyquaternion,pytest,recommonmark,scannet_utils,scipy,seaborn,shapely,skimage,terminaltables,torch,torchvision,trimesh known_third_party = load_scannet_data,lyft_dataset_sdk,m2r,matplotlib,mmcv,nuimages,numba,numpy,nuscenes,pandas,plyfile,pycocotools,pyquaternion,pytest,recommonmark,scannet_utils,scipy,seaborn,shapely,skimage,terminaltables,torch,trimesh
no_lines_before = STDLIB,LOCALFOLDER no_lines_before = STDLIB,LOCALFOLDER
default_section = THIRDPARTY default_section = THIRDPARTY
...@@ -168,10 +168,6 @@ if __name__ == '__main__': ...@@ -168,10 +168,6 @@ if __name__ == '__main__':
'optional': parse_requirements('requirements/optional.txt'), 'optional': parse_requirements('requirements/optional.txt'),
}, },
ext_modules=[ ext_modules=[
make_cuda_ext(
name='compiling_info',
module='mmdet3d.ops.utils',
sources=['src/compiling_info.cpp']),
make_cuda_ext( make_cuda_ext(
name='sparse_conv_ext', name='sparse_conv_ext',
module='mmdet3d.ops.spconv', module='mmdet3d.ops.spconv',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment