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
d6789862
Unverified
Commit
d6789862
authored
Jul 08, 2020
by
Cao Yuhang
Committed by
GitHub
Jul 08, 2020
Browse files
fix mem cal bug (#398)
parent
d5cbf7ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
mmcv/runner/hooks/logger/text.py
mmcv/runner/hooks/logger/text.py
+3
-2
No files found.
mmcv/runner/hooks/logger/text.py
View file @
d6789862
...
@@ -50,10 +50,11 @@ class TextLoggerHook(LoggerHook):
...
@@ -50,10 +50,11 @@ class TextLoggerHook(LoggerHook):
self
.
_dump_log
(
runner
.
meta
,
runner
)
self
.
_dump_log
(
runner
.
meta
,
runner
)
def
_get_max_memory
(
self
,
runner
):
def
_get_max_memory
(
self
,
runner
):
mem
=
torch
.
cuda
.
max_memory_allocated
()
device
=
runner
.
model
.
output_device
mem
=
torch
.
cuda
.
max_memory_allocated
(
device
=
device
)
mem_mb
=
torch
.
tensor
([
mem
/
(
1024
*
1024
)],
mem_mb
=
torch
.
tensor
([
mem
/
(
1024
*
1024
)],
dtype
=
torch
.
int
,
dtype
=
torch
.
int
,
device
=
torch
.
device
(
'cuda'
)
)
device
=
device
)
if
runner
.
world_size
>
1
:
if
runner
.
world_size
>
1
:
dist
.
reduce
(
mem_mb
,
0
,
op
=
dist
.
ReduceOp
.
MAX
)
dist
.
reduce
(
mem_mb
,
0
,
op
=
dist
.
ReduceOp
.
MAX
)
return
mem_mb
.
item
()
return
mem_mb
.
item
()
...
...
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