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
395786db
Commit
395786db
authored
Oct 29, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix build and update docs
parent
6f55416f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
docs/tutorial/performance-tuning.md
docs/tutorial/performance-tuning.md
+16
-3
examples/GAN/GAN.py
examples/GAN/GAN.py
+2
-2
No files found.
docs/tutorial/performance-tuning.md
View file @
395786db
...
@@ -47,14 +47,27 @@ know the reason and improve it accordingly, e.g.:
...
@@ -47,14 +47,27 @@ know the reason and improve it accordingly, e.g.:
## Improve TensorFlow
## Improve TensorFlow
When you're sure that data is not a bottleneck (e.g. when queue is always full), you can start to
worry about the model.
You can add a
`GraphProfiler`
callback when benchmarking the graph. It will
You can add a
`GraphProfiler`
callback when benchmarking the graph. It will
dump runtime tracing information (to either TensorBoard or chrome) to help diagnose the issue.
dump runtime tracing information (to either TensorBoard or chrome) to help diagnose the issue.
Usually there isn't much you can do if a TF op is slow, except to optimize the kernels.
### Slow with single-GPU
This is literally saying TF ops are slow. Usually there isn't much you can do, except to optimize the kernels.
But there may be something cheap you can try:
But there may be something cheap you can try:
1.
You can visualize copies across devices in chrome.
1.
You can visualize copies across devices in chrome.
It may help to change device placement to avoid copies.
It may help to change device placement to avoid
some CPU-GPU
copies.
It may help to replace some CPU-only ops with equivalent GPU ops to avoid copies.
It may help to replace some CPU-only ops with equivalent GPU ops to avoid copies.
2.
Sometimes there are several mathematically equivalent ways of writing the same model
2.
Sometimes there are several mathematically equivalent ways of writing the same model
with different speed.
with different ops and therefore different speed.
### Cannot scale to multi-GPU
If you're unable to scale to multiple GPUs almost linearly:
1.
First make sure that the ResNet example can scale. Run it with
`--fake`
to use fake data.
2.
Then note that your model may have a different communication-computation pattern.
Changing different multi-GPU trainers may affect the speed significantly sometimes.
Note that scalibility measurement always trains with the same "batch size per GPU", not the same total equivalent batch size.
examples/GAN/GAN.py
View file @
395786db
...
@@ -7,8 +7,8 @@ import tensorflow as tf
...
@@ -7,8 +7,8 @@ import tensorflow as tf
import
numpy
as
np
import
numpy
as
np
import
time
import
time
from
tensorpack
import
(
TowerTrainer
,
QueueInput
,
from
tensorpack
import
(
TowerTrainer
,
QueueInput
,
ModelDescBase
,
DataFlow
,
StagingInput
,
ModelDescBase
,
DataFlow
,
StagingInput
)
TowerContext
,
TowerFuncWrapper
)
from
tensorpack.tfutils.tower
import
TowerContext
,
TowerFuncWrapper
from
tensorpack.graph_builder
import
DataParallelBuilder
,
LeastLoadedDeviceSetter
from
tensorpack.graph_builder
import
DataParallelBuilder
,
LeastLoadedDeviceSetter
from
tensorpack.tfutils.summary
import
add_moving_summary
from
tensorpack.tfutils.summary
import
add_moving_summary
from
tensorpack.utils.argtools
import
memoized
from
tensorpack.utils.argtools
import
memoized
...
...
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