Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
mmdetection3d
Commits
5c5e43b3
"tests/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "824cb538b1142e0ca9b7df94e5e6ee100e996109"
Commit
5c5e43b3
authored
Sep 18, 2020
by
zhangwenwei
Browse files
[refactor]: migrate to use collect_env in mmcv
parent
50b6bbb3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
120 deletions
+7
-120
mmdet3d/ops/utils/__init__.py
mmdet3d/ops/utils/__init__.py
+0
-4
mmdet3d/ops/utils/src/compiling_info.cpp
mmdet3d/ops/utils/src/compiling_info.cpp
+0
-56
mmdet3d/utils/collect_env.py
mmdet3d/utils/collect_env.py
+6
-55
setup.cfg
setup.cfg
+1
-1
setup.py
setup.py
+0
-4
No files found.
mmdet3d/ops/utils/__init__.py
deleted
100644 → 0
View file @
50b6bbb3
# from . import compiling_info
from
.compiling_info
import
get_compiler_version
,
get_compiling_cuda_version
__all__
=
[
'get_compiler_version'
,
'get_compiling_cuda_version'
]
mmdet3d/ops/utils/src/compiling_info.cpp
deleted
100644 → 0
View file @
50b6bbb3
// 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"
);
}
mmdet3d/utils/collect_env.py
View file @
5c5e43b3
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
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
[
'MMDetection'
]
=
mmdet
.
__version__
+
'+'
+
get_git_hash
()[:
7
]
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
[
'MMDetection3D'
]
=
mmdet3d
.
__version__
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
}
'
)
setup.cfg
View file @
5c5e43b3
...
@@ -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
setup.py
View file @
5c5e43b3
...
@@ -232,10 +232,6 @@ if __name__ == '__main__':
...
@@ -232,10 +232,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'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment