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
Megatron-LM
Commits
24b7c3c0
Commit
24b7c3c0
authored
Jul 12, 2021
by
Lawrence McAfee
Browse files
added memory stats (allocated/reserved) to tensorboard logging
parent
90e0a0dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
megatron/arguments.py
megatron/arguments.py
+4
-0
megatron/training.py
megatron/training.py
+17
-0
No files found.
megatron/arguments.py
View file @
24b7c3c0
...
...
@@ -328,6 +328,10 @@ def _add_logging_args(parser):
action
=
'store_true'
,
help
=
'If set, write validation perplexity to '
'tensorboard.'
)
group
.
add_argument
(
'--no-log-memory-to-tensorboard'
,
action
=
'store_false'
,
help
=
'Disable memory logging to tensorboard.'
,
dest
=
'log_memory_to_tensorboard'
)
return
parser
...
...
megatron/training.py
View file @
24b7c3c0
...
...
@@ -531,6 +531,23 @@ def training_log(loss_dict, total_loss_dict, learning_rate, iteration,
if
args
.
log_timers_to_tensorboard
:
timers
.
write
(
timers_to_log
,
writer
,
iteration
,
normalizer
=
total_iterations
)
if
args
.
log_memory_to_tensorboard
:
mem_stats
=
torch
.
cuda
.
memory_stats
()
writer
.
add_scalar
(
"mem-reserved-bytes"
,
mem_stats
[
"reserved_bytes.all.current"
],
iteration
,
)
writer
.
add_scalar
(
"mem-allocated-bytes"
,
mem_stats
[
"allocated_bytes.all.current"
],
iteration
,
)
writer
.
add_scalar
(
"mem-allocated-count"
,
mem_stats
[
"allocation.all.current"
],
iteration
,
)
if
iteration
%
args
.
log_interval
==
0
:
elapsed_time
=
timers
(
'interval-time'
).
elapsed
()
...
...
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