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

#410: Dependent Epochs rewritten #2204

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ccd5afd
#410: epoch: change unused InsertEpoch to DependentEpoch
lifflander Jun 17, 2019
b393469
#410: epoch: add function to bit-combine epoch category bits
lifflander Jun 19, 2019
9a1efe8
#410: termination: add isDep check
lifflander Sep 28, 2023
72fbfec
#410: term: implement dependent epochs
lifflander Jun 20, 2019
5cd8599
#410: test: add release dependent epoch test
lifflander Jun 20, 2019
10147f4
#410: reduce: fix warning
lifflander Oct 12, 2023
1db25fa
#410: epoch: add test, move pending epochs to scheduler
lifflander Oct 12, 2023
a9816c6
#410: epoch: rework deps, objgroup dep epochs, scheduler buffers
lifflander Oct 16, 2023
4de8a74
#410: objgroup: implement objgroup proxy functions for dependent epochs
lifflander Oct 17, 2023
bfdc3f4
#410: collection: add dependent epochs to collections, system message…
lifflander Oct 18, 2023
3c1ac7f
#410: test: add new test for dep epochs and collections
lifflander Aug 16, 2019
cdf69ab
#410: collection: add missing header include
lifflander Oct 18, 2023
9764708
#410: tests: cleanup tests, fix name collison
lifflander Oct 18, 2023
a974aba
#410: tests: fix license
lifflander Oct 18, 2023
3e76af5
#410: tests: fix some small compilation errors
lifflander Oct 18, 2023
3d2b117
#410: collection: switch broadcast after system broadcast to user msg
lifflander Oct 18, 2023
f746269
#410: collection: fix missing system message designation
lifflander Oct 19, 2023
cb2b519
#410: tests: rewrite dep epoch test to fix logic error
lifflander Oct 19, 2023
4b3a9c6
#410: termination: remove unneeded code, cleanup scheduler
lifflander Oct 31, 2023
48f7a8c
#410: termination: cleanup more code---remove unecessary condition
lifflander Oct 31, 2023
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
129 changes: 129 additions & 0 deletions tests/unit/termination/test_term_dep_epoch_active.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/*
//@HEADER
// ************************************************************************
//
// test_term_dep_epoch_active.cc
// vt (Virtual Transport)
// Copyright (C) 2018 NTESS, LLC
//
// Under the terms of Contract DE-NA-0003525 with NTESS, LLC,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact [email protected]
//
// ************************************************************************
//@HEADER
*/

#include <gtest/gtest.h>

#include "test_parallel_harness.h"
#include "data_message.h"

#include "vt/transport.h"
#include "vt/messaging/collection_chain_set.h"

namespace vt { namespace tests { namespace unit {

using namespace vt;
using namespace vt::tests::unit;

struct TestTermDepEpochActive : TestParallelHarness { };

struct TestMsg : vt::Message { };

struct TestDep {
static void depHandler(TestMsg* msg) {
//auto const& node = theContext()->getNode();
num_dep++;
//fmt::print("{}: depHandler: num_dep={}\n", node, num_dep);
EXPECT_EQ(num_non_dep, 1);
}

static void nonDepHandler(TestMsg* msg) {
//auto const& node = theContext()->getNode();
num_non_dep++;
//fmt::print("{}: nonDepHandler: num_non_dep={}\n", node, num_non_dep);
EXPECT_EQ(num_dep, 0);
}

static int num_dep;
static int num_non_dep;
};

/*static*/ int TestDep::num_dep = 0;
/*static*/ int TestDep::num_non_dep = 0;

TEST_F(TestTermDepEpochActive, test_term_dep_epoch_active) {
auto const& this_node = theContext()->getNode();
auto const& num_nodes = theContext()->getNumNodes();
bool const bcast = true;
int const k = 10;

TestDep::num_dep = 0;
TestDep::num_non_dep = 0;
vt::theCollective()->barrier();

auto epoch = vt::theTerm()->makeEpochCollectiveDep();
vt::theMsg()->pushEpoch(epoch);
if (bcast) {
for (int i = 0; i < k; i++) {
auto msg = vt::makeSharedMessage<TestMsg>();
vt::theMsg()->broadcastMsg<TestMsg, TestDep::depHandler>(msg);
}
} else {
}
vt::theMsg()->popEpoch(epoch);
vt::theTerm()->finishedEpoch(epoch);

auto chain = std::make_unique<vt::messaging::CollectionChainSet<NodeType>>();
chain->addIndex(this_node);

chain->nextStep([=](NodeType node) {
auto const next = this_node + 1 < num_nodes ? this_node + 1 : 0;
auto msg = vt::makeSharedMessage<TestMsg>();
return vt::theMsg()->sendMsg<TestMsg, TestDep::nonDepHandler>(next,msg);
});

chain->nextStep([=](NodeType node) {
auto msg = vt::makeMessage<TestMsg>();
return vt::messaging::PendingSend(msg, [=](MsgVirtualPtr<vt::BaseMsgType>){
EXPECT_EQ(TestDep::num_dep, 0);
theTerm()->releaseEpoch(epoch);
});
});

vt::theTerm()->addAction([=]{
EXPECT_EQ(TestDep::num_non_dep, 1);
EXPECT_EQ(TestDep::num_dep, (num_nodes - 1)*k);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of the style choice of having the scheduler run and the test assertions get checked as a result of running to quiescence as the process is finishing up. If nothing else, it makes for really funky looking stack traces if/when an assertion fails.

}

}}} // end namespace vt::tests::unit