From b58f7dea8cad15f4668717b91d8d1240bc60dfc1 Mon Sep 17 00:00:00 2001 From: Jonathan Lifflander Date: Tue, 20 Sep 2022 11:30:56 -0700 Subject: [PATCH] #1930: tests: improve tests, align with develop --- tests/perf/make_runnable_micro.cc | 22 +++++++------------ tests/perf/ping_pong.cc | 5 ++--- tests/perf/ping_pong_am.cc | 35 ++++++++++++------------------- tests/perf/reduce.cc | 9 ++++---- 4 files changed, 28 insertions(+), 43 deletions(-) diff --git a/tests/perf/make_runnable_micro.cc b/tests/perf/make_runnable_micro.cc index 414786cfdc..dc184d6e4f 100644 --- a/tests/perf/make_runnable_micro.cc +++ b/tests/perf/make_runnable_micro.cc @@ -2,7 +2,7 @@ //@HEADER // ***************************************************************************** // -// reduce.cc +// make_runnable_micro.cc // DARMA/vt => Virtual Transport // // Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC @@ -40,6 +40,7 @@ // ***************************************************************************** //@HEADER */ + #include "common/test_harness.h" #include #include @@ -68,9 +69,6 @@ struct NodeObj { proxy_ = global_proxy = vt::theObjGroup()->getProxy(this); } - void complete() { - } - void perfMakeRunnable(MyMsg* in_msg) { for (int i = 0; i < num_iters; i++) { msgs.emplace_back(makeMessage()); @@ -78,25 +76,21 @@ struct NodeObj { han = auto_registry::makeAutoHandler(); - theTerm()->any_epoch_state_.incrementDependency(); + theTerm()->disableTD(); test_obj_->StartTimer(fmt::format("makeRunnable {}", num_iters)); perfRunBenchmark(); test_obj_->StopTimer(fmt::format("makeRunnable {}", num_iters)); - theTerm()->any_epoch_state_.decrementDependency(); + theTerm()->enableTD(); } void perfRunBenchmark() { for (int i = 0; i < num_iters; i++) { - { - bool add_context = true; - auto r = runnable::makeRunnable(msgs[i], false, han, 0, add_context) - .withContinuation(nullptr) - .withTag(TagType{0}) - .withTDEpochFromMsg(false); - r.enqueue(); - } + auto r = runnable::makeRunnable(msgs[i], false, han, 0) + .withContinuation(nullptr) + .withTDEpochFromMsg(false); + r.enqueue(); vt::theSched()->runSchedulerOnceImpl(); } } diff --git a/tests/perf/ping_pong.cc b/tests/perf/ping_pong.cc index 0b7c2cf4b4..28194d1c92 100644 --- a/tests/perf/ping_pong.cc +++ b/tests/perf/ping_pong.cc @@ -139,8 +139,7 @@ struct NodeObj { template <> void NodeObj::finishedPing(FinishedPingMsg* msg) { addPerfStats(max_bytes); - - theTerm()->any_epoch_state_.decrementDependency(); + theTerm()->enableTD(); } VT_PERF_TEST(MyTest, test_ping_pong) { @@ -151,7 +150,7 @@ VT_PERF_TEST(MyTest, test_ping_pong) { .invoke(); if (theContext()->getNode() == 0) { - theTerm()->any_epoch_state_.incrementDependency(); + theTerm()->disableTD(); } StartTimer(fmt::format("{} Bytes", min_bytes)); diff --git a/tests/perf/ping_pong_am.cc b/tests/perf/ping_pong_am.cc index d44e6b89a4..a5a881a9d0 100644 --- a/tests/perf/ping_pong_am.cc +++ b/tests/perf/ping_pong_am.cc @@ -2,7 +2,7 @@ //@HEADER // ***************************************************************************** // -// reduce.cc +// ping_pong_am.cc // DARMA/vt => Virtual Transport // // Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC @@ -40,6 +40,7 @@ // ***************************************************************************** //@HEADER */ + #include "common/test_harness.h" #include #include @@ -50,24 +51,21 @@ using namespace vt; using namespace vt::tests::perf::common; -static constexpr int num_iters = 1000; -//static constexpr int num_iters = 1000000; +static constexpr int num_iters = 10000; static int i = 0; struct MyTest : PerfTestHarness { }; struct MyMsg : vt::Message {}; -std::vector> msgs; - struct NodeObj; + vt::objgroup::proxy::Proxy global_proxy; + void handlerFinished(MyMsg* msg); + void handler(MyMsg* in_msg) { - //fmt::print("{} handler\n", theContext()->getNode()); auto msg = makeMessage(); - // auto msg = msgs.back(); - // msgs.pop_back(); theMsg()->sendMsg(0, msg); } @@ -75,19 +73,19 @@ struct NodeObj { struct ReduceMsg : vt::collective::ReduceNoneMsg { }; explicit NodeObj(MyTest* test_obj) : test_obj_(test_obj) { } - void initialize() { proxy_ = global_proxy = vt::theObjGroup()->getProxy(this); } + + void initialize() { + proxy_ = global_proxy = vt::theObjGroup()->getProxy(this); + } void complete() { - fmt::print("{} complete\n", theContext()->getNode()); test_obj_->StopTimer(fmt::format("{} ping-pong", i)); if (theContext()->getNode() == 0) { - theTerm()->any_epoch_state_.decrementDependency(); + theTerm()->enableTD(); } - msgs.clear(); } - + void perfPingPong(MyMsg* in_msg) { - fmt::print("{} perfPingPong\n", theContext()->getNode()); test_obj_->StartTimer(fmt::format("{} ping-pong", i)); auto msg = makeMessage(); theMsg()->sendMsg(1, msg); @@ -101,14 +99,11 @@ struct NodeObj { }; void handlerFinished(MyMsg* msg) { - //fmt::print("{} handlerFinished i={}\n", theContext()->getNode(), i); if (i >= num_iters) { global_proxy[0].invoke(); } else { i++; auto msg = makeMessage(); - // auto msg = msgs.back(); - // msgs.pop_back(); theMsg()->sendMsg(1, msg); } } @@ -119,13 +114,9 @@ VT_PERF_TEST(MyTest, test_ping_pong) { ); if (theContext()->getNode() == 0) { - theTerm()->any_epoch_state_.incrementDependency(); + theTerm()->disableTD(); } - // for (int x = 0; x < num_iters+1; x++) { - // msgs.emplace_back(makeMessage()); - // } - grp_proxy[my_node_].invoke(); if (theContext()->getNode() == 0) { diff --git a/tests/perf/reduce.cc b/tests/perf/reduce.cc index dafe0cebf7..1b8e7e0c23 100644 --- a/tests/perf/reduce.cc +++ b/tests/perf/reduce.cc @@ -50,7 +50,7 @@ using namespace vt; using namespace vt::tests::perf::common; -static constexpr int num_iters = 10; +static constexpr int num_iters = 100; struct MyTest : PerfTestHarness { }; @@ -58,6 +58,7 @@ struct NodeObj { struct ReduceMsg : vt::collective::ReduceNoneMsg { }; explicit NodeObj(MyTest* test_obj) : test_obj_(test_obj) { } + void initialize() { proxy_ = vt::theObjGroup()->getProxy(this); } struct MyMsg : vt::Message {}; @@ -71,10 +72,10 @@ struct NodeObj { auto this_node = theContext()->getNode(); proxy_[this_node].send(); } else if (theContext()->getNode() == 0) { - theTerm()->any_epoch_state_.decrementDependency(); + theTerm()->enableTD(); } } - + void perfReduce(MyMsg* in_msg) { test_obj_->StartTimer(fmt::format("{} reduce", i)); auto cb = theCB()->makeBcast(proxy_); @@ -95,7 +96,7 @@ VT_PERF_TEST(MyTest, test_ping_pong) { ); if (theContext()->getNode() == 0) { - theTerm()->any_epoch_state_.incrementDependency(); + theTerm()->disableTD(); } grp_proxy[my_node_].invoke();