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

#107: Support case with no communications #108

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 31 additions & 29 deletions src/vt-tv/utility/json_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,36 +214,38 @@ std::unique_ptr<Info> JSONReader::parse() {
}
}

auto communications = phase["communications"];
if (communications.is_array()) {
for (auto const& comm : communications) {
auto type = comm["type"];
if (type == "SendRecv") {
auto bytes = comm["bytes"];
auto messages = comm["messages"];

auto from = comm["from"];
auto to = comm["to"];

ElementIDType from_id = from["id"];
ElementIDType to_id = to["id"];

assert(bytes.is_number());
// assert(from.is_number());
// assert(to.is_number());

// fmt::print(" From: {}, to: {}\n", from_id, to_id);

// Object on this rank sent data
auto from_it = objects.find(from_id);
if (from_it != objects.end()) {
from_it->second.addSentCommunications(to_id, bytes);
} else {
auto to_it = objects.find(to_id);
if (to_it != objects.end()) {
to_it->second.addReceivedCommunications(from_id, bytes);
if (phase.count("communications") > 0) {
auto communications = phase["communications"];
if (communications.is_array()) {
for (auto const& comm : communications) {
auto type = comm["type"];
if (type == "SendRecv") {
auto bytes = comm["bytes"];
auto messages = comm["messages"];

auto from = comm["from"];
auto to = comm["to"];

ElementIDType from_id = from["id"];
ElementIDType to_id = to["id"];

assert(bytes.is_number());
// assert(from.is_number());
// assert(to.is_number());

// fmt::print(" From: {}, to: {}\n", from_id, to_id);

// Object on this rank sent data
auto from_it = objects.find(from_id);
if (from_it != objects.end()) {
from_it->second.addSentCommunications(to_id, bytes);
} else {
fmt::print("Warning: Communication {} -> {}: neither sender nor recipient was found in objects.\n", from_id, to_id);
auto to_it = objects.find(to_id);
if (to_it != objects.end()) {
to_it->second.addReceivedCommunications(from_id, bytes);
} else {
fmt::print("Warning: Communication {} -> {}: neither sender nor recipient was found in objects.\n", from_id, to_id);
}
}
}
}
Expand Down
Loading