Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WorkerCacheLogger::RecordRecvTensor #10974

Merged
merged 3 commits into from Jun 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 33 additions & 21 deletions tensorflow/core/distributed_runtime/worker_cache_logger.cc
Expand Up @@ -88,27 +88,39 @@ void WorkerCacheLogger::RecordRecvTensor(int64 step_id, int64 start_usecs,
const string& src_device,
const string& dst_device,
int64 bytes) {
NodeExecStats* ns = new NodeExecStats;
ns->set_node_name("RecvTensor");
string byte_string = strings::StrCat("[", bytes, "B] ");
if (bytes >= 0.1 * 1048576.0) {
byte_string = strings::Printf("[%.1fMB] ", bytes / 1048576.0);
}
ns->set_timeline_label(strings::StrCat(byte_string, tensor_name, " from ",
src_device, " to ", dst_device));
ns->set_all_start_micros(start_usecs);
ns->set_op_start_rel_micros(0);
int64 elapsed = end_usecs - start_usecs;
ns->set_op_end_rel_micros(elapsed);
ns->set_all_end_rel_micros(elapsed);
NodeOutput* no = ns->add_output();
no->set_slot(0);
// TODO(tucker): Maybe set the dimensions too, but then they'll
// need to be passed in.
no->mutable_tensor_description()
->mutable_allocation_description()
->set_requested_bytes(bytes);
Save(dst_device, step_id, ns);
RecordDataTransfer(step_id, start_usecs, end_usecs, tensor_name, src_device,
dst_device, bytes, "", "RecvTensor");
}

void WorkerCacheLogger::RecordDataTransfer(int64 step_id, int64 start_usecs,
int64 end_usecs,
const string& tensor_name,
const string& src_device,
const string& dst_device,
int64 bytes,
const string& details,
const string& transfer_method_name){
NodeExecStats* ns = new NodeExecStats;
ns->set_node_name(transfer_method_name);
string byte_string = strings::StrCat("[", bytes, "B] ");
if (bytes >= 0.1 * 1048576.0) {
byte_string = strings::Printf("[%.1fMB] ", bytes / 1048576.0);
}
ns->set_timeline_label(strings::StrCat(byte_string, tensor_name, " from ",
src_device, " to ", dst_device,
details));
ns->set_all_start_micros(start_usecs);
ns->set_op_start_rel_micros(0);
int64 elapsed = end_usecs - start_usecs;
ns->set_op_end_rel_micros(elapsed);
ns->set_all_end_rel_micros(elapsed);
NodeOutput* no = ns->add_output();
no->set_slot(0);
// TODO(tucker): Maybe set the dimensions too, but then they'll
// need to be passed in.
no->mutable_tensor_description()
->mutable_allocation_description()
->set_requested_bytes(bytes);
Save(dst_device, step_id, ns);
}
} // namespace tensorflow
8 changes: 8 additions & 0 deletions tensorflow/core/distributed_runtime/worker_cache_logger.h
Expand Up @@ -60,6 +60,14 @@ class WorkerCacheLogger {
const string& tensor_name, const string& src_device,
const string& dst_device, int64 bytes);

// Generates a NodeExecStats record with the given data, and saves for
// later retrieval by RetrieveLogs().
void RecordDataTransfer(int64 step_id, int64 start_usecs, int64 end_usecs,
const string& tensor_name, const string& src_device,
const string& dst_device, int64 bytes,
const string& details,
const string& transfer_method_name);

private:
mutex count_mu_;
int32 want_logging_count_ GUARDED_BY(count_mu_) = 0;
Expand Down