aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/profiler
diff options
context:
space:
mode:
authorGravatar Yuefeng Zhou <yuefengz@google.com>2018-01-17 15:58:10 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-01-17 16:05:19 -0800
commite86fc00d097cb8cc118435ebd464497825bcad1e (patch)
tree2ae34164ad6b3cbd7624efa35423ff66cfe17f2c /tensorflow/core/profiler
parent04121a03acb16645dc0eac327c35a501453d8e8a (diff)
Combine host and device memory proto fields.
PiperOrigin-RevId: 182284426
Diffstat (limited to 'tensorflow/core/profiler')
-rw-r--r--tensorflow/core/profiler/internal/testdata/run_metabin5539 -> 5631 bytes
-rw-r--r--tensorflow/core/profiler/internal/tfprof_node.cc27
2 files changed, 15 insertions, 12 deletions
diff --git a/tensorflow/core/profiler/internal/testdata/run_meta b/tensorflow/core/profiler/internal/testdata/run_meta
index ae76acb743..eaea62b06c 100644
--- a/tensorflow/core/profiler/internal/testdata/run_meta
+++ b/tensorflow/core/profiler/internal/testdata/run_meta
Binary files differ
diff --git a/tensorflow/core/profiler/internal/tfprof_node.cc b/tensorflow/core/profiler/internal/tfprof_node.cc
index 2945c9510f..86cb20de7b 100644
--- a/tensorflow/core/profiler/internal/tfprof_node.cc
+++ b/tensorflow/core/profiler/internal/tfprof_node.cc
@@ -133,18 +133,21 @@ void ExecStep::AddMemoryStats(const string& dev,
exec_mem.set_output_bytes(total_output_bytes);
if (step_stat.has_memory_stats()) {
- exec_mem.set_host_temp_bytes(
- exec_mem.host_temp_bytes() +
- step_stat.memory_stats().host_temp_memory_size());
- exec_mem.set_host_persistent_bytes(
- exec_mem.host_persistent_bytes() +
- step_stat.memory_stats().host_persistent_memory_size());
- exec_mem.set_accelerator_temp_bytes(
- exec_mem.accelerator_temp_bytes() +
- step_stat.memory_stats().device_temp_memory_size());
- exec_mem.set_accelerator_persistent_bytes(
- exec_mem.accelerator_persistent_bytes() +
- step_stat.memory_stats().device_persistent_memory_size());
+ if (IsPlacedOnCPU(dev)) {
+ // Currently we assume ops placed on gpu only allocate memory on gpu.
+ exec_mem.set_host_temp_bytes(exec_mem.host_temp_bytes() +
+ step_stat.memory_stats().temp_memory_size());
+ exec_mem.set_host_persistent_bytes(
+ exec_mem.host_persistent_bytes() +
+ step_stat.memory_stats().persistent_memory_size());
+ } else {
+ exec_mem.set_accelerator_temp_bytes(
+ exec_mem.accelerator_temp_bytes() +
+ step_stat.memory_stats().temp_memory_size());
+ exec_mem.set_accelerator_persistent_bytes(
+ exec_mem.accelerator_persistent_bytes() +
+ step_stat.memory_stats().persistent_memory_size());
+ }
}
// TODO(xpan): Make this more accurate: