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
MMCV
Commits
add54aa4
Commit
add54aa4
authored
Jun 05, 2023
by
xiabo
Browse files
适配版本号
parent
fafab5d2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
mmcv/version.py
mmcv/version.py
+1
-1
setup.py
setup.py
+25
-3
No files found.
mmcv/version.py
View file @
add54aa4
...
@@ -30,6 +30,6 @@ def parse_version_info(version_str: str, length: int = 4) -> tuple:
...
@@ -30,6 +30,6 @@ def parse_version_info(version_str: str, length: int = 4) -> tuple:
return
tuple
(
release
)
return
tuple
(
release
)
version_info
=
tuple
(
int
(
x
)
for
x
in
__version__
.
split
(
"+"
)[
0
].
split
(
'.'
)[:
3
])
version_info
=
tuple
(
int
(
x
)
for
x
in
__version__
.
split
(
'.'
)[:
3
])
__all__
=
[
'__version__'
,
'version_info'
,
'parse_version_info'
]
__all__
=
[
'__version__'
,
'version_info'
,
'parse_version_info'
]
setup.py
View file @
add54aa4
...
@@ -45,6 +45,17 @@ def get_sha(pytorch_root: Union[str, Path]) -> str:
...
@@ -45,6 +45,17 @@ def get_sha(pytorch_root: Union[str, Path]) -> str:
return
'Unknown'
return
'Unknown'
def
get_abi
():
try
:
command
=
"echo '#include <string>' | gcc -x c++ -E -dM - | fgrep _GLIBCXX_USE_CXX11_ABI"
result
=
subprocess
.
run
(
command
,
shell
=
True
,
capture_output
=
True
,
text
=
True
)
output
=
result
.
stdout
.
strip
()
abi
=
"abi"
+
output
.
split
(
" "
)[
-
1
]
return
abi
except
Exception
:
return
'abiUnknown'
def
get_version_add
(
sha
:
Optional
[
str
]
=
None
)
->
str
:
def
get_version_add
(
sha
:
Optional
[
str
]
=
None
)
->
str
:
version
=
''
version
=
''
mmcv_root
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
mmcv_root
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
...
@@ -54,9 +65,20 @@ def get_version_add(sha: Optional[str] = None) -> str:
...
@@ -54,9 +65,20 @@ def get_version_add(sha: Optional[str] = None) -> str:
sha
=
get_sha
(
mmcv_root
)
sha
=
get_sha
(
mmcv_root
)
version
=
'git'
+
sha
[:
7
]
version
=
'git'
+
sha
[:
7
]
if
os
.
getenv
(
'MMCV_BUILD_VERSION'
):
# abi
version_dtk
=
os
.
getenv
(
'MMCV_BUILD_VERSION'
,
""
)
version
+=
"."
+
get_abi
()
version
+=
"."
+
version_dtk
# dtk version
if
os
.
getenv
(
"ROCM_PATH"
):
rocm_path
=
os
.
getenv
(
'ROCM_PATH'
,
""
)
rocm_version_path
=
os
.
path
.
join
(
rocm_path
,
'.info'
,
"rocm_version"
)
with
open
(
rocm_version_path
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
lines
=
file
.
readlines
()
rocm_version
=
lines
[
0
][:
-
2
].
replace
(
"."
,
""
)
version
+=
".dtk"
+
rocm_version
# torch version
version
+=
".torch"
+
torch
.
__version__
[:
4
]
lines
=
[]
lines
=
[]
with
open
(
add_version_path
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
with
open
(
add_version_path
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
...
...
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