Skip to content

Commit

Permalink
Merge pull request #108 from DARMA-tasking/107-support-case-with-no-c…
Browse files Browse the repository at this point in the history
…ommunications

#107: Support case with no communications
  • Loading branch information
cwschilly authored Aug 14, 2024
2 parents f024e75 + 729fed5 commit d1e50fb
Showing 1 changed file with 31 additions and 29 deletions.
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

0 comments on commit d1e50fb

Please sign in to comment.