[go: nahoru, domu]

Skip to content

Commit

Permalink
[tfdbg2] Document the need to call set_soft_device_placement(True) on…
Browse files Browse the repository at this point in the history
… TPUs

PiperOrigin-RevId: 312785683
Change-Id: I388cb0a4d0d9eac1005bf4e52d10153d7bcd200f
  • Loading branch information
caisq authored and tensorflower-gardener committed May 22, 2020
1 parent 4ce6280 commit 221af69
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tensorflow/python/debug/lib/check_numerics_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,21 @@ def square_log_x_plus_1(x):
z = tf.matmul(y, y)
```
NOTE: If your code is running on TPUs, be sure to call
`tf.config.set_soft_device_placement(True)` before calling
`tf.debugging.enable_check_numerics()` as this API uses automatic outside
compilation on TPUs. For example:
```py
tf.config.set_soft_device_placement(True)
tf.debugging.enable_check_numerics()
resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu='')
strategy = tf.distribute.experimental.TPUStrategy(resolver)
with strategy.scope():
# ...
```
Args:
stack_height_limit: Limit to the height of the printed stack trace.
Applicable only to ops in `tf.function`s (graphs).
Expand Down
16 changes: 16 additions & 0 deletions tensorflow/python/debug/lib/dumping_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,22 @@ def enable_dump_debug_info(dump_root,
# Code to build, train and run your TensorFlow model...
```
NOTE: If your code is running on TPUs, be sure to call
`tf.config.set_soft_device_placement(True)` before calling
`tf.debugging.experimental.enable_dump_debug_info()` as this API uses
automatic outside compilation on TPUs. For example:
```py
tf.config.set_soft_device_placement(True)
tf.debugging.experimental.enable_dump_debug_info(
logdir, tensor_debug_mode="FULL_HEALTH")
resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu='')
strategy = tf.distribute.experimental.TPUStrategy(resolver)
with strategy.scope():
# ...
```
Args:
dump_root: The directory path where the dumping information will be written.
tensor_debug_mode: Debug mode for tensor values, as a string.
Expand Down

0 comments on commit 221af69

Please sign in to comment.