Skip to content

Commit

Permalink
#1938: tests: set comparison margin and clean up test
Browse files Browse the repository at this point in the history
  • Loading branch information
stmcgovern committed Feb 14, 2023
1 parent af8b217 commit a4ea3a8
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions tests/unit/scheduler/test_scheduler_timings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@
namespace vt { namespace tests { namespace unit {

struct TestSchedTimings : TestParallelHarness { };
//TODO use TEST_P and have special progress true or false
//make the scheduler run only after it's num_iter

// // Run scheduler every 10 handlers at least
// vt::theConfig()->vt_sched_progress_han = num_iter;
// vt::theConfig()->vt_sched_progress_sec = 0.0;
struct MyMsg : vt::Message {
int ms = 0;
};
Expand All @@ -85,7 +80,7 @@ TEST_F(TestSchedTimings, test_sched_lb) {


for (int i = 0; i < num_iter; i++) {
int time = i*100;
int time = i*50;
v.emplace_back(time, std::make_unique<elm::ElementLBData>());

auto id = elm::ElmIDBits::createCollection(true, this_node);
Expand All @@ -104,21 +99,16 @@ TEST_F(TestSchedTimings, test_sched_lb) {
for (auto& [time, data] : v) {
auto load = 1000.0* data->getLoad(0);
fmt::print("expected time={}, observed time={}\n", time, load);
double margin = 10+ time*0.10;
double margin = 30+ time*0.20;
EXPECT_NEAR(time, load, margin );
}

}

TEST_F(TestSchedTimings, test_sched_msg) {

SET_MIN_NUM_NODES_CONSTRAINT(2);
auto sched = std::make_unique<vt::sched::Scheduler>();


NodeType node = theContext()->getNode();
NodeType target_node = (node + 1) % theContext()->getNumNodes();

int const num_iter = 10;
int const ms_delay = 50;
count = 0;
Expand All @@ -131,7 +121,6 @@ TEST_F(TestSchedTimings, test_sched_msg) {

auto handler = auto_registry::makeAutoHandler<MyMsg, myHandler>();

//theMsg()->sendMsg<MyMsg, myHandler>(target_node, next_msg);
auto maker = vt::runnable::makeRunnable(next_msg, false, handler, 0);

auto runnable = maker.getRunnableImpl();
Expand All @@ -151,7 +140,7 @@ TEST_F(TestSchedTimings, test_sched_msg) {

auto sum_time = num_iter *ms_delay;
fmt::print("expected time={}, observed time={}\n", sum_time, observed_time);
double margin = 10+ sum_time*0.05;
double margin =30+ sum_time*0.2;
EXPECT_NEAR(sum_time, observed_time, margin );

}
Expand Down

0 comments on commit a4ea3a8

Please sign in to comment.