Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
54e391c0
Commit
54e391c0
authored
Jun 24, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write profiling results to tensorboard as well. (fix #309)
parent
7f4ca5f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
tensorpack/callbacks/monitor.py
tensorpack/callbacks/monitor.py
+4
-0
tensorpack/callbacks/prof.py
tensorpack/callbacks/prof.py
+12
-2
No files found.
tensorpack/callbacks/monitor.py
View file @
54e391c0
...
...
@@ -6,6 +6,7 @@
import
os
import
numpy
as
np
import
shutil
import
time
import
operator
from
collections
import
defaultdict
import
six
...
...
@@ -142,10 +143,13 @@ class Monitors(TrainingMonitor):
def
put_event
(
self
,
evt
):
"""
Simply call :meth:`put_event` on each monitor.
`step` and `wall_time` fields of this proto will be filled automatically.
Args:
evt (tf.Event):
"""
evt
.
step
=
self
.
global_step
evt
.
wall_time
=
time
.
time
()
self
.
_dispatch
(
lambda
m
:
m
.
put_event
(
evt
))
def
get_latest
(
self
,
name
):
...
...
tensorpack/callbacks/prof.py
View file @
54e391c0
...
...
@@ -89,7 +89,7 @@ class GPUUtilizationTracker(Callback):
break
#
TODO
add more features from tfprof
#
Can
add more features from tfprof
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/tfprof/g3doc/python_api.md
class
GraphProfiler
(
Callback
):
...
...
@@ -106,15 +106,17 @@ class GraphProfiler(Callback):
You probably want to schedule it less frequently by
:class:`PeriodicRunHooks`.
"""
def
__init__
(
self
,
dump_metadata
=
False
,
dump_tracing
=
True
):
def
__init__
(
self
,
dump_metadata
=
False
,
dump_tracing
=
True
,
dump_event
=
False
):
"""
Args:
dump_metadata(bool): Dump :class:`tf.RunMetadata` to be used with tfprof.
dump_tracing(bool): Dump chrome tracing files.
dump_event(bool): Dump to an event processed by FileWriter.
"""
self
.
_dir
=
logger
.
LOG_DIR
self
.
_dump_meta
=
bool
(
dump_metadata
)
self
.
_dump_tracing
=
bool
(
dump_tracing
)
self
.
_dump_event
=
bool
(
dump_event
)
assert
os
.
path
.
isdir
(
self
.
_dir
)
def
_before_run
(
self
,
_
):
...
...
@@ -128,6 +130,8 @@ class GraphProfiler(Callback):
self
.
_write_meta
(
meta
)
if
self
.
_dump_tracing
:
self
.
_write_tracing
(
meta
)
if
self
.
_dump_event
:
self
.
_write_event
(
meta
)
def
_write_meta
(
self
,
metadata
):
fname
=
os
.
path
.
join
(
...
...
@@ -142,3 +146,9 @@ class GraphProfiler(Callback):
with
open
(
fname
,
'w'
)
as
f
:
f
.
write
(
tl
.
generate_chrome_trace_format
(
show_dataflow
=
True
,
show_memory
=
True
))
def
_write_event
(
self
,
metadata
):
evt
=
tf
.
Event
()
evt
.
tagged_run_metadata
.
tag
=
'trace-{}'
.
format
(
self
.
global_step
)
evt
.
tagged_run_metadata
.
run_metadata
=
metadata
.
SerializeToString
()
self
.
trainer
.
monitors
.
put_event
(
evt
)
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