Skip to content

Commit

Permalink
Task #955 Replacement of theTerm()->addAction with runInEpochCollective
Browse files Browse the repository at this point in the history
  • Loading branch information
Braden Mailloux committed Aug 2, 2020
1 parent 31dcbe9 commit 13aa235
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions tests/unit/active/test_active_send.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,19 @@ TEST_F(TestActiveSend, test_type_safe_active_fn_send) {
fmt::print("test_type_safe_active_fn_send: node={}\n", my_node);
#endif

if (my_node == from_node) {
for (int i = 0; i < num_msg_sent; i++) {
#if DEBUG_TEST_HARNESS_PRINT
fmt::print("{}: sendMsg: i={}\n", my_node, i);
#endif
auto msg = makeMessage<TestMsg>();
theMsg()->sendMsg<TestMsg, test_handler>(1, msg.get());
runInEpochCollective([=]{
if (my_node == from_node) {
for (int i = 0; i < num_msg_sent; i++) {
#if DEBUG_TEST_HARNESS_PRINT
fmt::print("{}: sendMsg: i={}\n", my_node, i);
#endif
auto msg = makeMessage<TestMsg>();
theMsg()->sendMsg<TestMsg, test_handler>(1, msg.get());
}
} else if (my_node == to_node) {
EXPECT_EQ(handler_count, num_msg_sent);
}
} else if (my_node == to_node) {
theTerm()->addAction([=]{
EXPECT_EQ(handler_count, num_msg_sent);
});
}
});

// Spin here so test_vec does not go out of scope before the send completes
while (not vt::rt->isTerminated()) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/active/test_pending_send.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TEST_F(TestPendingSend, test_pending_send_hold) {
EXPECT_EQ(envelopeGetEpoch(msg->env), ep);

theMsg()->popEpoch(ep);
theTerm()->addAction(ep, [&done] { done = true; });
runInEpochCollective(ep, [&done] { done = true; });
theTerm()->finishedEpoch(ep);

// It should not break out of this loop because of `done`, thus `k` is used to
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/collection/test_checkpoint.extended.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static void runInEpoch(std::function<void()> fn) {
vt::theMsg()->popEpoch(ep);
vt::theTerm()->finishedEpoch(ep);
bool done = false;
vt::theTerm()->addAction(ep, [&]{ done = true; });
runInEpochCollective(ep, [&]{ done = true; });
vt::theSched()->runSchedulerWhile([&] { return not done; });
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/collection/test_destroy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ TEST_F(TestDestroy, test_destroy_1) {
// ::fmt::print("broadcasting proxy={:x}\n", proxy.getProxy());
proxy.broadcast<WorkMsg,DestroyTest::work>(msg.get());
}
theTerm()->addAction([]{
runInEpochCollective([]{
// ::fmt::print("num destroyed={}\n", num_destroyed);
// Relies on default mapping equally distributing
EXPECT_EQ(num_destroyed, num_elms_per_node);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/collection/test_insert.extended.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ TEST_F(TestInsert, test_insert_sparse_1) {
proxy[i].insert();
}
}
theTerm()->addAction([]{
runInEpochCollective([]{
/// ::fmt::print("num inserted={}\n", num_inserted);
// Relies on default mapping equally distributing
EXPECT_EQ(num_inserted, num_elms_per_node);
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/collectives/test_mpi_collective.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TEST_F(TestMPICollective, test_mpi_collective_1) {
done = true;
});

theTerm()->addAction([&done]{
runInEpochCollective([&done]{
EXPECT_TRUE(done);
});

Expand Down Expand Up @@ -104,7 +104,7 @@ TEST_F(TestMPICollective, test_mpi_collective_2) {
done++;
});

theTerm()->addAction([&done,&bcast_val,&reduce_val_out]{
runInEpochCollective([&done,&bcast_val,&reduce_val_out]{
auto num_nodes = theContext()->getNumNodes();
EXPECT_EQ(done, 3);
EXPECT_EQ(bcast_val, 29);
Expand Down Expand Up @@ -234,7 +234,7 @@ TEST_F(TestMPICollective, test_mpi_collective_4) {

bool finished_spin = false;

theTerm()->addAction(epoch, [&done,&bcast_val,&reduce_val_out,&finished_spin]{
runInEpochCollective(epoch, [&done,&bcast_val,&reduce_val_out,&finished_spin]{
auto num_nodes = theContext()->getNumNodes();
EXPECT_EQ(done, 3);
EXPECT_EQ(bcast_val, 29);
Expand Down

0 comments on commit 13aa235

Please sign in to comment.