Commit 0819d46a authored by Wenzhe Xue's avatar Wenzhe Xue Committed by Scott Cyphers

add rank id to trace file name (#3525)

parent 70c65796
......@@ -18,6 +18,7 @@
#include <sstream>
#include <string>
#include "distributed.hpp"
#include "event_tracing.hpp"
#include "nlohmann/json.hpp"
......@@ -42,7 +43,15 @@ void ngraph::Event::write_trace(const ngraph::Event& event)
if (!so_initialized)
{
// Open the file
s_event_log.open("ngraph_event_trace.json", ios_base::trunc);
std::string file_name = "ngraph_event_trace.json";
if (get_distributed_interface()->get_size() > 1)
{
auto rank = std::to_string(get_distributed_interface()->get_rank());
int num_zero = 3;
std::string prefix = std::string(num_zero - rank.length(), '0') + rank + "_";
file_name.insert(0, prefix);
}
s_event_log.open(file_name, ios_base::trunc);
s_event_log << "[\n";
so_initialized = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment