Skip to content

Commit 1b55805

Browse files
Avoid unnecessary work.
1 parent 05a58ca commit 1b55805

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

gasnet/seq.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ int main(int argc, char *argv[])
528528
auto &point_rev_deps = state.reverse_dependencies(graph_index, dset, point_index);
529529

530530
if (point >= offset && point < offset + width) {
531+
bool sent = false;
531532
for (auto interval : point_rev_deps) {
532533
for (long dep = interval.first; dep <= interval.second; dep++) {
533534
if (dep < next_offset || dep >= next_offset + next_width) {
@@ -539,9 +540,11 @@ int main(int argc, char *argv[])
539540
GEX_EVENT_GROUP, 0,
540541
(gex_AM_Arg_t)graph.graph_index, (gex_AM_Arg_t)raw_timestep,
541542
(gex_AM_Arg_t)point, (gex_AM_Arg_t)dep));
542-
sends_raw.push_back(std::tuple<long, long, long>(graph.graph_index, raw_timestep, point));
543+
sent = true;
543544
}
544545
}
546+
if (sent)
547+
sends_raw.push_back(std::tuple<long, long, long>(graph.graph_index, raw_timestep, point));
545548
}
546549
}
547550

@@ -558,6 +561,7 @@ int main(int argc, char *argv[])
558561
auto &point_deps = state.dependencies(graph_index, dset, point_index);
559562

560563
if (point >= offset && point < offset + width) {
564+
bool sent = false;
561565
for (auto interval : point_deps) {
562566
for (long dep = interval.first; dep <= interval.second; dep++) {
563567
if (dep < next_field_offset || dep >= next_field_offset + next_field_width) {
@@ -566,9 +570,11 @@ int main(int argc, char *argv[])
566570

567571
CHECK_OK(gex_AM_RequestShort(tm, rank_by_point[graph_index][dep], handlers[1].gex_index, 0,
568572
(gex_AM_Arg_t)graph.graph_index, (gex_AM_Arg_t)war_timestep, (gex_AM_Arg_t)dep));
569-
sends_war.push_back(std::tuple<long, long, long>(graph.graph_index, war_timestep, point));
573+
sent = true;
570574
}
571575
}
576+
if (sent)
577+
sends_war.push_back(std::tuple<long, long, long>(graph.graph_index, war_timestep, point));
572578
}
573579
}
574580
}

0 commit comments

Comments
 (0)