diff --git a/docs/md/active-messenger.md b/docs/md/active-messenger.md index 8d5e9baa9a..5bb07cfde5 100644 --- a/docs/md/active-messenger.md +++ b/docs/md/active-messenger.md @@ -49,14 +49,14 @@ struct MyMsg : vt::Message { // Active function pointer void myHandler(MyMsg* m) { - vt::NodeType this_node = vt::theContext()->getNode(); + vt::NodeT this_node = vt::theContext()->getNode(); fmt::print("{}: val={}, vec size={}\n", this_node, m->val, m->my_vec.size()); } // Active functor struct MyFunctor { void operator()(MyMsg* m) { - vt::NodeType this_node = vt::theContext()->getNode(); + vt::NodeT this_node = vt::theContext()->getNode(); fmt::print("{}: val={}, vec size={}\n", this_node, m->val, m->my_vec.size()); } }; @@ -64,9 +64,9 @@ struct MyFunctor { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); + vt::NodeT this_node = vt::theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { // spins in scheduler until termination of the enclosed work vt::runInEpochRooted([=]{ std::vector vec_to_send; @@ -74,10 +74,10 @@ int main(int argc, char** argv) { vec_to_send.push_back(54.); auto msg = vt::makeMessage(10, vec_to_send); - vt::theMsg()->sendMsg(1, msg); // send to node 1 + vt::theMsg()->sendMsg(vt::NodeT{1}, msg); // send to node 1 auto msg2 = vt::makeMessage(11, vec_to_send); - vt::theMsg()->sendMsg(1, msg2); // send to node 1 + vt::theMsg()->sendMsg(vt::NodeT{1}, msg2); // send to node 1 }); } diff --git a/docs/md/collection.md b/docs/md/collection.md index 3c4cff989e..c9db519c11 100644 --- a/docs/md/collection.md +++ b/docs/md/collection.md @@ -73,7 +73,7 @@ template argument to `.mapperFunc()`, where `my_map` has the following definition (shown for a 1-dimensional collection): \code{.cpp} -vt::NodeType my_map(vt::Index1D* idx, vt::Index1D* bounds, vt::NodeType num_nodes) { +vt::NodeT my_map(vt::Index1D* idx, vt::Index1D* bounds, vt::NodeT num_nodes) { return idx->x() % num_nodes; } \endcode @@ -85,7 +85,7 @@ group instance that already exists by passing the proxy to it. Otherwise, one may just give the type and constructor arguments to create a new instance: `.mapperObjGroupConstruct(args...)`. An object group mapper must inherit from `vt::mapping::BaseMapper` and implement the pure virtual method -`NodeType map(IdxT* idx, int ndim, NodeType num_nodes)` to define the mapping +`NodeT map(IdxT* idx, int ndim, NodeT num_nodes)` to define the mapping for the runtime. As an example, the object group mapper used by default for unbounded collections is implemented as follows: @@ -97,7 +97,7 @@ struct UnboundedDefaultMap : vt::mapping::BaseMapper { return proxy.getProxy(); } - NodeType map(IdxT* idx, int ndim, NodeType num_nodes) override { + NodeT map(IdxT* idx, int ndim, NodeT num_nodes) override { typename IdxT::DenseIndexType val = 0; for (int i = 0; i < ndim; i++) { val ^= idx->get(i); @@ -157,8 +157,8 @@ collective interface): auto range = vt::Index1D(num_elms); auto token = proxy.beginModification(); for (int i = 0; i < range.x() / 2; i++) { - if (i % num_nodes == this_node) { - proxy[i].insertAt(token, i % 2); + if (vt::NodeT{i} % num_nodes == this_node) { + proxy[i].insertAt(token, vt::NodeT{i % 2}); } } proxy.finishModification(std::move(token)); diff --git a/docs/md/collective.md b/docs/md/collective.md index 2f43253e5b..ad2566c35a 100644 --- a/docs/md/collective.md +++ b/docs/md/collective.md @@ -53,7 +53,7 @@ int main(int argc, char** argv) { auto reduce_msg = vt::makeMessage(50); - NodeType const root_reduce_node = 0; + NodeT const root_reduce_node = 0; vt::theCollective()->global()->reduce,ReduceResult>( root_reduce_node, reduce_msg.get() ); diff --git a/docs/md/context.md b/docs/md/context.md index a7f97260f8..19b7e18802 100644 --- a/docs/md/context.md +++ b/docs/md/context.md @@ -18,7 +18,7 @@ provides the MPI communicator that an instance of \vt is currently using. To get the current node, one may query this method: \code{.cpp} -vt::NodeType this_node = vt::theContext()->getNode(); +vt::NodeT this_node = vt::theContext()->getNode(); \endcode \subsection get-num-nodes Number of nodes/ranks @@ -29,7 +29,7 @@ To get the number of nodes or ranks that an instance of \vt is using, one may query this method: \code{.cpp} -vt::NodeType num_nodes = vt::theContext()->getNumNodes(); +vt::NodeT num_nodes = vt::theContext()->getNumNodes(); \endcode \note The result from \c getNode or \c getNumNodes will depend on the diff --git a/docs/md/vt.md b/docs/md/vt.md index a9c4064320..9548ef423f 100644 --- a/docs/md/vt.md +++ b/docs/md/vt.md @@ -78,12 +78,12 @@ management. bool done = false; struct HelloMsg : vt::Message { - HelloMsg(vt::NodeType in_from) : from(in_from) { } - vt::NodeType from = 0; + HelloMsg(vt::NodeT in_from) : from(in_from) { } + vt::NodeT from = 0; }; void hello_world(HelloMsg* msg) { - vt::NodeType this_node = vt::theContext()->getNode(); + vt::NodeT this_node = vt::theContext()->getNode(); fmt::print("{}: Hello from node {}\n", this_node, msg->from); done = true; } @@ -91,10 +91,10 @@ management. int main(int argc, char** argv) { vt::initialize(argc, arv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + vt::NodeT this_node = vt::theContext()->getNode(); + vt::NodeT num_nodes = vt::theContext()->getNumNodes(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto msg = vt::makeMessage(this_node); vt::theMsg()->broadcastMsg(msg); done = true; diff --git a/examples/callback/callback.cc b/examples/callback/callback.cc index 316ddb0090..76c19a2861 100644 --- a/examples/callback/callback.cc +++ b/examples/callback/callback.cc @@ -84,7 +84,7 @@ void hello_world(HelloMsg* msg) { } void printOutput(TestMsg* msg, std::string type) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print("{}: cb {}: val={}, str={}\n", this_node, type, msg->val_, msg->s_); } @@ -116,16 +116,16 @@ void colHan(MyCol* col, TestMsg* msg) { void bounceCallback(vt::Callback cb) { auto msg = vt::makeMessage(cb); - vt::theMsg()->sendMsg(1, msg); + vt::theMsg()->sendMsg(vt::NodeT{1}, msg); } int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return vt::rerror("requires at least 2 nodes"); } @@ -135,8 +135,8 @@ int main(int argc, char** argv) { .bulkInsert() .wait(); - if (this_node == 0) { - vt::NodeType dest = num_nodes > 2 ? 2 : 0; + if (this_node == vt::NodeT{0}) { + vt::NodeT dest = num_nodes > vt::NodeT{2} ? vt::NodeT{2} : vt::NodeT{0}; auto cb_functor = vt::theCB()->makeSend(dest); bounceCallback(cb_functor); diff --git a/examples/callback/callback_context.cc b/examples/callback/callback_context.cc index f2fbb4fe07..2f8573c9a9 100644 --- a/examples/callback/callback_context.cc +++ b/examples/callback/callback_context.cc @@ -103,9 +103,9 @@ int main(int argc, char** argv) { return 0; } - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { my_global_ctx.x = 1283; // Make a callback that triggers the callback with a context @@ -114,7 +114,7 @@ int main(int argc, char** argv) { ); auto const default_proxy = vt::theObjGroup()->getDefault(); - default_proxy[1].send(cb); + default_proxy[vt::NodeT{1}].send(cb); } vt::finalize(); diff --git a/examples/collection/insertable_collection.cc b/examples/collection/insertable_collection.cc index f1f16c4d34..8c1ab69779 100644 --- a/examples/collection/insertable_collection.cc +++ b/examples/collection/insertable_collection.cc @@ -47,7 +47,7 @@ static constexpr int32_t const default_num_elms = 64; struct InsertCol : vt::Collection { InsertCol() { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); ::fmt::print("{}: constructing: idx={}\n", this_node, getIndex().x()); } }; @@ -60,8 +60,8 @@ int main(int argc, char** argv) { return 0; } - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); int32_t num_elms = default_num_elms; if (argc > 1) { @@ -77,8 +77,8 @@ int main(int argc, char** argv) { auto token = proxy.beginModification(); for (int i = 0; i < range.x() / 2; i++) { - if (i % num_nodes == this_node) { - proxy[i].insertAt(token, i % 2); + if (vt::NodeT{i} % num_nodes == this_node) { + proxy[i].insertAt(token, vt::NodeT{i % 2}); } } @@ -90,8 +90,8 @@ int main(int argc, char** argv) { auto token = proxy.beginModification(); for (int i = range.x()/2; i < range.x(); i++) { - if (i % num_nodes == this_node) { - proxy[i].insertAt(token, i % 2); + if (vt::NodeT{i} % num_nodes == this_node) { + proxy[i].insertAt(token, vt::NodeT{i % 2}); } } proxy.finishModification(std::move(token)); diff --git a/examples/collection/jacobi1d_vt.cc b/examples/collection/jacobi1d_vt.cc index 959693ad09..f8adc3b38e 100644 --- a/examples/collection/jacobi1d_vt.cc +++ b/examples/collection/jacobi1d_vt.cc @@ -335,11 +335,11 @@ int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); if (argc == 1) { - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { fmt::print( stderr, "{}: using default arguments since none provided\n", name ); diff --git a/examples/collection/jacobi2d_vt.cc b/examples/collection/jacobi2d_vt.cc index 46e9c2b8d7..7a22e78adc 100644 --- a/examples/collection/jacobi2d_vt.cc +++ b/examples/collection/jacobi2d_vt.cc @@ -440,10 +440,10 @@ int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); if (argc == 1) { - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { fmt::print( stderr, "{}: using default arguments since none provided\n", name ); @@ -469,7 +469,7 @@ int main(int argc, char** argv) { /* --- Print information about the simulation */ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { fmt::print( stdout, "\n - Solve the linear system for the Laplacian with homogeneous Dirichlet" " on [0, 1] x [0, 1]\n" diff --git a/examples/collection/lb_iter.cc b/examples/collection/lb_iter.cc index 6d467b0347..74336b40fc 100644 --- a/examples/collection/lb_iter.cc +++ b/examples/collection/lb_iter.cc @@ -97,9 +97,9 @@ int main(int argc, char** argv) { num_iter = atoi(argv[3]); } - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { fmt::print( "lb_iter: elms={}, weight={}, num_iter={}\n", num_elms, weight, num_iter @@ -126,7 +126,7 @@ int main(int argc, char** argv) { }); auto total_time = vt::timing::getCurrentTime() - cur_time; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { fmt::print("iteration: iter={},time={}\n", i, total_time); } diff --git a/examples/collection/migrate_collection.cc b/examples/collection/migrate_collection.cc index ee86a8bd2d..ad96c2aa4a 100644 --- a/examples/collection/migrate_collection.cc +++ b/examples/collection/migrate_collection.cc @@ -49,7 +49,7 @@ static constexpr int32_t const default_num_elms = 16; struct Hello : vt::Collection { Hello() { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print("{}: Hello: index={}\n", this_node, getIndex()); test_val = getIndex().x() * 29.3; } @@ -66,14 +66,14 @@ struct Hello : vt::Collection { }; static void doWork(Hello* col) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print("{}: idx={}: val={}\n", this_node, col->getIndex(), col->test_val); } static void migrateToNext(Hello* col) { - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); - vt::NodeType next_node = (this_node + 1) % num_nodes; + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); + vt::NodeT next_node = (this_node + vt::NodeT{1}) % num_nodes; fmt::print("{}: migrateToNext: idx={}\n", this_node, col->getIndex()); col->migrate(next_node); @@ -82,10 +82,10 @@ static void migrateToNext(Hello* col) { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return vt::rerror("requires at least 2 nodes"); } @@ -100,7 +100,7 @@ int main(int argc, char** argv) { .bulkInsert() .wait(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt::runInEpochRooted([=] { proxy.broadcast(); }); vt::runInEpochRooted([=] { proxy.broadcast(); }); vt::runInEpochRooted([=] { proxy.broadcast(); }); diff --git a/examples/collection/polymorphic_collection.cc b/examples/collection/polymorphic_collection.cc index 88bab1448f..d794fc93e1 100644 --- a/examples/collection/polymorphic_collection.cc +++ b/examples/collection/polymorphic_collection.cc @@ -139,9 +139,9 @@ void Hello::doWork() { static void migrateToNext(Hello* col) { - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); - vt::NodeType next_node = (this_node + 1) % num_nodes; + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); + vt::NodeT next_node = (this_node + vt::NodeT{1}) % num_nodes; fmt::print("{}: migrateToNext: idx={}\n", this_node, col->getIndex()); col->migrate(next_node); @@ -150,8 +150,8 @@ static void migrateToNext(Hello* col) { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); auto num_elms = std::max(static_cast(num_nodes), default_num_elms); @@ -165,12 +165,12 @@ int main(int argc, char** argv) { vtAbortIf(num_elms % num_nodes != 0, "Must be even number of elements per rank"); auto const num_per = num_elms / num_nodes; if (this_node % 2 == 0) { - for (int i = this_node*num_per; i < (this_node+1)*num_per; i++) { + for (int i = this_node.get()*num_per; i < (this_node.get()+1)*num_per; i++) { vt::Index1D idx{i}; elms.emplace_back(idx, std::make_unique>(InitialConsTag{})); } } else if (this_node % 2 == 1) { - for (int i = this_node*num_per; i < (this_node+1)*num_per; i++) { + for (int i = this_node.get()*num_per; i < (this_node.get()+1)*num_per; i++) { vt::Index1D idx{i}; elms.emplace_back(idx, std::make_unique>(InitialConsTag{})); } diff --git a/examples/collection/reduce_integral.cc b/examples/collection/reduce_integral.cc index 45a40fbcb5..3df5e8d22b 100644 --- a/examples/collection/reduce_integral.cc +++ b/examples/collection/reduce_integral.cc @@ -65,7 +65,7 @@ static constexpr std::size_t const default_nparts_object = 8; static constexpr std::size_t const default_num_objs = 4; static constexpr std::size_t const verbose = 1; -static constexpr vt::NodeType const reduce_root_node = 0; +static constexpr vt::NodeT const reduce_root_node = vt::NodeT{0}; static bool root_reduce_finished = false; static double exactIntegral = 0.0; @@ -194,11 +194,11 @@ int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); if (argc == 1) { - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { fmt::print( stderr, "{}: using default arguments since none provided\n", name ); diff --git a/examples/collection/transpose.cc b/examples/collection/transpose.cc index 0a4c1ad965..7865bd53b1 100644 --- a/examples/collection/transpose.cc +++ b/examples/collection/transpose.cc @@ -54,8 +54,8 @@ struct SolveMsg : vt::CollectionMessage {}; template struct RequestDataMsg : vt::CollectionMessage { - explicit RequestDataMsg(vt::NodeType in_node) : node_(in_node) { } - vt::NodeType node_; + explicit RequestDataMsg(vt::NodeT in_node) : node_(in_node) { } + vt::NodeT node_; }; struct InitMsg : vt::collective::ReduceNoneMsg { }; @@ -192,17 +192,17 @@ struct Block : vt::Collection { std::vector data_ = {}; }; -//using ActiveMapTypedFnType = NodeType(IndexT*, IndexT*, NodeType); +//using ActiveMapTypedFnType = NodeT(IndexT*, IndexT*, NodeT); template -vt::NodeType my_map(IndexT* idx, IndexT* max_idx, vt::NodeType num_nodes) { +vt::NodeT my_map(IndexT* idx, IndexT* max_idx, vt::NodeT num_nodes) { // simple round-robin for 1-d only. - return idx->x() % num_nodes; + return vt::NodeT{idx->x()} % num_nodes; } // group-targeted handler for the sub-solve /*static*/ void SubSolveInfo::subSolveHandler(SubSolveMsg* msg) { - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); auto const group_id = vt::envelopeGetGroup(msg->env); MPI_Comm sub_comm = vt::theGroup()->getGroupComm(group_id); @@ -288,7 +288,7 @@ vt::NodeType my_map(IndexT* idx, IndexT* max_idx, vt::NodeType num_nodes) { } } -static void solveGroupSetup(vt::NodeType this_node, vt::VirtualProxyType coll_proxy) { +static void solveGroupSetup(vt::NodeT this_node, vt::VirtualProxyType coll_proxy) { auto const& is_even_node = this_node % 2 == 0; // This is how you would explicitly create/get a new communicator for this @@ -310,7 +310,7 @@ static void solveGroupSetup(vt::NodeType this_node, vt::VirtualProxyType coll_pr vt::theGroup()->newGroupCollective( is_even_node, [=](vt::GroupType group_id){ fmt::print("{}: Group is created: id={:x}\n", this_node, group_id); - if (this_node == 1) { + if (this_node == vt::NodeT{1}) { auto msg = vt::makeMessage(coll_proxy); vt::envelopeSetGroup(msg->env, group_id); vt::theMsg()->broadcastMsg(msg); @@ -321,7 +321,7 @@ static void solveGroupSetup(vt::NodeType this_node, vt::VirtualProxyType coll_pr } void SetupGroup::operator()(ProxyMsg* msg) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print("SetupGroup: node={}\n", this_node); // Example using the group collective solveGroupSetup(this_node, msg->proxy_); @@ -330,7 +330,7 @@ void SetupGroup::operator()(ProxyMsg* msg) { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); auto range = vt::Index1D(num_pieces); auto proxy = vt::makeCollection("examples_transpose") @@ -339,7 +339,7 @@ int main(int argc, char** argv) { .mapperFunc() .wait(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast, &Block::solve>(); } diff --git a/examples/group/group_collective.cc b/examples/group/group_collective.cc index e43a4b0e5e..4e661bee7f 100644 --- a/examples/group/group_collective.cc +++ b/examples/group/group_collective.cc @@ -61,10 +61,10 @@ struct Print { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes < 2) { + if (num_nodes < vt::NodeT{2}) { return vt::rerror("requires at least 2 nodes"); } @@ -74,10 +74,10 @@ int main(int argc, char** argv) { vt::GroupType new_group = vt::theGroup()->newGroupCollective( odd_node_filter, [=](vt::GroupType group){ - auto const& root = 0; - auto const& in_group = vt::theGroup()->inGroup(group); - auto const& root_node = vt::theGroup()->groupRoot(group); - auto const& is_default_group = vt::theGroup()->isGroupDefault(group); + auto const root = vt::NodeT{0}; + auto const in_group = vt::theGroup()->inGroup(group); + auto const root_node = vt::theGroup()->groupRoot(group); + auto const is_default_group = vt::theGroup()->isGroupDefault(group); fmt::print( "{}: Group is created: group={:x}, in_group={}, root={}, " "is_default_group={}\n", @@ -88,7 +88,7 @@ int main(int argc, char** argv) { auto msg = vt::makeMessage(1); vt::theGroup()->groupReducer(group)->reduce(root, msg.get()); } - if (this_node == 1) { + if (this_node == vt::NodeT{1}) { auto msg = vt::makeMessage(); vt::envelopeSetGroup(msg->env, group); vt::theMsg()->broadcastMsg(msg); diff --git a/examples/group/group_rooted.cc b/examples/group/group_rooted.cc index 094da60fe9..ffb2d0807e 100644 --- a/examples/group/group_rooted.cc +++ b/examples/group/group_rooted.cc @@ -44,9 +44,9 @@ #include struct HelloMsg : vt::Message { - vt::NodeType from = vt::uninitialized_destination; + vt::NodeT from = {}; - explicit HelloMsg(vt::NodeType const& in_from) + explicit HelloMsg(vt::NodeT const& in_from) : from(in_from) { } }; @@ -62,19 +62,19 @@ static void hello_group_handler(HelloMsg* msg) { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return vt::rerror("requires at least 2 nodes"); } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto msg = vt::makeMessage(this_node); vt::theMsg()->broadcastMsg(msg); using RangeType = vt::group::region::Range; - auto list = std::make_unique(num_nodes / 2, num_nodes); + auto list = std::make_unique(num_nodes / vt::NodeT{2}, num_nodes); vt::theGroup()->newGroup(std::move(list), [=](vt::GroupType group){ auto gmsg = vt::makeMessage(this_node); diff --git a/examples/hello_world/hello_world.cc b/examples/hello_world/hello_world.cc index 5200de3783..03bc57662a 100644 --- a/examples/hello_world/hello_world.cc +++ b/examples/hello_world/hello_world.cc @@ -44,28 +44,28 @@ #include struct HelloMsg : vt::Message { - HelloMsg(vt::NodeType in_from) : from(in_from) { } + HelloMsg(vt::NodeT in_from) : from(in_from) { } - vt::NodeType from = 0; + vt::NodeT from = vt::NodeT{0}; }; void hello_world(int a, int b, float c) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print("{}: Hello from node vals = {} {} {}\n", this_node, a, b, c); } int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return vt::rerror("requires at least 2 nodes"); } - if (this_node == 0) { - vt::theMsg()->send(vt::Node{1}, 10, 20, 11.3f); + if (this_node == vt::NodeT{0}) { + vt::theMsg()->send(vt::NodeT{1}, 10, 20, 11.3f); } vt::finalize(); diff --git a/examples/hello_world/hello_world_collection.cc b/examples/hello_world/hello_world_collection.cc index bd9305dc2e..7bef0bd5a8 100644 --- a/examples/hello_world/hello_world_collection.cc +++ b/examples/hello_world/hello_world_collection.cc @@ -63,7 +63,7 @@ struct Hello : vt::Collection { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); int num_elms = 64; @@ -71,7 +71,7 @@ int main(int argc, char** argv) { num_elms = atoi(argv[1]); } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto range = vt::Index1D(num_elms); auto proxy = vt::makeCollectionRooted("examples_hello_world_collection") .bounds(range) diff --git a/examples/hello_world/hello_world_collection_collective.cc b/examples/hello_world/hello_world_collection_collective.cc index d0e06fcd59..b0b219ba96 100644 --- a/examples/hello_world/hello_world_collection_collective.cc +++ b/examples/hello_world/hello_world_collection_collective.cc @@ -48,7 +48,7 @@ struct Hello : vt::Collection { Hello() = default; virtual ~Hello() { - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto num_nodes = vt::theContext()->getNumNodes(); vtAssert(counter_ == num_nodes, "Should receive # nodes broadcasts"); } diff --git a/examples/hello_world/hello_world_collection_reduce.cc b/examples/hello_world/hello_world_collection_reduce.cc index 38db1bde36..ba60e61c91 100644 --- a/examples/hello_world/hello_world_collection_reduce.cc +++ b/examples/hello_world/hello_world_collection_reduce.cc @@ -69,7 +69,7 @@ struct Hello : vt::Collection { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); int32_t num_elms = 16; if (argc > 1) { @@ -82,7 +82,7 @@ int main(int argc, char** argv) { .bulkInsert() .wait(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast<&Hello::doWork>(); } diff --git a/examples/hello_world/hello_world_collection_staged_insert.cc b/examples/hello_world/hello_world_collection_staged_insert.cc index ef097c61cd..61e7be3f03 100644 --- a/examples/hello_world/hello_world_collection_staged_insert.cc +++ b/examples/hello_world/hello_world_collection_staged_insert.cc @@ -61,7 +61,7 @@ struct Hello : vt::Collection { void doWork() { counter_++; - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print("{}: Hello from {}: {}\n", this_node, this->getIndex(), in); } @@ -73,10 +73,10 @@ struct Hello : vt::Collection { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if(num_nodes < 2){ + if(num_nodes < vt::NodeT{2}){ vt::finalize(); return 0; } @@ -104,7 +104,7 @@ int main(int argc, char** argv) { .listInsertHere(std::move(elms)) .wait(); - if (this_node == 1) { + if (this_node == vt::NodeT{1}) { proxy.broadcast<&Hello::doWork>(); } diff --git a/examples/hello_world/hello_world_functor.cc b/examples/hello_world/hello_world_functor.cc index fffd344172..f837083a45 100644 --- a/examples/hello_world/hello_world_functor.cc +++ b/examples/hello_world/hello_world_functor.cc @@ -72,14 +72,14 @@ struct MultipleFunctions { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return vt::rerror("requires at least 2 nodes"); } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto msg = vt::makeMessage(this_node); // 'HelloWorld' functor has only single 'operator()' declared @@ -87,7 +87,7 @@ int main(int argc, char** argv) { vt::theMsg()->broadcastMsg(msg); msg = vt::makeMessage(this_node); - vt::theMsg()->sendMsg(1, msg); + vt::theMsg()->sendMsg(vt::NodeT{1}, msg); // 'MultipleFunctions' functor declares more than one 'operator()' // so we have to specify the type of the message, as it can't be deduced @@ -95,7 +95,7 @@ int main(int argc, char** argv) { vt::theMsg()->broadcastMsg(new_msg); msg = vt::makeMessage(this_node); - vt::theMsg()->sendMsg(1, msg); + vt::theMsg()->sendMsg(vt::NodeT{1}, msg); } vt::finalize(); diff --git a/examples/hello_world/hello_world_virtual_context.cc b/examples/hello_world/hello_world_virtual_context.cc index 8b7e6c7591..4ffa80ad75 100644 --- a/examples/hello_world/hello_world_virtual_context.cc +++ b/examples/hello_world/hello_world_virtual_context.cc @@ -92,14 +92,14 @@ static void hello_world(HelloMsg* msg) { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return vt::rerror("requires at least 2 nodes"); } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto proxy = vt::theVirtualManager()->makeVirtual(29); sendMsgToProxy(proxy); diff --git a/examples/hello_world/hello_world_virtual_context_remote.cc b/examples/hello_world/hello_world_virtual_context_remote.cc index 69a1ce73b5..6cef9683ab 100644 --- a/examples/hello_world/hello_world_virtual_context_remote.cc +++ b/examples/hello_world/hello_world_virtual_context_remote.cc @@ -68,16 +68,16 @@ static void testHan(MyVC* vc, TestMsg* msg) { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return vt::rerror("requires at least 2 nodes"); } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { // Create a virtual context remotely on node 1, getting a proxy to it - auto proxy = vt::theVirtualManager()->makeVirtualNode(1, 45); + auto proxy = vt::theVirtualManager()->makeVirtualNode(vt::NodeT{1}, 45); auto msg = vt::makeMessage(this_node); vt::theVirtualManager()->sendMsg(proxy, msg.get()); } diff --git a/examples/hello_world/objgroup.cc b/examples/hello_world/objgroup.cc index 73b377000c..6ad48a88a4 100644 --- a/examples/hello_world/objgroup.cc +++ b/examples/hello_world/objgroup.cc @@ -54,17 +54,17 @@ struct MyObjGroup { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); auto proxy = vt::theObjGroup()->makeCollective( "examples_hello_world" ); - if (this_node == 0) { - proxy[0].send<&MyObjGroup::handler>(5,10); + if (this_node == vt::NodeT{0}) { + proxy[vt::NodeT{0}].send<&MyObjGroup::handler>(5,10); if (num_nodes > 1) { - proxy[1].send<&MyObjGroup::handler>(10,20); + proxy[vt::NodeT{1}].send<&MyObjGroup::handler>(10,20); } proxy.broadcast<&MyObjGroup::handler>(400,500); } diff --git a/examples/hello_world/ring.cc b/examples/hello_world/ring.cc index 2488dbf24f..4395358c85 100644 --- a/examples/hello_world/ring.cc +++ b/examples/hello_world/ring.cc @@ -47,9 +47,9 @@ static int num_total_rings = 2; static int num_times = 0; struct RingMsg : vt::Message { - vt::NodeType from = vt::uninitialized_destination; + vt::NodeT from = {}; - explicit RingMsg(vt::NodeType const& in_from) + explicit RingMsg(vt::NodeT const& in_from) : from(in_from) { } }; @@ -57,22 +57,24 @@ struct RingMsg : vt::Message { static void sendToNext(); static void ring(RingMsg* msg) { - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); fmt::print("{}: Hello from node {}: num_times={}\n", this_node, msg->from, num_times); num_times++; - if (msg->from != num_nodes - 1 or num_times < num_total_rings) { + if (msg->from != num_nodes - vt::NodeT{1} or num_times < num_total_rings) { sendToNext(); } } static void sendToNext() { - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); - vt::NodeType next_node = this_node + 1 >= num_nodes ? 0 : this_node + 1; + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); + auto next_node = this_node + vt::NodeT{1} >= num_nodes ? + vt::NodeT{0} : + this_node + vt::NodeT{1}; auto msg = vt::makeMessage(this_node); vt::theMsg()->sendMsg(next_node, msg); @@ -81,14 +83,14 @@ static void sendToNext() { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return vt::rerror("requires at least 2 nodes"); } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { sendToNext(); } diff --git a/examples/rdma/rdma_simple_get.cc b/examples/rdma/rdma_simple_get.cc index 79d92ceb07..7a76df0f2d 100644 --- a/examples/rdma/rdma_simple_get.cc +++ b/examples/rdma/rdma_simple_get.cc @@ -51,11 +51,11 @@ struct HandleMsg : vt::Message { }; static void tell_handle(HandleMsg* msg) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print("{}: handle={}\n", this_node, msg->han); - if (this_node == 1 || this_node == 2) { + if (this_node == vt::NodeT{1} || this_node == vt::NodeT{2}) { fmt::print("{}: requesting data\n", this_node); vt::theRDMA()->getData( msg->han, this_node, sizeof(double)*3, vt::no_byte, @@ -80,7 +80,7 @@ static vt::RDMA_GetType test_get_fn( vt::BaseMessage*, vt::ByteType num_bytes, vt::ByteType offset, vt::TagType tag, bool ) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print( "{}: running test_get_fn: num_bytes={}, tag={}\n", this_node, num_bytes, tag @@ -93,9 +93,9 @@ static vt::RDMA_GetType test_get_fn( int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const len = 64; my_data = std::make_unique(len); diff --git a/examples/rdma/rdma_simple_get_direct.cc b/examples/rdma/rdma_simple_get_direct.cc index 5a720caab6..f2f8ed0f46 100644 --- a/examples/rdma/rdma_simple_get_direct.cc +++ b/examples/rdma/rdma_simple_get_direct.cc @@ -54,9 +54,9 @@ struct HandleMsg : vt::Message { }; static void tellHandle(HandleMsg* msg) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); - if (this_node != 0) { + if (this_node != vt::NodeT{0}) { fmt::print("{}: handle={}, requesting data\n", this_node, msg->han); int const num_elm = 2; vt::theRDMA()->getTypedDataInfoBuf( @@ -72,16 +72,16 @@ static void tellHandle(HandleMsg* msg) { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); my_data = std::make_unique(my_data_len); // initialize my_data buffer, all but node 0 get -1.0 for (auto i = 0; i < my_data_len; i++) { - my_data[i] = this_node == 0 ? (this_node+1)*i+1 : -1.0; + my_data[i] = this_node == vt::NodeT{0} ? (this_node.get()+1)*i+1 : -1.0; } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt::RDMA_HandleType my_handle = vt::theRDMA()->registerNewTypedRdmaHandler(my_data.get(), my_data_len); diff --git a/examples/rdma/rdma_simple_put.cc b/examples/rdma/rdma_simple_put.cc index b9f24bb036..3c4e40cccb 100644 --- a/examples/rdma/rdma_simple_put.cc +++ b/examples/rdma/rdma_simple_put.cc @@ -53,11 +53,11 @@ struct HandleMsg : vt::Message { static std::unique_ptr my_data = nullptr; static void read_data_fn(HandleMsg* msg) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print("{}: read_data_fn: handle={}\n", this_node, msg->han); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { int const len = 10; for (auto i = 0; i < len; i++) { fmt::print("\t: my_data[{}] = {}\n", i, my_data[i]); @@ -66,18 +66,18 @@ static void read_data_fn(HandleMsg* msg) { } static void put_data_fn(HandleMsg* msg) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); vt::RDMA_HandleType handle = msg->han; fmt::print("{}: put_data_fn: handle={}\n", this_node, handle); - if (this_node < 4) { + if (this_node < vt::NodeT{4}) { fmt::print("{}: putting data\n", this_node); int const local_data_len = 3; double* local_data = new double[local_data_len]; for (auto i = 0; i < local_data_len; i++) { - local_data[i] = (i+1)*1000*(this_node+1); + local_data[i] = (i+1)*1000*(this_node.get()+1); } vt::theRDMA()->putData( @@ -88,7 +88,7 @@ static void put_data_fn(HandleMsg* msg) { fmt::print("{}: after put: sending msg back to 0\n", this_node); auto msg2 = vt::makeMessage(this_node); msg2->han = handle; - vt::theMsg()->sendMsg(0, msg2); + vt::theMsg()->sendMsg(vt::NodeT{0}, msg2); } ); } @@ -98,7 +98,7 @@ static void put_handler_fn( vt::BaseMessage*, vt::RDMA_PtrType in_ptr, vt::ByteType in_num_bytes, vt::ByteType offset, vt::TagType tag, bool ) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print( "{}: put_handler_fn: my_data={}, in_ptr={}, in_num_bytes={}, tag={}, " @@ -121,14 +121,14 @@ static void put_handler_fn( int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes != 4) { + if (num_nodes != vt::NodeT{4}) { return vt::rerror("requires exactly 4 nodes"); } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const len = 64; my_data = std::make_unique(len); diff --git a/examples/rdma/rdma_simple_put_direct.cc b/examples/rdma/rdma_simple_put_direct.cc index eba91a7c25..fe40678fd1 100644 --- a/examples/rdma/rdma_simple_put_direct.cc +++ b/examples/rdma/rdma_simple_put_direct.cc @@ -55,7 +55,7 @@ struct HandleMsg : vt::Message { }; static void readDataFn(HandleMsg* msg) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); fmt::print("{}: readDataFn: handle={}\n", this_node, msg->han); @@ -67,16 +67,16 @@ static void readDataFn(HandleMsg* msg) { } static void putDataFn(HandleMsg* msg) { - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); - if (this_node == 1 or this_node == 2) { + if (this_node == vt::NodeT{1} or this_node == vt::NodeT{2}) { fmt::print( "{}: putting data, handle={}, my_data={}\n", this_node, msg->han, print_ptr(my_data.get()) ); int const num_elm = 2; - int const offset = num_elm*(this_node-1); + int const offset = num_elm*(this_node.get()-1); auto han = msg->han; vt::theRDMA()->putTypedData(msg->han, my_data.get(), num_elm, offset, [=]{ fmt::print( @@ -84,7 +84,7 @@ static void putDataFn(HandleMsg* msg) { ); auto back = vt::makeMessage(han); - vt::theMsg()->sendMsg(0, back); + vt::theMsg()->sendMsg(vt::NodeT{0}, back); }); } } @@ -92,10 +92,10 @@ static void putDataFn(HandleMsg* msg) { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes < 4) { + if (num_nodes < vt::NodeT{4}) { return vt::rerror("requires exactly 4 nodes"); } @@ -103,10 +103,10 @@ int main(int argc, char** argv) { // initialize my_data buffer, all but node 0 get -1.0 for (auto i = 0; i < my_data_len; i++) { - my_data[i] = this_node != 0 ? (this_node+1)*i+1 : -1.0; + my_data[i] = this_node != vt::NodeT{0} ? (this_node.get()+1)*i+1 : -1.0; } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt::RDMA_HandleType my_handle = vt::theRDMA()->registerNewTypedRdmaHandler(my_data.get(), put_len); @@ -117,8 +117,8 @@ int main(int argc, char** argv) { auto msg1 = vt::makeMessage(my_handle); auto msg2 = vt::makeMessage(my_handle); - vt::theMsg()->sendMsg(1, msg1); - vt::theMsg()->sendMsg(2, msg2); + vt::theMsg()->sendMsg(vt::NodeT{1}, msg1); + vt::theMsg()->sendMsg(vt::NodeT{2}, msg2); } vt::finalize(); diff --git a/examples/termination/termination_collective.cc b/examples/termination/termination_collective.cc index 90f4ef68f1..0cf4db141a 100644 --- a/examples/termination/termination_collective.cc +++ b/examples/termination/termination_collective.cc @@ -46,16 +46,16 @@ /// [Collective termination example] using TestMsg = vt::Message; -vt::NodeType nextNode() { - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); - return (this_node + 1) % num_nodes; +vt::NodeT nextNode() { + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); + return (this_node + vt::NodeT{1}) % num_nodes; } static void test_handler(TestMsg* msg) { static int num = 3; - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); auto epoch = vt::envelopeGetEpoch(msg->env); fmt::print("{}: test_handler: num={}, epoch={:x}\n", this_node, num, epoch); @@ -70,10 +70,10 @@ static void test_handler(TestMsg* msg) { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return vt::rerror("requires at least 2 nodes"); } diff --git a/examples/termination/termination_rooted.cc b/examples/termination/termination_rooted.cc index 3eb2c752d0..d4e3bc0846 100644 --- a/examples/termination/termination_rooted.cc +++ b/examples/termination/termination_rooted.cc @@ -46,16 +46,16 @@ /// [Rooted termination example] using TestMsg = vt::Message; -vt::NodeType nextNode() { - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); - return (this_node + 1) % num_nodes; +vt::NodeT nextNode() { + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); + return (this_node + vt::NodeT{1}) % num_nodes; } static void test_handler(TestMsg* msg) { static int num = 3; - vt::NodeType this_node = vt::theContext()->getNode(); + auto this_node = vt::theContext()->getNode(); auto epoch = vt::envelopeGetEpoch(msg->env); fmt::print("{}: test_handler: num={}, epoch={:x}\n", this_node, num, epoch); @@ -70,14 +70,14 @@ static void test_handler(TestMsg* msg) { int main(int argc, char** argv) { vt::initialize(argc, argv); - vt::NodeType this_node = vt::theContext()->getNode(); - vt::NodeType num_nodes = vt::theContext()->getNumNodes(); + auto this_node = vt::theContext()->getNode(); + auto num_nodes = vt::theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return vt::rerror("requires at least 2 nodes"); } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto epoch = vt::theTerm()->makeEpochRooted(vt::term::UseDS{true}); // This action will not run until all messages originating from the diff --git a/src/vt/collective/barrier/barrier.cc b/src/vt/collective/barrier/barrier.cc index 80986b70f4..cc5549bacb 100644 --- a/src/vt/collective/barrier/barrier.cc +++ b/src/vt/collective/barrier/barrier.cc @@ -109,7 +109,7 @@ BarrierType Barrier::newNamedCollectiveBarrier() { BarrierType Barrier::newNamedBarrier() { BarrierType const next_barrier = cur_named_barrier_++; - NodeType const cur_node = theContext()->getNode(); + NodeT const cur_node = theContext()->getNode(); BarrierType const cur_node_shift = static_cast(cur_node) << 32; BarrierType const barrier_name = next_barrier | cur_node_shift; return barrier_name; diff --git a/src/vt/collective/collective_alg.h b/src/vt/collective/collective_alg.h index bfc2ca10c7..6124f5055e 100644 --- a/src/vt/collective/collective_alg.h +++ b/src/vt/collective/collective_alg.h @@ -115,7 +115,7 @@ struct CollectiveAlg : struct CollectiveMsg : vt::collective::ReduceNoneMsg { CollectiveMsg( - bool in_is_user_tag, TagType in_scope, TagType in_seq, NodeType in_root + bool in_is_user_tag, TagType in_scope, TagType in_seq, NodeT in_root ) : is_user_tag_(in_is_user_tag), scope_(in_scope), seq_(in_seq), @@ -125,7 +125,7 @@ struct CollectiveAlg : bool is_user_tag_ = false; TagType scope_ = no_tag; TagType seq_ = no_tag; - NodeType root_ = uninitialized_destination; + NodeT root_ = {}; }; static void runCollective(CollectiveMsg* msg); diff --git a/src/vt/collective/collective_scope.cc b/src/vt/collective/collective_scope.cc index 3dde0c6dde..8607c8ccf2 100644 --- a/src/vt/collective/collective_scope.cc +++ b/src/vt/collective/collective_scope.cc @@ -80,7 +80,7 @@ TagType CollectiveScope::mpiCollectiveAsync(ActionType action) { // order. This implies that runCollective might be called with different tags // on different nodes. Thus, in runCollective, we will use a consensus // protocol to agree on a consistent tag across all the nodes. - NodeType collective_root = 0; + NodeT collective_root = NodeT{0}; using CollectiveMsg = CollectiveAlg::CollectiveMsg; auto cb = theCB()->makeBcast(); diff --git a/src/vt/collective/reduce/reduce.h b/src/vt/collective/reduce/reduce.h index 71a3809827..a90f3482c2 100644 --- a/src/vt/collective/reduce/reduce.h +++ b/src/vt/collective/reduce/reduce.h @@ -142,7 +142,7 @@ struct Reduce : virtual collective::tree::Tree { */ template * f> PendingSendType reduce( - NodeType root, MsgT* const msg, + NodeT root, MsgT* const msg, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType num_contrib = 1 ); @@ -159,7 +159,7 @@ struct Reduce : virtual collective::tree::Tree { */ template PendingSendType reduce( - NodeType root, + NodeT root, typename FuncTraits::MsgT* const msg, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType num_contrib = 1 @@ -180,7 +180,7 @@ struct Reduce : virtual collective::tree::Tree { */ template * f> detail::ReduceStamp reduceImmediate( - NodeType root, MsgT* const msg, + NodeT root, MsgT* const msg, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType num_contrib = 1 ); @@ -197,7 +197,7 @@ struct Reduce : virtual collective::tree::Tree { */ template detail::ReduceStamp reduceImmediate( - NodeType root, + NodeT root, typename FuncTraits::MsgT* const msg, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType num_contrib = 1 @@ -223,7 +223,7 @@ struct Reduce : virtual collective::tree::Tree { ActiveTypedFnType *f > PendingSendType reduce( - NodeType const& root, MsgT* msg, Callback cb, + NodeT const& root, MsgT* msg, Callback cb, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType const& num_contrib = 1 ); @@ -232,7 +232,7 @@ struct Reduce : virtual collective::tree::Tree { typename MsgT > PendingSendType reduce( - NodeType const& root, MsgT* msg, Callback cb, + NodeT const& root, MsgT* msg, Callback cb, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType const& num_contrib = 1 ) @@ -261,7 +261,7 @@ struct Reduce : virtual collective::tree::Tree { */ template PendingSendType reduce( - NodeType const& root, + NodeT const& root, typename FuncTraits::MsgT* msg, Callback::MsgT> cb, detail::ReduceStamp id = detail::ReduceStamp{}, @@ -288,7 +288,7 @@ struct Reduce : virtual collective::tree::Tree { ActiveTypedFnType *f > detail::ReduceStamp reduceImmediate( - NodeType const& root, MsgT* msg, Callback cb, + NodeT const& root, MsgT* msg, Callback cb, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType const& num_contrib = 1 ); @@ -297,7 +297,7 @@ struct Reduce : virtual collective::tree::Tree { typename MsgT > detail::ReduceStamp reduceImmediate( - NodeType const& root, MsgT* msg, Callback cb, + NodeT const& root, MsgT* msg, Callback cb, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType const& num_contrib = 1 ) @@ -326,7 +326,7 @@ struct Reduce : virtual collective::tree::Tree { */ template detail::ReduceStamp reduceImmediate( - NodeType const& root, + NodeT const& root, typename FuncTraits::MsgT* msg, Callback::MsgT> cb, detail::ReduceStamp id = detail::ReduceStamp{}, @@ -353,7 +353,7 @@ struct Reduce : virtual collective::tree::Tree { ActiveTypedFnType *f > PendingSendType reduce( - NodeType const& root, MsgT* msg, + NodeT const& root, MsgT* msg, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType const& num_contrib = 1 ); @@ -363,7 +363,7 @@ struct Reduce : virtual collective::tree::Tree { typename MsgT > PendingSendType reduce( - NodeType const& root, MsgT* msg, + NodeT const& root, MsgT* msg, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType const& num_contrib = 1 ) @@ -392,7 +392,7 @@ struct Reduce : virtual collective::tree::Tree { auto f > PendingSendType reduce( - NodeType const& root, + NodeT const& root, typename FuncTraits::MsgT* msg, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType const& num_contrib = 1 @@ -418,7 +418,7 @@ struct Reduce : virtual collective::tree::Tree { ActiveTypedFnType *f > detail::ReduceStamp reduceImmediate( - NodeType const& root, MsgT* msg, + NodeT const& root, MsgT* msg, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType const& num_contrib = 1 ); @@ -428,7 +428,7 @@ struct Reduce : virtual collective::tree::Tree { typename MsgT > detail::ReduceStamp reduceImmediate( - NodeType const& root, MsgT* msg, + NodeT const& root, MsgT* msg, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType const& num_contrib = 1 ) @@ -457,7 +457,7 @@ struct Reduce : virtual collective::tree::Tree { auto f > detail::ReduceStamp reduceImmediate( - NodeType const& root, + NodeT const& root, typename FuncTraits::MsgT* msg, detail::ReduceStamp id = detail::ReduceStamp{}, ReduceNumType const& num_contrib = 1 diff --git a/src/vt/collective/reduce/reduce.impl.h b/src/vt/collective/reduce/reduce.impl.h index ccd37b57c4..13b517e5b4 100644 --- a/src/vt/collective/reduce/reduce.impl.h +++ b/src/vt/collective/reduce/reduce.impl.h @@ -85,7 +85,7 @@ void Reduce::reduceRootRecv(MsgT* msg) { template *f> Reduce::PendingSendType Reduce::reduce( - NodeType const& root, MsgT* msg, Callback cb, detail::ReduceStamp id, + NodeT const& root, MsgT* msg, Callback cb, detail::ReduceStamp id, ReduceNumType const& num_contrib ) { msg->setCallback(cb); @@ -94,7 +94,7 @@ Reduce::PendingSendType Reduce::reduce( template *f> detail::ReduceStamp Reduce::reduceImmediate( - NodeType const& root, MsgT* msg, Callback cb, detail::ReduceStamp id, + NodeT const& root, MsgT* msg, Callback cb, detail::ReduceStamp id, ReduceNumType const& num_contrib ) { msg->setCallback(cb); @@ -105,7 +105,7 @@ template < typename OpT, typename FunctorT, typename MsgT, ActiveTypedFnType *f > Reduce::PendingSendType Reduce::reduce( - NodeType const& root, MsgT* msg, detail::ReduceStamp id, + NodeT const& root, MsgT* msg, detail::ReduceStamp id, ReduceNumType const& num_contrib ) { return reduce(root,msg,id,num_contrib); @@ -115,7 +115,7 @@ template < typename OpT, typename FunctorT, typename MsgT, ActiveTypedFnType *f > detail::ReduceStamp Reduce::reduceImmediate( - NodeType const& root, MsgT* msg, detail::ReduceStamp id, + NodeT const& root, MsgT* msg, detail::ReduceStamp id, ReduceNumType const& num_contrib ) { return reduceImmediate(root,msg,id,num_contrib); @@ -123,7 +123,7 @@ detail::ReduceStamp Reduce::reduceImmediate( template * f> Reduce::PendingSendType Reduce::reduce( - NodeType root, MsgT* const msg, detail::ReduceStamp id, + NodeT root, MsgT* const msg, detail::ReduceStamp id, ReduceNumType num_contrib ) { auto msg_ptr = promoteMsg(msg); @@ -134,7 +134,7 @@ Reduce::PendingSendType Reduce::reduce( template * f> detail::ReduceStamp Reduce::reduceImmediate( - NodeType root, MsgT* const msg, detail::ReduceStamp id, + NodeT root, MsgT* const msg, detail::ReduceStamp id, ReduceNumType num_contrib ) { if (scope_.get().is()) { @@ -267,7 +267,7 @@ void Reduce::startReduce(detail::ReduceStamp id, bool use_num_contrib) { MsgPtr typed_msg = msg.template to(); state.msgs.clear(); state.num_contrib_ = 1; - NodeType const root = state.reduce_root_; + NodeT const root = state.reduce_root_; // Must erase this before invoking the root function/callback because it // might be re-entrant diff --git a/src/vt/collective/reduce/reduce_msg.h b/src/vt/collective/reduce/reduce_msg.h index e2b5da9609..c0bf0dcf7c 100644 --- a/src/vt/collective/reduce/reduce_msg.h +++ b/src/vt/collective/reduce/reduce_msg.h @@ -85,7 +85,7 @@ struct ReduceMsg : SerializeSupported< ReduceStamp const& stamp() const { return reduce_id_.stamp(); } detail::ReduceScope const& scope() const { return reduce_id_.scope(); } - NodeType reduce_root_ = uninitialized_destination; + NodeT reduce_root_ = {}; detail::ReduceIDImpl reduce_id_; HandlerType combine_handler_ = uninitialized_handler; diff --git a/src/vt/collective/reduce/reduce_state.h b/src/vt/collective/reduce/reduce_state.h index 7dc1df4dc0..34b92449d3 100644 --- a/src/vt/collective/reduce/reduce_state.h +++ b/src/vt/collective/reduce/reduce_state.h @@ -65,7 +65,7 @@ struct ReduceState { ReduceNumType num_contrib_ = 1; ReduceNumType num_local_contrib_ = 0; HandlerType combine_handler_ = uninitialized_handler; - NodeType reduce_root_ = uninitialized_destination; + NodeT reduce_root_ = {}; }; }}} /* end namespace vt::collective::reduce */ diff --git a/src/vt/collective/scatter/scatter.cc b/src/vt/collective/scatter/scatter.cc index 1d9ee9dde0..c78dd31fa5 100644 --- a/src/vt/collective/scatter/scatter.cc +++ b/src/vt/collective/scatter/scatter.cc @@ -53,7 +53,7 @@ Scatter::Scatter() { } char* Scatter::applyScatterRecur( - NodeType node, char* ptr, std::size_t elm_size, FuncSizeType size_fn, + NodeT node, char* ptr, std::size_t elm_size, FuncSizeType size_fn, FuncDataType data_fn ) { // pre-order k-ary tree traversal for data layout @@ -89,7 +89,7 @@ void Scatter::scatterIn(ScatterMsg* msg) { "parent children={}\n", user_handler, total_size, elm_size, in_ptr - in_base_ptr, total_children ); - Tree::foreachChild([&](NodeType child) { + Tree::foreachChild([&](NodeT child) { auto const& num_children = getNumDescendants(child) + 1; auto const& child_bytes_size = num_children * elm_size; auto child_msg = diff --git a/src/vt/collective/scatter/scatter.h b/src/vt/collective/scatter/scatter.h index 291527211b..6838bbb14c 100644 --- a/src/vt/collective/scatter/scatter.h +++ b/src/vt/collective/scatter/scatter.h @@ -65,8 +65,8 @@ namespace vt { namespace collective { namespace scatter { * communicator/runtime. */ struct Scatter : virtual collective::tree::Tree { - using FuncSizeType = std::function; - using FuncDataType = std::function; + using FuncSizeType = std::function; + using FuncDataType = std::function; /** * \internal \brief Construct a scatter manager @@ -131,7 +131,7 @@ struct Scatter : virtual collective::tree::Tree { * \return incremented point after scatter is complete */ char* applyScatterRecur( - NodeType node, char* ptr, std::size_t elm_size, FuncSizeType size_fn, + NodeT node, char* ptr, std::size_t elm_size, FuncSizeType size_fn, FuncDataType data_fn ); diff --git a/src/vt/collective/scatter/scatter.impl.h b/src/vt/collective/scatter/scatter.impl.h index 8423d08177..7141c2f918 100644 --- a/src/vt/collective/scatter/scatter.impl.h +++ b/src/vt/collective/scatter/scatter.impl.h @@ -83,7 +83,7 @@ void Scatter::scatter( total_size, elm_size, sizeof(ScatterMsg), print_ptr(scatter_msg.get()), print_ptr(ptr), remaining_size ); - auto const& root_node = 0; + auto const root_node = NodeT {0}; auto nptr = applyScatterRecur(root_node, ptr, elm_size, size_fn, data_fn); vt_debug_print( verbose, scatter, "Scatter::scatter: incremented size={}\n", nptr - ptr diff --git a/src/vt/collective/tree/tree.cc b/src/vt/collective/tree/tree.cc index ebc86a5653..2d47e80755 100644 --- a/src/vt/collective/tree/tree.cc +++ b/src/vt/collective/tree/tree.cc @@ -55,7 +55,7 @@ Tree::Tree(DefaultTreeConstructTag) { } Tree::Tree( - bool const in_is_root, NodeType const& parent, NodeListType const& in_children + bool const in_is_root, NodeT const& parent, NodeListType const& in_children ) { is_root_ = in_is_root; children_ = in_children; @@ -68,33 +68,33 @@ Tree::Tree(NodeListType const& in_children) { children_ = in_children; } -NodeType Tree::getParent() const { +NodeT Tree::getParent() const { return parent_; } -NodeType Tree::getNumChildren() const { - return children_.size(); +NodeT Tree::getNumChildren() const { + return static_cast (children_.size()); } bool Tree::isRoot() const { return is_root_; } -Tree::NodeListType Tree::getChildren(NodeType node) const { +Tree::NodeListType Tree::getChildren(NodeT node) const { auto const& num_nodes = theContext()->getNumNodes(); auto const& c1_ = node * 2 + 1; auto const& c2_ = node * 2 + 2; NodeListType children; if (c1_ < num_nodes) { - children.push_back(c1_); + children.push_back(NodeT{c1_}); } if (c2_ < num_nodes) { - children.push_back(c2_); + children.push_back(NodeT{c2_}); } return children; } -std::size_t Tree::getNumDescendants(NodeType child) const { +std::size_t Tree::getNumDescendants(NodeT child) const { std::size_t total = 0; auto children = getChildren(child); for (auto&& elm : children) { @@ -105,7 +105,7 @@ std::size_t Tree::getNumDescendants(NodeType child) const { std::size_t Tree::getNumDescendants() const { auto total_size = 0; - foreachChild([this,&total_size](NodeType child){ + foreachChild([this,&total_size](NodeT child){ total_size += getNumDescendants(child); }); return total_size; @@ -127,7 +127,7 @@ void Tree::foreachChild(NumLevelsType level, OperationType op) const { int32_t const start = std::pow(2.0f, level) - 1; int32_t const end = std::pow(2.0f, level + 1) - 1; for (auto i = start; i < end; i++) { - op(i); + op(NodeT{i}); } } @@ -140,16 +140,16 @@ void Tree::setupTree() { auto const& c2_ = this_node_ * 2 + 2; if (c1_ < num_nodes_) { - children_.push_back(c1_); + children_.push_back(NodeT{c1_}); } if (c2_ < num_nodes_) { - children_.push_back(c2_); + children_.push_back(NodeT{c2_}); } is_root_ = this_node_ == 0; if (not is_root_) { - parent_ = (this_node_ - 1) / 2; + parent_ = NodeT {(this_node_ - 1) / 2}; } set_up_tree_ = true; @@ -158,7 +158,7 @@ void Tree::setupTree() { Tree::NumLevelsType Tree::numLevels() const { auto const& num_nodes = theContext()->getNumNodes(); - auto const& levels = std::log2(num_nodes); + auto const& levels = std::log2(num_nodes.get()); return levels; } diff --git a/src/vt/collective/tree/tree.h b/src/vt/collective/tree/tree.h index 31ca47fbcb..35603c215c 100644 --- a/src/vt/collective/tree/tree.h +++ b/src/vt/collective/tree/tree.h @@ -67,8 +67,8 @@ static struct DefaultTreeConstructTag { } tree_cons_tag_t { }; * tree on each node. */ struct Tree { - using NodeListType = std::vector; - using OperationType = std::function; + using NodeListType = std::vector ; + using OperationType = std::function; using NumLevelsType = int32_t; /** @@ -98,7 +98,7 @@ struct Tree { * \param[in] in_children the list of children */ Tree( - bool const in_is_root, NodeType const& parent, + bool const in_is_root, NodeT const& parent, NodeListType const& in_children ); @@ -112,14 +112,14 @@ struct Tree { * * \return the parent node */ - NodeType getParent() const; + NodeT getParent() const; /** * \internal \brief Get the number of children nodes * * \return the number of children nodes */ - NodeType getNumChildren() const; + NodeT getNumChildren() const; /** * \internal \brief Get whether this node is the root @@ -140,7 +140,7 @@ struct Tree { * * \return list of children */ - NodeListType getChildren(NodeType node) const; + NodeListType getChildren(NodeT node) const; /** * \internal \brief Apply function (foreach) across all children @@ -175,7 +175,7 @@ struct Tree { * * \return number of descendants */ - std::size_t getNumDescendants(NodeType child) const; + std::size_t getNumDescendants(NodeT child) const; /** * \internal \brief Get total number of descendants in the tree. @@ -186,7 +186,7 @@ struct Tree { private: bool set_up_tree_ = false; - NodeType parent_ = uninitialized_destination; + NodeT parent_ = {}; bool is_root_ = false; NodeListType children_; }; diff --git a/src/vt/config.h b/src/vt/config.h index 881262eee6..6ee5ad9424 100644 --- a/src/vt/config.h +++ b/src/vt/config.h @@ -45,6 +45,7 @@ #define INCLUDED_VT_CONFIG_H #include "vt/configs/debug/debug_masterconfig.h" +#include "vt/configs/types/types_node.h" #include "vt/configs/types/types_headers.h" #include "vt/configs/error/error_headers.h" diff --git a/src/vt/configs/arguments/args.cc b/src/vt/configs/arguments/args.cc index 0e8d8f0186..4d9b9e569c 100644 --- a/src/vt/configs/arguments/args.cc +++ b/src/vt/configs/arguments/args.cc @@ -224,7 +224,7 @@ void addMemUsageArgs(CLI::App& app, AppConfig& appConfig) { */ auto mem_desc = "List of memory reporters to query in order of precedence"; auto mem_phase = "Print memory usage each new phase"; - auto mem_node = "Node to print memory usage from or \"all\""; + auto mem_node = "NodeT to print memory usage from or \"all\""; auto mem_ps = "Enable memory reporting with PS (warning: forking to query 'ps' may not be scalable)"; auto mem_at_thresh = "Print memory usage from scheduler when reaches a threshold increment"; auto mem_thresh = "The threshold increments to print memory usage: \" {GiB,MiB,KiB,B}\""; diff --git a/src/vt/configs/debug/debug_colorize.h b/src/vt/configs/debug/debug_colorize.h index c6c6f8a2c5..59ca295e60 100644 --- a/src/vt/configs/debug/debug_colorize.h +++ b/src/vt/configs/debug/debug_colorize.h @@ -46,6 +46,7 @@ #include "vt/configs/arguments/app_config.h" #include "vt/configs/types/types_type.h" +#include "vt/configs/types/types_node.h" #include @@ -82,7 +83,7 @@ inline std::string reg(std::string str) { inline std::string vtPre() { return bd_green() + std::string("vt") + reset() + ": "; } -inline std::string proc(vt::NodeType const& node) { +inline std::string proc(vt::NodeT const& node) { return blue() + "[" + std::to_string(node) + "]" + reset(); } diff --git a/src/vt/configs/debug/debug_print.h b/src/vt/configs/debug/debug_print.h index 2fd664a351..6e20d1c24d 100644 --- a/src/vt/configs/debug/debug_print.h +++ b/src/vt/configs/debug/debug_print.h @@ -275,7 +275,7 @@ extern runtime::Runtime* curRT; } /* end namespace vt */ namespace vt { namespace debug { -NodeType preNode(); +NodeT preNode(); }} /* end namespace vt::debug */ namespace vt { namespace config { @@ -284,7 +284,7 @@ template struct DebugPrintOp; template -static inline void debugPrintImpl(NodeType node, Arg&& arg, Args&&... args) { +static inline void debugPrintImpl(NodeT node, Arg&& arg, Args&&... args) { constexpr auto mask = ModeEnum::terse | ModeEnum::normal | ModeEnum::verbose; constexpr auto level = mod & mask; if (level <= vt::debug::preConfig()->vt_debug_level_val) { @@ -332,7 +332,7 @@ struct DebugPrintOp { template void operator()(bool const rt_option, Arg&& arg, Args&&... args) { if (rt_option or vt::debug::preConfig()->vt_debug_all) { - debugPrintImpl(-1,std::forward(arg),std::forward(args)...); + debugPrintImpl(NodeT{-1},std::forward(arg),std::forward(args)...); } } }; diff --git a/src/vt/configs/error/common.h b/src/vt/configs/error/common.h index 7a215d25f1..632e2f8479 100644 --- a/src/vt/configs/error/common.h +++ b/src/vt/configs/error/common.h @@ -44,7 +44,7 @@ #if !defined INCLUDED_VT_CONFIGS_ERROR_COMMON_H #define INCLUDED_VT_CONFIGS_ERROR_COMMON_H -#include "vt/configs/types/types_type.h" +#include "vt/configs/types/types_node.h" #define INVERT_COND(cond) (!(cond)) #define DEBUG_LOCATION __FILE__,__LINE__,__func__ @@ -53,8 +53,8 @@ namespace vt { namespace debug { -extern NodeType preNode(); -extern NodeType preNodes(); +extern NodeT preNode(); +extern NodeT preNodes(); }} /* end namespace vt::debug */ diff --git a/src/vt/configs/error/stack_out.cc b/src/vt/configs/error/stack_out.cc index 720a978964..75c321d90b 100644 --- a/src/vt/configs/error/stack_out.cc +++ b/src/vt/configs/error/stack_out.cc @@ -180,7 +180,7 @@ std::string prettyPrintStack(DumpStackType const& stack) { auto node_str = ::vt::debug::proc(node); auto prefix = vt_pre + node_str + " "; auto seperator = fmt::format("{}{}{:-^120}{}\n", prefix, yellow, "", reset); - auto title_node = fmt::format("on Node {}", node); + auto title_node = fmt::format("on NodeT {}", node); auto title = fmt::format(" Dump Stack Backtrace {} ", title_node); std::string out = ""; diff --git a/src/vt/configs/types/types_node.h b/src/vt/configs/types/types_node.h new file mode 100644 index 0000000000..77631ddc60 --- /dev/null +++ b/src/vt/configs/types/types_node.h @@ -0,0 +1,67 @@ +/* +//@HEADER +// ***************************************************************************** +// +// types_node.h +// DARMA/vt => Virtual Transport +// +// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC +// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, 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: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * 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. +// +// * Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR 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 darma@sandia.gov +// +// ***************************************************************************** +//@HEADER +*/ + +#if !defined INCLUDED_VT_CONFIGS_TYPES_NODE_H +#define INCLUDED_VT_CONFIGS_TYPES_NODE_H + +#include "vt/utils/strong/strong_type.h" +#include "vt/utils/bits/bits_counter.h" +namespace vt { + +using BaseNodeType = int16_t; +static constexpr BaseNodeType const uninitialized_destination = + static_cast(0xFFFF); +struct StrongType { }; + +struct StrongNodeType { }; +using NodeT = Strong; + +/// Used for generically store an action that requires a node +using ActionNodeType = std::function; + +static constexpr BitCountType const + node_num_bits = utils::BitCounter::value; + +} // namespace vt + +#endif // INCLUDED_VT_CONFIGS_TYPES_NODE_H \ No newline at end of file diff --git a/src/vt/configs/types/types_sentinels.h b/src/vt/configs/types/types_sentinels.h index cc2235a17a..8458de701e 100644 --- a/src/vt/configs/types/types_sentinels.h +++ b/src/vt/configs/types/types_sentinels.h @@ -50,8 +50,6 @@ namespace vt { // Physical identifier sentinel values (nodes etc.) -static constexpr NodeType const uninitialized_destination = static_cast(0xFFFF); - static constexpr PhysicalResourceType const no_workers [[deprecated]] = static_cast(0xFFFF); // Runtime default `empty' sentinel value diff --git a/src/vt/configs/types/types_size.h b/src/vt/configs/types/types_size.h index fea70610fb..00ac00285f 100644 --- a/src/vt/configs/types/types_size.h +++ b/src/vt/configs/types/types_size.h @@ -49,8 +49,6 @@ namespace vt { -static constexpr BitCountType const - node_num_bits = utils::BitCounter::value; static constexpr BitCountType const handler_num_bits = utils::BitCounter::value; static constexpr BitCountType const diff --git a/src/vt/configs/types/types_type.h b/src/vt/configs/types/types_type.h index 6b7809311e..7e8c541710 100644 --- a/src/vt/configs/types/types_type.h +++ b/src/vt/configs/types/types_type.h @@ -54,7 +54,7 @@ namespace vt { // Physical identifier types (nodes, cores, workers, etc.) using PhysicalResourceType = int16_t; /// Used to hold the current node/rank or the number of nodes -using NodeType = PhysicalResourceType; +// using NodeT = PhysicalResourceType; /// Used to hold a core ID using CoreType = PhysicalResourceType; @@ -121,8 +121,7 @@ using ThreadIDType = uint64_t; using ActionType = std::function; /// Used for generically store an action that requires a proxy using ActionProxyType = std::function; -/// Used for generically store an action that requires a node -using ActionNodeType = std::function; + } // end namespace vt diff --git a/src/vt/context/context.cc b/src/vt/context/context.cc index 7c559883b8..1ba9a17611 100644 --- a/src/vt/context/context.cc +++ b/src/vt/context/context.cc @@ -81,15 +81,15 @@ Context::Context(bool const is_interop, MPI_Comm comm) { // Always duplicate, which may be MPI_COMM_WORLD. MPI_Comm_dup(comm, &comm); - int numNodesLocal = uninitialized_destination; - int thisNodeLocal = uninitialized_destination; + int numNodesLocal = {}; + int thisNodeLocal = {}; MPI_Comm_size(comm, &numNodesLocal); MPI_Comm_rank(comm, &thisNodeLocal); communicator_ = comm; - numNodes_ = static_cast(numNodesLocal); - thisNode_ = static_cast(thisNodeLocal); + numNodes_ = static_cast (numNodesLocal); + thisNode_ = static_cast (thisNodeLocal); } Context::~Context() { @@ -100,7 +100,7 @@ void Context::setTask(runnable::RunnableNew* in_task) { cur_task_ = in_task; } -NodeType Context::getFromNodeCurrentTask() const { +NodeT Context::getFromNodeCurrentTask() const { #if !vt_check_enabled(trace_only) if (getTask() != nullptr) { auto from = getTask()->get(); @@ -130,22 +130,22 @@ trace::TraceEventIDType Context::getTraceEventCurrentTask() const { namespace vt { namespace debug { -NodeType preNode() { +NodeT preNode() { #if !vt_check_enabled(trace_only) return ::vt::curRT != nullptr and ::vt::curRT->isLive() ? theContext()->getNode() : - -1; + NodeT{-1}; #else - return theContext() ? theContext()->getNode() : -1; + return theContext() ? theContext()->getNode() : NodeT{-1}; #endif } -NodeType preNodes() { +NodeT preNodes() { #if !vt_check_enabled(trace_only) return ::vt::curRT != nullptr and ::vt::curRT->isLive() ? theContext()->getNumNodes() : - -1; + NodeT{-1}; #else - return theContext() ? theContext()->getNode() : -1; + return theContext() ? theContext()->getNode() : NodeT{-1}; #endif } diff --git a/src/vt/context/context.h b/src/vt/context/context.h index c391ee0305..b9f930dc01 100644 --- a/src/vt/context/context.h +++ b/src/vt/context/context.h @@ -96,20 +96,20 @@ struct Context : runtime::component::Component { * \brief Gets the current node (analagous to MPI's rank) currently being * used. * - * \see \c vt::NodeType + * \see \c vt::NodeT * * \return the node currently being run on */ - inline NodeType getNode() const { return thisNode_; } + inline NodeT getNode() const { return thisNode_; } /** * \brief Get the number of nodes (analagous to MPI's num ranks) being used * - * \see \c vt::NodeType + * \see \c vt::NodeT * * \return the number of nodes currently being run on */ - inline NodeType getNumNodes() const { return numNodes_; } + inline NodeT getNumNodes() const { return numNodes_; } /** * \brief Get the MPI communicator being used by VT in a given runtime @@ -152,7 +152,7 @@ struct Context : runtime::component::Component { * * \return the node that sent the message that triggered the current task */ - NodeType getFromNodeCurrentTask() const; + NodeT getFromNodeCurrentTask() const; #if vt_check_enabled(trace_enabled) /** @@ -174,8 +174,8 @@ struct Context : runtime::component::Component { void setTask(runnable::RunnableNew* in_task); private: - NodeType thisNode_ = uninitialized_destination; - NodeType numNodes_ = uninitialized_destination; + NodeT thisNode_ = {}; + NodeT numNodes_ = {}; MPI_Comm communicator_ = MPI_COMM_NULL; runnable::RunnableNew* cur_task_ = nullptr; }; diff --git a/src/vt/context/runnable_context/set_context.h b/src/vt/context/runnable_context/set_context.h index 3b32dd275a..8f641d4448 100644 --- a/src/vt/context/runnable_context/set_context.h +++ b/src/vt/context/runnable_context/set_context.h @@ -66,7 +66,7 @@ struct SetContext { * \param[in] in_from_node the from node on the message that caused a task to * run */ - SetContext(runnable::RunnableNew* in_cur_task, NodeType in_from_node) + SetContext(runnable::RunnableNew* in_cur_task, NodeT in_from_node) : cur_task_(in_cur_task), node_(in_from_node) {} @@ -76,7 +76,7 @@ struct SetContext { * * \return the node */ - NodeType get() const { return node_; } + NodeT get() const { return node_; } /** * \brief Preserve the existing task and replace with a new one @@ -98,7 +98,7 @@ struct SetContext { /// The new runnable that is replacing it util::ObserverPtr cur_task_ = nullptr; util::ObserverPtr suspended_task_ = nullptr; - NodeType node_ = uninitialized_destination; /**< The from node */ + NodeT node_ = {}; /**< The from node */ }; }} /* end namespace vt::ctx */ diff --git a/src/vt/context/runnable_context/trace.cc b/src/vt/context/runnable_context/trace.cc index bb955a8212..17633ea38c 100644 --- a/src/vt/context/runnable_context/trace.cc +++ b/src/vt/context/runnable_context/trace.cc @@ -64,7 +64,7 @@ void Trace::start(TimeType time) { if (is_collection_) { auto const cur_node = theContext()->getFromNodeCurrentTask(); auto const from_node = - from_node_ != uninitialized_destination ? from_node_ : cur_node; + from_node_ != {} ? from_node_ : cur_node; processing_tag_ = theTrace()->beginProcessing( trace_id, msg_size_, event_, from_node, idx1_, idx2_, idx3_, idx4_, time diff --git a/src/vt/context/runnable_context/trace.h b/src/vt/context/runnable_context/trace.h index aa4577bf28..b785c5ac0a 100644 --- a/src/vt/context/runnable_context/trace.h +++ b/src/vt/context/runnable_context/trace.h @@ -71,7 +71,7 @@ struct Trace { */ template Trace( - MsgT const& msg, HandlerType const in_handler, NodeType const in_from_node + MsgT const& msg, HandlerType const in_handler, NodeT const in_from_node ); /** @@ -90,7 +90,7 @@ struct Trace { template Trace( MsgT const& msg, trace::TraceEventIDType const in_trace_event, - HandlerType const in_handler, NodeType const in_from_node, + HandlerType const in_handler, NodeT const in_from_node, uint64_t in_idx1, uint64_t in_idx2, uint64_t in_idx3, uint64_t in_idx4 ); @@ -116,7 +116,7 @@ struct Trace { /// Whether this is traced bool is_traced_ = false; /// The from node - NodeType from_node_ = uninitialized_destination; + NodeT from_node_ = {}; /// The active handler for extracting trace info HandlerType handler_ = uninitialized_handler; /// The collection indices diff --git a/src/vt/context/runnable_context/trace.impl.h b/src/vt/context/runnable_context/trace.impl.h index 840ac45034..0cc6749ca1 100644 --- a/src/vt/context/runnable_context/trace.impl.h +++ b/src/vt/context/runnable_context/trace.impl.h @@ -54,7 +54,7 @@ namespace vt { namespace ctx { template Trace::Trace( - MsgT const& msg, HandlerType const in_handler, NodeType const in_from_node + MsgT const& msg, HandlerType const in_handler, NodeT const in_from_node ) : is_collection_(false), event_(envelopeGetTraceEvent(msg->env)), msg_size_( @@ -68,7 +68,7 @@ Trace::Trace( template Trace::Trace( MsgT const& msg, trace::TraceEventIDType const in_trace_event, - HandlerType const in_handler, NodeType const in_from_node, + HandlerType const in_handler, NodeT const in_from_node, uint64_t in_idx1, uint64_t in_idx2, uint64_t in_idx3, uint64_t in_idx4 ) : is_collection_(true), event_(in_trace_event), diff --git a/src/vt/elm/elm_comm.h b/src/vt/elm/elm_comm.h index 692d06700a..f8490bf826 100644 --- a/src/vt/elm/elm_comm.h +++ b/src/vt/elm/elm_comm.h @@ -53,15 +53,15 @@ namespace vt { namespace elm { enum struct CommCategory : int8_t { SendRecv = 1, CollectionToNode = 2, - NodeToCollection = 3, + NodeCollection = 3, Broadcast = 4, CollectionToNodeBcast = 5, - NodeToCollectionBcast = 6, + NodeCollectionBcast = 6, CollectiveToCollectionBcast = 7, LocalInvoke = 8 }; -inline NodeType objGetNode(ElementIDStruct const id) { +inline NodeT objGetNode(ElementIDStruct const id) { return id.curr_node; } @@ -94,25 +94,25 @@ struct CommKey { { } CommKey( CollectionToNodeTag, - ElementIDStruct from, NodeType to, + ElementIDStruct from, NodeT to, bool bcast ) : from_(from), nto_(to), cat_(bcast ? CommCategory::CollectionToNodeBcast : CommCategory::CollectionToNode) { } CommKey( NodeToCollectionTag, - NodeType from, ElementIDStruct to, + NodeT from, ElementIDStruct to, bool bcast ) : to_(to), nfrom_(from), - cat_(bcast ? CommCategory::NodeToCollectionBcast : CommCategory::NodeToCollection) + cat_(bcast ? CommCategory::NodeCollectionBcast : CommCategory::NodeCollection) { } ElementIDStruct from_ = {}; ElementIDStruct to_ = {}; ElementIDStruct edge_id_ = {}; - NodeType nfrom_ = uninitialized_destination; - NodeType nto_ = uninitialized_destination; + NodeT nfrom_ = {}; + NodeT nto_ = {}; CommCategory cat_ = CommCategory::SendRecv; ElementIDStruct fromObj() const { return from_; } @@ -128,7 +128,7 @@ struct CommKey { return objGetNode(from_) != objGetNode(to_); } else if (cat_ == CommCategory::CollectionToNode) { return objGetNode(from_) != nto_; - } else if (cat_ == CommCategory::NodeToCollection) { + } else if (cat_ == CommCategory::NodeCollection) { return objGetNode(to_) != nfrom_; } else { return true; diff --git a/src/vt/elm/elm_id.cc b/src/vt/elm/elm_id.cc index 089ed2953e..e52d23c843 100644 --- a/src/vt/elm/elm_id.cc +++ b/src/vt/elm/elm_id.cc @@ -50,11 +50,11 @@ bool ElementIDStruct::isMigratable() const { return ElmIDBits::isMigratable(id); } -NodeType ElementIDStruct::getHomeNode() const { +NodeT ElementIDStruct::getHomeNode() const { return ElmIDBits::getNode(id); } -NodeType ElementIDStruct::getCurrNode() const { +NodeT ElementIDStruct::getCurrNode() const { return curr_node; } diff --git a/src/vt/elm/elm_id.h b/src/vt/elm/elm_id.h index b4be4682a0..20b5be327f 100644 --- a/src/vt/elm/elm_id.h +++ b/src/vt/elm/elm_id.h @@ -45,6 +45,7 @@ #define INCLUDED_VT_ELM_ELM_ID_H #include "vt/configs/types/types_type.h" +#include "vt/configs/types/types_node.h" #include "vt/configs/types/types_sentinels.h" namespace vt { namespace elm { @@ -73,11 +74,11 @@ struct ElementIDStruct { } ElementIDType id = no_element_id; /**< id must be unique across nodes */ - NodeType curr_node = uninitialized_destination; /**< the current node */ + NodeT curr_node = {}; /**< the current node */ bool isMigratable() const; - NodeType getHomeNode() const; - NodeType getCurrNode() const; + NodeT getHomeNode() const; + NodeT getCurrNode() const; }; diff --git a/src/vt/elm/elm_id_bits.cc b/src/vt/elm/elm_id_bits.cc index 3d0e12cf8b..636ea860e8 100644 --- a/src/vt/elm/elm_id_bits.cc +++ b/src/vt/elm/elm_id_bits.cc @@ -50,7 +50,7 @@ namespace vt { namespace elm { /*static*/ ElementIDStruct ElmIDBits::createCollection( - bool migratable, NodeType curr_node + bool migratable, NodeT curr_node ) { auto const seq_id = theNodeLBData()->getNextElm(); auto const home_node = theContext()->getNode(); @@ -58,7 +58,7 @@ namespace vt { namespace elm { } /*static*/ ElementIDStruct ElmIDBits::createCollectionImpl( - bool migratable, ElementIDType seq_id, NodeType home_node, NodeType curr_node + bool migratable, ElementIDType seq_id, NodeT home_node, NodeT curr_node ) { ElementIDType ret = 0; setCollectionID(ret, migratable, seq_id, home_node); @@ -66,7 +66,7 @@ namespace vt { namespace elm { } /*static*/ ElementIDStruct ElmIDBits::createObjGroup( - ObjGroupProxyType proxy, NodeType node + ObjGroupProxyType proxy, NodeT node ) { ElementIDType ret = 0; setObjGroup(ret, proxy, node); @@ -74,12 +74,12 @@ namespace vt { namespace elm { return ElementIDStruct{ret, this_node}; } -/*static*/ ElementIDStruct ElmIDBits::createBareHandler(NodeType node) { +/*static*/ ElementIDStruct ElmIDBits::createBareHandler(NodeT node) { ElementIDType ret = 0; BitPackerType::setField( ret, BareHandler ); - constexpr auto num_node_bits = BitCounterType::value; + constexpr auto num_node_bits = BitCounterType ::value; BitPackerType::setField( ret, node ); @@ -87,7 +87,7 @@ namespace vt { namespace elm { } /*static*/ void ElmIDBits::setObjGroup( - ElementIDType& id, ObjGroupProxyType proxy, NodeType node + ElementIDType& id, ObjGroupProxyType proxy, NodeT node ) { BitPackerType::setField( id, ObjGroup @@ -100,12 +100,12 @@ namespace vt { namespace elm { } /*static*/ void ElmIDBits::setCollectionID( - ElementIDType& id, bool migratable, ElementIDType seq_id, NodeType node + ElementIDType& id, bool migratable, ElementIDType seq_id, NodeT node ) { BitPackerType::setField( id, migratable ? CollectionMigratable : CollectionNonMigratable ); - constexpr auto num_node_bits = BitCounterType::value; + constexpr auto num_node_bits = BitCounterType ::value; BitPackerType::setField( id, node ); @@ -127,15 +127,15 @@ namespace vt { namespace elm { ); } -/*static*/ NodeType ElmIDBits::getNode(ElementIDType id) { +/*static*/ NodeT ElmIDBits::getNode(ElementIDType id) { auto const ctrl = getControlBits(id); if (ctrl == ObjGroup) { auto const proxy = ElmIDBits::getObjGroupProxy(id, true); return objgroup::proxy::ObjGroupProxy::getNode(proxy); } else { - constexpr auto num_node_bits = BitCounterType::value; + constexpr auto num_node_bits = BitCounterType ::value; return BitPackerType::getField< - eElmIDProxyBitsNonObjGroup::Node, num_node_bits, NodeType + eElmIDProxyBitsNonObjGroup::Node, num_node_bits, NodeT >(id); } } @@ -148,7 +148,7 @@ namespace vt { namespace elm { eElmIDProxyBitsObjGroup::ObjGroupID, proxy_bits, ObjGroupProxyType >(id); if (not include_node) { - objgroup::proxy::ObjGroupProxy::setNode(proxy, 0); + objgroup::proxy::ObjGroupProxy::setNode(proxy, NodeT{0}); } return proxy; } diff --git a/src/vt/elm/elm_id_bits.h b/src/vt/elm/elm_id_bits.h index 4dab5c5c0d..4a3222c9af 100644 --- a/src/vt/elm/elm_id_bits.h +++ b/src/vt/elm/elm_id_bits.h @@ -46,6 +46,7 @@ #include "vt/configs/types/types_type.h" #include "vt/utils/bits/bits_common.h" +#include "vt/configs/types/types_node.h" #include "vt/elm/elm_id.h" namespace vt { namespace elm { @@ -67,31 +68,31 @@ enum eElmIDProxyBitsObjGroup { enum eElmIDProxyBitsNonObjGroup { Control2 = 0, Node = num_control_bits, - ID = eElmIDProxyBitsNonObjGroup::Node + BitCounterType::value + ID = eElmIDProxyBitsNonObjGroup::Node + node_num_bits }; static constexpr BitCountType const elm_id_num_bits = - BitCounterType::value - (2 + BitCounterType::value); + BitCounterType::value - (2 + node_num_bits); struct ElmIDBits { - static ElementIDStruct createCollection(bool migratable, NodeType curr_node); - static ElementIDStruct createObjGroup(ObjGroupProxyType proxy, NodeType node); - static ElementIDStruct createBareHandler(NodeType node); + static ElementIDStruct createCollection(bool migratable, NodeT curr_node); + static ElementIDStruct createObjGroup(ObjGroupProxyType proxy, NodeT node); + static ElementIDStruct createBareHandler(NodeT node); static ElementIDStruct createCollectionImpl( - bool migratable, ElementIDType seq_id, NodeType home_node, NodeType curr_node + bool migratable, ElementIDType seq_id, NodeT home_node, NodeT curr_node ); static void setObjGroup( - ElementIDType& id, ObjGroupProxyType proxy, NodeType node + ElementIDType& id, ObjGroupProxyType proxy, NodeT node ); static void setCollectionID( - ElementIDType& id, bool migratable, ElementIDType seq_id, NodeType node + ElementIDType& id, bool migratable, ElementIDType seq_id, NodeT node ); static eElmIDControlBits getControlBits(ElementIDType id); static bool isMigratable(ElementIDType id); - static NodeType getNode(ElementIDType id); + static NodeT getNode(ElementIDType id); static ObjGroupProxyType getObjGroupProxy(ElementIDType id, bool include_node); }; diff --git a/src/vt/elm/elm_lb_data.cc b/src/vt/elm/elm_lb_data.cc index ff8f09ebad..4ab3d93f2e 100644 --- a/src/vt/elm/elm_lb_data.cc +++ b/src/vt/elm/elm_lb_data.cc @@ -109,7 +109,7 @@ void ElementLBData::recvObjData( } void ElementLBData::recvFromNode( - ElementIDStruct pto, NodeType from, + ElementIDStruct pto, NodeT from, double bytes, bool bcast ) { elm::CommKey key(elm::CommKey::NodeToCollectionTag{}, from, pto, bcast); @@ -117,7 +117,7 @@ void ElementLBData::recvFromNode( } void ElementLBData::recvToNode( - NodeType to, ElementIDStruct pfrom, + NodeT to, ElementIDStruct pfrom, double bytes, bool bcast ) { elm::CommKey key(elm::CommKey::CollectionToNodeTag{}, pfrom, to, bcast); diff --git a/src/vt/elm/elm_lb_data.h b/src/vt/elm/elm_lb_data.h index 1ebc07c6c3..a855a5a001 100644 --- a/src/vt/elm/elm_lb_data.h +++ b/src/vt/elm/elm_lb_data.h @@ -74,11 +74,11 @@ struct ElementLBData { ElementIDStruct from_perm, double bytes, bool bcast ); void recvFromNode( - ElementIDStruct to_perm, NodeType from, + ElementIDStruct to_perm, NodeT from, double bytes, bool bcast ); void recvToNode( - NodeType to, ElementIDStruct from_perm, + NodeT to, ElementIDStruct from_perm, double bytes, bool bcast ); void updatePhase(PhaseType const& inc = 1); diff --git a/src/vt/epoch/epoch.h b/src/vt/epoch/epoch.h index f3a84d9e94..79e769d8ed 100644 --- a/src/vt/epoch/epoch.h +++ b/src/vt/epoch/epoch.h @@ -64,13 +64,13 @@ namespace vt { namespace epoch { * *where* h = epoch_header_num_bits, | \ * c = epoch_category_num_bits,| \ * w = sizeof(EpochType) * 8 | \ - * n = sizeof(NodeType) ^ 16 ^ 5 ^ [remainder] ^ + * n = sizeof (NodeT ) ^ 16 ^ 5 ^ [remainder] ^ * / | * / | * _______ | * / \ * | .... n .... | ..........................| - * + * * * +++++++++++++++++++++++++++++++++++++++++++ Rooted Extended Layout ++ * @@ -162,7 +162,7 @@ enum eEpochRoot { }; /// The default epoch node used for non-rooted epochs -static constexpr NodeType const default_epoch_node = uninitialized_destination; +static constexpr NodeT const default_epoch_node = {}; /// The default epoch category static constexpr eEpochCategory const default_epoch_category = diff --git a/src/vt/epoch/epoch_manip.cc b/src/vt/epoch/epoch_manip.cc index 779286c6f1..83df89b007 100644 --- a/src/vt/epoch/epoch_manip.cc +++ b/src/vt/epoch/epoch_manip.cc @@ -62,7 +62,7 @@ EpochManip::EpochManip() { } /*static*/ EpochType EpochManip::generateEpoch( - bool const& is_rooted, NodeType const& root_node, + bool const& is_rooted, NodeT const& root_node, eEpochCategory const& category ) { EpochType new_epoch = makeEpochZero(); @@ -74,7 +74,7 @@ EpochManip::EpochManip() } if (is_rooted) { - vtAssertExpr(root_node != uninitialized_destination); + vtAssertExpr(root_node != NodeT{}); EpochManip::setNode(new_epoch, root_node); } @@ -95,7 +95,7 @@ EpochManip::EpochManip() EpochType EpochManip::getNextCollectiveEpoch( eEpochCategory const& category ) { - auto const no_dest = uninitialized_destination; + auto const no_dest = NodeT{}; auto const arch_epoch = generateEpoch(false,no_dest,category); return getTerminatedWindow(arch_epoch)->allocateNewEpoch(); } @@ -109,7 +109,7 @@ EpochType EpochManip::getNextRootedEpoch( } EpochType EpochManip::getNextRootedEpoch( - eEpochCategory const& category, NodeType const root_node + eEpochCategory const& category, NodeT const root_node ) { auto const arch_epoch = generateEpoch(true,root_node,category); return getTerminatedWindow(arch_epoch)->allocateNewEpoch(); @@ -154,11 +154,11 @@ EpochWindow* EpochManip::getTerminatedWindow(EpochType epoch) { >(*epoch); } -/*static*/ NodeType EpochManip::node(EpochType const& epoch) { +/*static*/ NodeT EpochManip::node(EpochType const& epoch) { vtAssert(isRooted(epoch), "Must be rooted to manipulate the node"); return BitPackerType::getField< - eEpochRoot::rEpochNode, node_num_bits, NodeType + eEpochRoot::rEpochNode, node_num_bits, NodeT >(*epoch); } @@ -191,7 +191,7 @@ void EpochManip::setCategory(EpochType& epoch, eEpochCategory const cat) { } /*static*/ -void EpochManip::setNode(EpochType& epoch, NodeType const node) { +void EpochManip::setNode(EpochType& epoch, NodeT const node) { vtAssert(isRooted(epoch), "Must be rooted to manipulate the node"); BitPackerType::setField(*epoch,node); diff --git a/src/vt/epoch/epoch_manip.h b/src/vt/epoch/epoch_manip.h index c27649b87d..03fcd82b14 100644 --- a/src/vt/epoch/epoch_manip.h +++ b/src/vt/epoch/epoch_manip.h @@ -105,7 +105,7 @@ struct EpochManip : runtime::component::Component { * * \return the node (arbitrator) for the \c epoch */ - static NodeType node(EpochType const& epoch); + static NodeT node(EpochType const& epoch); /** * \brief Gets the sequential ID for an epoch @@ -142,7 +142,7 @@ struct EpochManip : runtime::component::Component { * \param[in,out] epoch the epoch to modify * \param[in] node whether to set the epoch as rooted or not */ - static void setNode(EpochType& epoch, NodeType const node); + static void setNode(EpochType& epoch, NodeT const node); /** * \brief Set the sequential ID for an \c epoch @@ -179,7 +179,7 @@ struct EpochManip : runtime::component::Component { */ static EpochType generateEpoch( bool const& is_rooted = false, - NodeType const& root_node = default_epoch_node, + NodeT const& root_node = default_epoch_node, eEpochCategory const& category = default_epoch_category ); @@ -209,7 +209,7 @@ struct EpochManip : runtime::component::Component { * \return the newly created epoch */ EpochType getNextRootedEpoch( - eEpochCategory const& category, NodeType const root_node + eEpochCategory const& category, NodeT const root_node ); /** diff --git a/src/vt/event/event.cc b/src/vt/event/event.cc index 59737386cc..c4b82f4577 100644 --- a/src/vt/event/event.cc +++ b/src/vt/event/event.cc @@ -154,7 +154,7 @@ EventType AsyncEvent::attachAction(EventType const& event, ActionType callable) auto const& node = theEvent()->getOwningNode(event); vtAssert( - node == theContext()->getNode(), "Node must be identical" + node == theContext()->getNode(), "NodeT must be identical" ); auto send_back_fun = [=]{ @@ -207,7 +207,7 @@ bool AsyncEvent::isLocalTerm() { return event_container_.size() == 0; } -NodeType AsyncEvent::getOwningNode(EventType const& event) { +::vt::NodeT AsyncEvent::getOwningNode(EventType const& event) { return EventManagerType::getEventNode(event); } @@ -217,7 +217,7 @@ bool AsyncEvent::needsPolling(EventRecordTypeType const& type) { } EventType AsyncEvent::createEvent( - EventRecordTypeType const& type, NodeType const& node + EventRecordTypeType const& type, ::vt::NodeT const& node ) { EventType const event = EventManagerType::makeEvent(cur_event_, node); cur_event_++; @@ -238,15 +238,15 @@ EventType AsyncEvent::createEvent( return event; } -EventType AsyncEvent::createMPIEvent(NodeType const& node) { +EventType AsyncEvent::createMPIEvent(::vt::NodeT const& node) { return createEvent(EventRecordTypeType::MPI_EventRecord, node); } -EventType AsyncEvent::createNormalEvent(NodeType const& node) { +EventType AsyncEvent::createNormalEvent(::vt::NodeT const& node) { return createEvent(EventRecordTypeType::NormalEventRecord, node); } -EventType AsyncEvent::createParentEvent(NodeType const& node) { +EventType AsyncEvent::createParentEvent(::vt::NodeT const& node) { return createEvent(EventRecordTypeType::ParentEventRecord, node); } diff --git a/src/vt/event/event.h b/src/vt/event/event.h index 23334dc65e..4e5fad7e8e 100644 --- a/src/vt/event/event.h +++ b/src/vt/event/event.h @@ -109,7 +109,7 @@ struct AsyncEvent : runtime::component::PollableComponent { * * \return a new event identifier */ - EventType createEvent(EventRecordTypeType const& type, NodeType const& node); + EventType createEvent(EventRecordTypeType const& type, ::vt::NodeT const& node); /** * \brief Get the event record @@ -127,7 +127,7 @@ struct AsyncEvent : runtime::component::PollableComponent { * * \return the node that owns the event */ - NodeType getOwningNode(EventType const& event); + ::vt::NodeT getOwningNode(EventType const& event); /** * \brief Create a new MPI event that holds a MPI_Request @@ -136,7 +136,7 @@ struct AsyncEvent : runtime::component::PollableComponent { * * \return the event identifier */ - EventType createMPIEvent(NodeType const& node); + EventType createMPIEvent(::vt::NodeT const& node); /** * \brief Create a regular type event @@ -145,7 +145,7 @@ struct AsyncEvent : runtime::component::PollableComponent { * * \return the event identifier */ - EventType createNormalEvent(NodeType const& node); + EventType createNormalEvent(::vt::NodeT const& node); /** * \brief Create a parent event that can have multiple children @@ -154,7 +154,7 @@ struct AsyncEvent : runtime::component::PollableComponent { * * \return the event identifier */ - EventType createParentEvent(NodeType const& node); + EventType createParentEvent(::vt::NodeT const& node); /** * \brief Get the holder for an event diff --git a/src/vt/event/event_id.cc b/src/vt/event/event_id.cc index 199f9e3d2a..deea77a852 100644 --- a/src/vt/event/event_id.cc +++ b/src/vt/event/event_id.cc @@ -47,7 +47,7 @@ namespace vt { namespace event { /*static*/ EventType EventIDManager::makeEvent( - EventIdentifierType const& id, NodeType const& node + EventIdentifierType const& id, ::vt::NodeT const& node ) { EventType new_event_id = 0; EventIDManager::setEventNode(new_event_id, node); @@ -61,14 +61,14 @@ namespace vt { namespace event { return new_event_id; } -/*static*/ NodeType EventIDManager::getEventNode(EventType const& event) { +/*static*/ ::vt::NodeT EventIDManager::getEventNode(EventType const& event) { return BitPackerType::getField< - EventIDBitsType::Node, node_num_bits, NodeType + EventIDBitsType::Node, node_num_bits, ::vt::NodeT >(event); } /*static*/ void EventIDManager::setEventNode( - EventType& event, NodeType const& node + EventType& event, ::vt::NodeT const& node ) { BitPackerType::setField(event, node); } diff --git a/src/vt/event/event_id.h b/src/vt/event/event_id.h index b063eb4745..2bfeef87d2 100644 --- a/src/vt/event/event_id.h +++ b/src/vt/event/event_id.h @@ -55,7 +55,7 @@ static constexpr BitCountType const event_identifier_num_bits = 32; enum eEventIDBits { Node = 0, - EventIdent = eEventIDBits::Node + node_num_bits + EventIdent = eEventIDBits::Node + node_num_bits }; struct EventIDManager { @@ -63,9 +63,9 @@ struct EventIDManager { EventIDManager() = default; - static EventType makeEvent(EventIdentifierType const& id, NodeType const& node); - static NodeType getEventNode(EventType const& event); - static void setEventNode(EventType& event, NodeType const& node); + static EventType makeEvent(EventIdentifierType const& id, ::vt::NodeT const& node); + static ::vt::NodeT getEventNode(EventType const& event); + static void setEventNode(EventType& event, ::vt::NodeT const& node); static void setEventIdentifier(EventType& event, EventIdentifierType const& id); static EventIdentifierType getEventIdentifier(EventType const& event); diff --git a/src/vt/event/event_msgs.h b/src/vt/event/event_msgs.h index 48f1b86b98..69c55c97c3 100644 --- a/src/vt/event/event_msgs.h +++ b/src/vt/event/event_msgs.h @@ -51,10 +51,10 @@ namespace vt { struct EventCheckFinishedMsg : ShortMessage { EventType event_ = 0, event_back_ = 0; - NodeType sent_from_node_ = 0; + NodeT sent_from_node_ = NodeT {0}; EventCheckFinishedMsg( - EventType const& event_in, NodeType const& in_sent_from_node, + EventType const& event_in, NodeT const& in_sent_from_node, EventType const& event_back_in ) : ShortMessage(), event_(event_in), event_back_(event_back_in), diff --git a/src/vt/group/collective/group_collective.h b/src/vt/group/collective/group_collective.h index 1524297220..5d72172a4b 100644 --- a/src/vt/group/collective/group_collective.h +++ b/src/vt/group/collective/group_collective.h @@ -71,8 +71,8 @@ struct GroupCollective { friend struct InfoColl; protected: - NodeType getInitialParent() const { return init_span_->getParent(); } - NodeType getInitialChildren() const { return init_span_->getNumChildren(); } + ::vt::NodeT getInitialParent() const { return init_span_->getParent(); } + size_t getInitialChildren() const { return init_span_->getNumChildren(); } bool isInitialRoot() const { return init_span_->isRoot(); } NodeListType const& getChildren() const { return init_span_->getChildren(); } @@ -80,7 +80,7 @@ struct GroupCollective { TreePtrType span_ = nullptr; TreePtrType init_span_ = nullptr; NodeListType span_children_ = {}; - NodeType parent_ = uninitialized_destination; + ::vt::NodeT parent_ = {}; ReducePtrType reduce_ = nullptr; }; diff --git a/src/vt/group/collective/group_collective_finished.cc b/src/vt/group/collective/group_collective_finished.cc index a327676f17..2ad60ac8dc 100644 --- a/src/vt/group/collective/group_collective_finished.cc +++ b/src/vt/group/collective/group_collective_finished.cc @@ -63,7 +63,7 @@ void InfoColl::CollSetupFinished::operator()(FinishedReduceMsg* msg) { auto info = iter->second.get(); if ( info->known_root_node_ != this_node and - info->known_root_node_ != uninitialized_destination + info->known_root_node_ != ::vt::NodeT {} ) { auto nmsg = makeMessage( msg->getGroup(),info->new_tree_cont_ @@ -72,7 +72,7 @@ void InfoColl::CollSetupFinished::operator()(FinishedReduceMsg* msg) { info->known_root_node_, nmsg ); } else { - info->newTree(-1); + info->newTree(::vt::NodeT {-1}); } } diff --git a/src/vt/group/collective/group_collective_msg.h b/src/vt/group/collective/group_collective_msg.h index 6b4bcf649c..7eb9563b0c 100644 --- a/src/vt/group/collective/group_collective_msg.h +++ b/src/vt/group/collective/group_collective_msg.h @@ -67,16 +67,16 @@ struct GroupCollectiveInfoMsg : MsgT { GroupCollectiveInfoMsg() = default; GroupCollectiveInfoMsg( GroupType const& in_group, RemoteOperationIDType in_op, bool in_is_in_group, - NodeType const& in_subtree, - NodeType const& in_child_node = uninitialized_destination, + ::vt::NodeT const& in_subtree, + ::vt::NodeT const& in_child_node = {}, CountType const& level = 0, CountType const& extra_nodes = 0 ) : MsgT(in_group, in_op), is_in_group(in_is_in_group), child_node_(in_child_node), subtree_size_(in_subtree), extra_nodes_(extra_nodes), level_(level) { } - NodeType getChild() const { return child_node_; } - NodeType getSubtreeSize() const { return subtree_size_; } + ::vt::NodeT getChild() const { return child_node_; } + ::vt::NodeT getSubtreeSize() const { return subtree_size_; } bool isStatic() const { return is_static_; } bool isInGroup() const { return is_in_group; } CountType getExtraNodes() const { return extra_nodes_; } @@ -85,8 +85,8 @@ struct GroupCollectiveInfoMsg : MsgT { private: bool is_in_group = false; bool is_static_ = true; - NodeType child_node_ = uninitialized_destination; - NodeType subtree_size_ = 0; + ::vt::NodeT child_node_ = {}; + ::vt::NodeT subtree_size_ = 0; CountType extra_nodes_ = 0; CountType level_ = 0; }; diff --git a/src/vt/group/collective/group_info_collective.cc b/src/vt/group/collective/group_info_collective.cc index 7c7075eb67..fb5a6efd82 100644 --- a/src/vt/group/collective/group_info_collective.cc +++ b/src/vt/group/collective/group_info_collective.cc @@ -73,7 +73,7 @@ void InfoColl::setupCollectiveSingular() { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); auto const& in_group = is_in_group; - vtAssert(num_nodes == 1, "This method handles single node case"); + vtAssert(num_nodes == vt::NodeT{1}, "This method handles single node case"); if (in_group) { known_root_node_ = this_node; is_new_root_ = true; @@ -81,14 +81,14 @@ void InfoColl::setupCollectiveSingular() { has_root_ = true; is_default_group_ = true; } else { - known_root_node_ = uninitialized_destination; + known_root_node_ = {}; is_new_root_ = false; in_phase_two_ = true; has_root_ = true; is_default_group_ = false; } collective_->span_ = std::make_unique( - true,uninitialized_destination,TreeType::NodeListType{} + true,::vt::NodeT {},TreeType::NodeListType{} ); auto const& action = getAction(); if (action) { @@ -119,7 +119,7 @@ void InfoColl::setupCollective() { collective_ = std::make_unique(); } - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { return setupCollectiveSingular(); } @@ -222,7 +222,7 @@ void InfoColl::setupCollective() { ); if (collective_->getInitialChildren() == 0) { - auto const& size = static_cast(is_in_group ? 1 : 0); + auto const& size = static_cast<::vt::NodeT >(is_in_group ? 1 : 0); auto const& child = theContext()->getNode(); auto msg = makeMessage( group_, up_tree_cont_, in_group, size, child @@ -329,7 +329,7 @@ void InfoColl::upTree() { group, is_root, root_node, msg_list.size() ); - auto const& subtree_zero = static_cast(0); + auto const subtree_zero = ::vt::NodeT {0}; auto const& extra = static_cast( msg_in_group.size()-1 ); @@ -364,7 +364,7 @@ void InfoColl::upTree() { * usual */ auto const child = theContext()->getNode(); - auto const total_subtree = static_cast(subtree_ + subtree_this); + auto const total_subtree = static_cast<::vt::NodeT >(subtree_ + subtree_this); auto const level = msg_in_group.size() == 2 ? msg_in_group[0]->getLevel() + 1 : 0; @@ -404,7 +404,7 @@ void InfoColl::upTree() { ); auto msg = makeMessage( - group,op,is_in_group,static_cast(subtree_),child,0,extra + group,op,is_in_group,static_cast<::vt::NodeT >(subtree_),child,0,extra ); theMsg()->sendMsg(p, msg); /* @@ -427,7 +427,7 @@ void InfoColl::upTree() { subtree_ -= msg_in_group[0]->getSubtreeSize(); - auto const total_subtree = static_cast(subtree_ + subtree_this); + auto const total_subtree = static_cast<::vt::NodeT >(subtree_ + subtree_this); vt_debug_print( normal, group, @@ -467,7 +467,7 @@ void InfoColl::upTree() { tree_iter++; } - auto const total_subtree = static_cast(subtree_this + subtree_); + auto const total_subtree = static_cast<::vt::NodeT >(subtree_this + subtree_); vt_debug_print( normal, group, @@ -488,7 +488,7 @@ void InfoColl::upTree() { auto iter = msg_list.rbegin(); auto iter_end = msg_list.rend(); - NodeType* c = static_cast(std::malloc(sizeof(NodeType) * extra)); + NodeT * c = static_cast<::vt::NodeT *>(std::malloc(sizeof(::vt::NodeT ) * extra)); for (int i = 0; i < extra; i++) { GroupCollectiveMsg* tmsg = *iter; @@ -539,7 +539,7 @@ void InfoColl::newRoot(GroupCollectiveMsg* msg) { is_new_root_ = true; } -NodeType InfoColl::getRoot() const { +::vt::NodeT InfoColl::getRoot() const { vt_debug_print( verbose, group, "InfoColl::getRoot: group={:x}, has_root_={}, known_root_node_={}\n", @@ -547,7 +547,7 @@ NodeType InfoColl::getRoot() const { ); if (!has_root_) { - return uninitialized_destination; + return ::vt::NodeT {}; } else { return known_root_node_; } @@ -648,13 +648,13 @@ void InfoColl::downTree(GroupCollectiveMsg* msg) { theMsg()->sendMsg(from, nmsg); } -void InfoColl::newTree(NodeType const& parent) { +void InfoColl::newTree(::vt::NodeT const& parent) { if (not is_empty_group_) { vtAssert(is_in_group, "Must be in group"); } auto const& group_ = getGroupID(); - collective_->parent_ = is_new_root_ ? -1 : parent; + collective_->parent_ = is_new_root_ ? ::vt::NodeT{-1} : parent; sendDownNewTree(); auto const& is_root = is_new_root_; @@ -700,7 +700,7 @@ void InfoColl::finalize() { buf[0] = '\0'; int cur = 0; for (auto&& elm : collective_->span_children_) { - cur += sprintf(buf + cur, "%d,", elm); + cur += sprintf(buf + cur, "%d,", elm.get()); } auto const& num_children = collective_->span_children_.size(); @@ -737,7 +737,7 @@ void InfoColl::finalize() { } } - auto const& root = 0; + auto const& root = ::vt::NodeT{0}; using collective::reduce::makeStamp; using collective::reduce::StrongUserID; @@ -818,7 +818,7 @@ InfoColl::TreeType* InfoColl::getTree() const { vtAssert(in_phase_two_ , "Must be in phase two"); vtAssert(has_root_ , "Root node must be known by this node"); vtAssert( - known_root_node_ != uninitialized_destination, "Known root must be set" + known_root_node_ != ::vt::NodeT{}, "Known root must be set" ); return collective_->span_.get(); } diff --git a/src/vt/group/collective/group_info_collective.h b/src/vt/group/collective/group_info_collective.h index df251f40a1..3a1925187e 100644 --- a/src/vt/group/collective/group_info_collective.h +++ b/src/vt/group/collective/group_info_collective.h @@ -86,7 +86,7 @@ struct InfoColl : virtual InfoBase { public: ReducePtrType getReduce() const; - NodeType getRoot() const; + ::vt::NodeT getRoot() const; bool isGroupDefault() const; TreeType* getTree() const; bool inGroup() const; @@ -118,7 +118,7 @@ struct InfoColl : virtual InfoBase { void finalizeTree(GroupOnlyMsg* msg); void finalize(); void sendDownNewTree(); - void newTree(NodeType const& parent); + void newTree(::vt::NodeT const& parent); RemoteOperationIDType makeCollectiveContinuation(GroupType const group_); protected: @@ -133,7 +133,7 @@ struct InfoColl : virtual InfoBase { uint32_t extra_arrived_count_ = 0; uint32_t send_down_ = 0; uint32_t send_down_finished_ = 0; - NodeType known_root_node_ = uninitialized_destination; + ::vt::NodeT known_root_node_ = {}; bool is_new_root_ = false; bool has_root_ = false; bool is_default_group_ = false; diff --git a/src/vt/group/global/group_default.cc b/src/vt/group/global/group_default.cc index 952fe4e3d9..a143f86a2f 100644 --- a/src/vt/group/global/group_default.cc +++ b/src/vt/group/global/group_default.cc @@ -79,7 +79,7 @@ namespace vt { namespace group { namespace global { "Must have valid tree when entering new phase" ); if (default_group_->spanning_tree_->getNumChildren() > 0) { - default_group_->spanning_tree_->foreachChild([&](NodeType child) { + default_group_->spanning_tree_->foreachChild([&](NodeT child) { DefaultGroup::sendPhaseMsg(phase, child); }); } @@ -148,7 +148,7 @@ namespace vt { namespace group { namespace global { } /*static*/ EventType DefaultGroup::broadcast( - MsgSharedPtr const& base, NodeType const& from, + MsgSharedPtr const& base, NodeT const& from, bool const is_root, bool* const deliver ) { // By default use the default_group_->spanning_tree_ @@ -156,14 +156,14 @@ namespace vt { namespace group { namespace global { // Destination is where the broadcast originated from auto const& dest = envelopeGetDest(msg->env); auto const& num_children = default_group_->spanning_tree_->getNumChildren(); - auto const& node = theContext()->getNode(); - NodeType const& root_node = 0; + auto const node = theContext()->getNode(); + auto const root_node = NodeT {0}; auto const is_root_of_tree = node == root_node; - bool const& send_to_root = is_root && !is_root_of_tree; + bool const send_to_root = is_root && !is_root_of_tree; EventType event = no_event; auto const this_node_dest = dest == node; - auto const first_send = from == uninitialized_destination; + auto const first_send = from == NodeT {}; vt_debug_print( normal, broadcast, @@ -178,7 +178,7 @@ namespace vt { namespace group { namespace global { // Send to child nodes in the spanning tree if (num_children > 0) { - default_group_->spanning_tree_->foreachChild([&](NodeType child) { + default_group_->spanning_tree_->foreachChild([&](NodeT child) { bool const& send = child != dest; vt_debug_print( diff --git a/src/vt/group/global/group_default.h b/src/vt/group/global/group_default.h index 79a4287a4a..45f568f43c 100644 --- a/src/vt/group/global/group_default.h +++ b/src/vt/group/global/group_default.h @@ -74,13 +74,13 @@ struct DefaultGroup { // Interface for collection communication within the default group public: static EventType broadcast( - MsgSharedPtr const& base, NodeType const& from, + MsgSharedPtr const& base, NodeT const& from, bool const is_root, bool* const deliver ); private: template * handler> - static void sendPhaseMsg(PhaseType const& phase, NodeType const& node); + static void sendPhaseMsg(PhaseType const& phase, NodeT const& node); // Setup for default group static void setupDefaultTree(); @@ -97,7 +97,7 @@ struct DefaultGroup { bool finished_startup_ = false; PhaseType cur_phase_ = 0; CountType sync_count_[num_phases + 1] = { 0, 0, 0 }; - NodeType this_node_ = uninitialized_destination; + NodeT this_node_ = {}; }; extern std::unique_ptr default_group_; diff --git a/src/vt/group/global/group_default.impl.h b/src/vt/group/global/group_default.impl.h index 8d50239776..3594396f82 100644 --- a/src/vt/group/global/group_default.impl.h +++ b/src/vt/group/global/group_default.impl.h @@ -55,7 +55,7 @@ namespace vt { namespace group { namespace global { template * handler> /*static*/ void DefaultGroup::sendPhaseMsg( - PhaseType const& phase, NodeType const& node + PhaseType const& phase, NodeT const& node ) { auto const& this_node = theContext()->getNode(); if (this_node == node) { diff --git a/src/vt/group/group_info.h b/src/vt/group/group_info.h index 3f224fa743..e7cad8fca2 100644 --- a/src/vt/group/group_info.h +++ b/src/vt/group/group_info.h @@ -60,9 +60,9 @@ namespace vt { namespace group { -static constexpr NodeType const min_spanning_tree_size = 3; -static constexpr NodeType const min_region_size = 1; -static constexpr NodeType const default_num_children = 2; +static constexpr ::vt::NodeT const min_spanning_tree_size = ::vt::NodeT {3}; +static constexpr ::vt::NodeT const min_region_size = ::vt::NodeT {1}; +static constexpr ::vt::NodeT const default_num_children = ::vt::NodeT {2}; static constexpr size_t const max_region_list_size = 4; #pragma GCC diagnostic push diff --git a/src/vt/group/group_info.impl.h b/src/vt/group/group_info.impl.h index 10fdfd5794..66c9cabd0e 100644 --- a/src/vt/group/group_info.impl.h +++ b/src/vt/group/group_info.impl.h @@ -142,7 +142,7 @@ template ); info->wait_count_--; - if (info->wait_count_ == 0 && parent != uninitialized_destination) { + if (info->wait_count_ == 0 && parent != ::vt::NodeT {}) { vt_debug_print( verbose, group, "Info::parent continuation: sending to parent={}, op_id={}\n", @@ -162,7 +162,7 @@ template range_tail->splitN(default_num_children, [&](RegionPtrType region){ auto const& c = region->head(); - auto const& c_size = static_cast(region->getSize()); + auto const c_size = static_cast(region->getSize()); local_nodes.push_back(c); diff --git a/src/vt/group/group_manager.cc b/src/vt/group/group_manager.cc index d6779d6c62..d73e4ea129 100644 --- a/src/vt/group/group_manager.cc +++ b/src/vt/group/group_manager.cc @@ -141,7 +141,7 @@ GroupManager::ReducePtrType GroupManager::groupReducer(GroupType const group) { } } -NodeType GroupManager::groupRoot(GroupType const group) const { +NodeT GroupManager::groupRoot(GroupType const group) const { auto iter = local_collective_group_info_.find(group); vtAssert(iter != local_collective_group_info_.end(), "Must exist"); auto const& root = iter->second->getRoot(); @@ -252,7 +252,7 @@ void GroupManager::initializeLocalGroup( } /*static*/ EventType GroupManager::groupHandler( - MsgSharedPtr const& base, NodeType const from, + MsgSharedPtr const& base, NodeT const from, bool const root, bool* const deliver ) { auto const& msg = reinterpret_cast(base.get()); @@ -299,7 +299,7 @@ void GroupManager::initializeLocalGroup( } EventType GroupManager::sendGroupCollective( - MsgSharedPtr const& base, NodeType const from, + MsgSharedPtr const& base, NodeT const from, bool const is_root, bool* const deliver ) { @@ -326,9 +326,9 @@ EventType GroupManager::sendGroupCollective( auto const& root_node = info.getRoot(); auto const& send_to_root = is_root && this_node != root_node; auto const& this_node_dest = dest == this_node; - auto const& first_send = from == uninitialized_destination; + auto const& first_send = from == NodeT{}; - if (root_node == uninitialized_destination) { + if (root_node == NodeT{}) { return no_event; } @@ -354,7 +354,7 @@ EventType GroupManager::sendGroupCollective( ); if ((num_children > 0 || send_to_root) && (!this_node_dest || first_send)) { - info.getTree()->foreachChild([&](NodeType child){ + info.getTree()->foreachChild([&](NodeT child){ bool const& send = child != dest; vt_debug_print( @@ -400,7 +400,7 @@ EventType GroupManager::sendGroupCollective( } else { auto const& root_node = info.getRoot(); - if (root_node == uninitialized_destination) { + if (root_node == NodeT{}) { return no_event; } @@ -423,7 +423,7 @@ EventType GroupManager::sendGroupCollective( } EventType GroupManager::sendGroup( - MsgSharedPtr const& base, NodeType const from, + MsgSharedPtr const& base, NodeT const from, bool const is_root, bool* const deliver ) { @@ -432,7 +432,7 @@ EventType GroupManager::sendGroup( auto const& group = envelopeGetGroup(msg->env); auto const& dest = envelopeGetDest(msg->env); auto const& this_node_dest = dest == this_node; - auto const& first_send = from == uninitialized_destination; + auto const& first_send = from == NodeT{}; vt_debug_print( terse, group, @@ -447,7 +447,7 @@ EventType GroupManager::sendGroup( !group_collective, "Collective groups are not supported" ); - auto send_to_node = [&](NodeType node) -> EventType { + auto send_to_node = [&](NodeT node) -> EventType { auto const& send_tag = static_cast( messaging::MPITag::ActiveMsgTag ); @@ -499,7 +499,7 @@ EventType GroupManager::sendGroup( // Send to child nodes in the group's spanning tree if (num_children > 0) { - info.default_spanning_tree_->foreachChild([&](NodeType child) { + info.default_spanning_tree_->foreachChild([&](NodeT child) { vt_debug_print( verbose, broadcast, "GroupManager::sendGroup: *send* size={}, from={}, child={}\n", @@ -512,7 +512,7 @@ EventType GroupManager::sendGroup( }); } - if (is_root && from == uninitialized_destination) { + if (is_root && from == NodeT{}) { *deliver = true; } else if (!is_root && dest == this_node) { *deliver = false; diff --git a/src/vt/group/group_manager.h b/src/vt/group/group_manager.h index 63c9f61e8b..6827d5e572 100644 --- a/src/vt/group/group_manager.h +++ b/src/vt/group/group_manager.h @@ -321,7 +321,7 @@ struct GroupManager : runtime::component::Component { * \return the event ID for any generated events (like MPI_Requests) */ EventType sendGroup( - MsgSharedPtr const& base, NodeType const from, + MsgSharedPtr const& base, NodeT const from, bool const is_root, bool* const deliver ); @@ -337,7 +337,7 @@ struct GroupManager : runtime::component::Component { * \return the event ID for any generated events (like MPI_Requests) */ EventType sendGroupCollective( - MsgSharedPtr const& base, NodeType const from, + MsgSharedPtr const& base, NodeT const from, bool const is_root, bool* const deliver ); @@ -359,7 +359,7 @@ struct GroupManager : runtime::component::Component { * * \return the root node */ - NodeType groupRoot(GroupType const group) const; + NodeT groupRoot(GroupType const group) const; /** * \brief Check if a group is the default group (all nodes, default spanning @@ -413,7 +413,7 @@ struct GroupManager : runtime::component::Component { * \return the event ID for any generated events (like MPI_Requests) */ static EventType groupHandler( - MsgSharedPtr const& msg, NodeType const from, + MsgSharedPtr const& msg, NodeT const from, bool const is_root, bool* const deliver ); diff --git a/src/vt/group/group_manager_active_attorney.cc b/src/vt/group/group_manager_active_attorney.cc index 05493fe19b..5daad29548 100644 --- a/src/vt/group/group_manager_active_attorney.cc +++ b/src/vt/group/group_manager_active_attorney.cc @@ -50,7 +50,7 @@ namespace vt { namespace group { /*static*/ EventType GroupActiveAttorney::groupHandler( - MsgSharedPtr const& msg, NodeType const& from, + MsgSharedPtr const& msg, NodeT const& from, bool const is_root, bool* const deliver ) { diff --git a/src/vt/group/group_manager_active_attorney.h b/src/vt/group/group_manager_active_attorney.h index efcd241baa..2ce62895b3 100644 --- a/src/vt/group/group_manager_active_attorney.h +++ b/src/vt/group/group_manager_active_attorney.h @@ -59,7 +59,7 @@ struct GroupActiveAttorney { private: static EventType groupHandler( - MsgSharedPtr const& msg, NodeType const& from, + MsgSharedPtr const& msg, NodeT const& from, bool const is_root, bool* const deliver ); diff --git a/src/vt/group/id/group_id.cc b/src/vt/group/id/group_id.cc index 0e3ccb50bb..defc8697c8 100644 --- a/src/vt/group/id/group_id.cc +++ b/src/vt/group/id/group_id.cc @@ -41,6 +41,7 @@ //@HEADER */ +#include "vt/configs/types/types_node.h" #include "vt/config.h" #include "vt/group/group_common.h" #include "vt/group/id/group_id.h" @@ -49,7 +50,7 @@ namespace vt { namespace group { /*static*/ GroupType GroupIDBuilder::createGroupID( - GroupIDType const& id, NodeType const& node, bool const& is_collective, + GroupIDType const& id, ::vt::NodeT const& node, bool const& is_collective, bool const& is_static ) { auto const& set_node = !is_collective ? node : group_collective_node; @@ -76,7 +77,7 @@ namespace vt { namespace group { } /*static*/ void GroupIDBuilder::setNode( - GroupType& group, NodeType const& node + GroupType& group, ::vt::NodeT const& node ) { BitPackerType::setField(group, node); } @@ -95,9 +96,9 @@ namespace vt { namespace group { return BitPackerType::boolGetField(group); } -/*static*/ NodeType GroupIDBuilder::getNode(GroupType const& group) { +/*static*/ ::vt::NodeT GroupIDBuilder::getNode(GroupType const& group) { return BitPackerType::getField< - eGroupIDBits::Node, group_node_num_bits, NodeType + eGroupIDBits::Node, group_node_num_bits, ::vt::NodeT >(group); } diff --git a/src/vt/group/id/group_id.h b/src/vt/group/id/group_id.h index ae070c35db..4abb33e5b4 100644 --- a/src/vt/group/id/group_id.h +++ b/src/vt/group/id/group_id.h @@ -53,31 +53,31 @@ namespace vt { namespace group { static constexpr BitCountType const group_is_collective_num_bits = 1; static constexpr BitCountType const group_is_static_num_bits = 1; static constexpr BitCountType const group_node_num_bits = - BitCounterType::value; + BitCounterType ::value; static constexpr BitCountType const group_id_num_bits = BitCounterType::value; -static constexpr NodeType const group_collective_node = -1; +static constexpr NodeT const group_collective_node = NodeT{-1}; enum eGroupIDBits { Collective = 0, Static = eGroupIDBits::Collective + group_is_collective_num_bits, - Node = eGroupIDBits::Static + group_is_static_num_bits, - ID = eGroupIDBits::Node + group_node_num_bits + Node = eGroupIDBits::Static + group_is_static_num_bits, + ID = eGroupIDBits::Node + group_node_num_bits }; struct GroupIDBuilder { static GroupType createGroupID( - GroupIDType const& id, NodeType const& node, + GroupIDType const& id, ::vt::NodeT const& node, bool const& is_collective = false, bool const& is_static = true ); static void setIsCollective(GroupType& group, bool const& is_coll); static void setIsStatic(GroupType& group, bool const& is_static); - static void setNode(GroupType& group, NodeType const& node); + static void setNode(GroupType& group, ::vt::NodeT const& node); static void setID(GroupType& group, GroupIDType const& id); static bool isCollective(GroupType const& group); static bool isStatic(GroupType const& group); - static NodeType getNode(GroupType const& group); + static ::vt::NodeT getNode(GroupType const& group); static GroupIDType getGroupID(GroupType const& group); }; diff --git a/src/vt/group/msg/group_msg.h b/src/vt/group/msg/group_msg.h index a9a3fde167..6ecb53a6e8 100644 --- a/src/vt/group/msg/group_msg.h +++ b/src/vt/group/msg/group_msg.h @@ -64,24 +64,24 @@ struct GroupMsg : MsgT { GroupMsg( GroupType const& in_group, RemoteOperationIDType const& in_op, - NodeType const& in_root, bool const& in_default_group + NodeT const& in_root, bool const& in_default_group ) : MsgT(), group_(in_group), op_id_(in_op), root_(in_root), default_group_(in_default_group) { } GroupType getGroup() const { return group_; } RemoteOperationIDType getOpID() const { return op_id_; } - NodeType getRoot() const { return root_; } + NodeT getRoot() const { return root_; } bool isDefault() const { return default_group_; } void setGroup(GroupType const& group) { group_ = group; } void setOpID(RemoteOperationIDType const& op) { op_id_ = op; } - void setRoot(NodeType const& root) { root_ = root; } + void setRoot(NodeT const& root) { root_ = root; } protected: GroupType group_ = no_group; RemoteOperationIDType op_id_ = no_op_id; - NodeType root_ = uninitialized_destination; + NodeT root_ = {}; bool default_group_ = false; }; @@ -91,27 +91,27 @@ template struct GroupInfoMsg : MsgT { GroupInfoMsg() = default; GroupInfoMsg( - NodeType const& in_root_node, NodeType const& in_num_nodes, + NodeT const& in_root_node, NodeT const& in_num_nodes, GroupType const& in_group, RemoteOperationIDType in_op, - NodeType const& in_total_num_nodes, - NodeType const& in_parent_node = uninitialized_destination + NodeT const& in_total_num_nodes, + NodeT const& in_parent_node = {} ) : MsgT(in_group, in_op), root_node_(in_root_node), num_nodes_(in_num_nodes), total_num_nodes_(in_total_num_nodes), parent_node_(in_parent_node) { } - NodeType getRoot() const { return root_node_; } - NodeType getCount() const { return num_nodes_; } - NodeType getTotalCount() const { return total_num_nodes_; } - NodeType getParent() const { return parent_node_; } + NodeT getRoot() const { return root_node_; } + NodeT getCount() const { return num_nodes_; } + NodeT getTotalCount() const { return total_num_nodes_; } + NodeT getParent() const { return parent_node_; } bool isStatic() const { return is_static_; } private: - NodeType root_node_ = uninitialized_destination; - NodeType num_nodes_ = uninitialized_destination; - NodeType total_num_nodes_ = uninitialized_destination; + NodeT root_node_ = {}; + NodeT num_nodes_ = {}; + NodeT total_num_nodes_ = {}; bool is_static_ = true; - NodeType parent_node_ = uninitialized_destination; + NodeT parent_node_ = {}; }; struct GroupListMsg : GroupInfoMsg> { @@ -119,9 +119,9 @@ struct GroupListMsg : GroupInfoMsg> { GroupListMsg() = default; GroupListMsg( - NodeType const& in_root_node, NodeType const& in_num_nodes, + NodeT const in_root_node, NodeT const in_num_nodes, GroupType const& in_group, RemoteOperationIDType in_op, - NodeType const& in_total_num_nodes, NodeType const& in_parent_node, + NodeT const in_total_num_nodes, NodeT const in_parent_node, RangeType* in_range ) : GroupInfoMsg( in_root_node, in_num_nodes, in_group, in_op, in_total_num_nodes, @@ -147,9 +147,9 @@ struct GroupRangeMsg : GroupInfoMsg> { GroupRangeMsg() = default; GroupRangeMsg( - NodeType const& in_root_node, NodeType const& in_num_nodes, + NodeT const& in_root_node, NodeT const& in_num_nodes, GroupType const& in_group, RemoteOperationIDType in_op, - NodeType const& in_total_num_nodes, NodeType const& in_parent_node, + NodeT const& in_total_num_nodes, NodeT const& in_parent_node, RangeType* in_range ) : GroupInfoMsg( in_root_node, in_num_nodes, in_group, in_op, in_total_num_nodes, diff --git a/src/vt/group/region/group_list.cc b/src/vt/group/region/group_list.cc index bf197b3810..bedb7ce4d8 100644 --- a/src/vt/group/region/group_list.cc +++ b/src/vt/group/region/group_list.cc @@ -68,7 +68,7 @@ List::List(ListType&& in_list) : list_(std::move(in_list)) { } } } -/*virtual*/ bool List::contains(NodeType const& node) { +/*virtual*/ bool List::contains(NodeT const& node) { if (is_sorted_) { return std::binary_search(list_.begin(), list_.end(), node); } else { diff --git a/src/vt/group/region/group_list.h b/src/vt/group/region/group_list.h index 88b56ede5e..cc875a23f0 100644 --- a/src/vt/group/region/group_list.h +++ b/src/vt/group/region/group_list.h @@ -62,7 +62,7 @@ struct List : Region { virtual SizeType getSize() const override; virtual void sort() override; - virtual bool contains(NodeType const& node) override; + virtual bool contains(NodeT const& node) override; virtual ListType const& makeList() override; virtual bool isList() const override; virtual BoundType head() const override; diff --git a/src/vt/group/region/group_range.cc b/src/vt/group/region/group_range.cc index 44ef017293..906c982597 100644 --- a/src/vt/group/region/group_range.cc +++ b/src/vt/group/region/group_range.cc @@ -70,7 +70,7 @@ Range::Range( // do nothing, it's already sorted } -/*virtual*/ bool Range::contains(NodeType const& node) { +/*virtual*/ bool Range::contains(NodeT const& node) { // Range overlap: x1 <= y2 && y1 <= x2 if (made_list_) { // List must be sorted @@ -94,7 +94,7 @@ Range::Range( Range::Range(Range const& in_other, BoundType in_remove_extent) : Range( - in_other.lo_ + in_remove_extent * in_other.stride_, + BoundType{in_other.lo_ + in_remove_extent * in_other.stride_}, in_other.hi_, in_other.stride_ ) @@ -109,7 +109,7 @@ Range::Range(Range const& in_other, BoundType in_remove_extent) } /*virtual*/ Range::RegionUPtrType Range::tail() const { - return std::make_unique(lo_ + stride_, hi_, stride_); + return std::make_unique(BoundType{lo_ + stride_}, hi_, stride_); } /*virtual*/ Range::SplitRegionType Range::split() const { @@ -118,8 +118,8 @@ Range::Range(Range const& in_other, BoundType in_remove_extent) vtAssert( size >= 2, "Size must be at least 2 to split" ); - auto r1 = std::make_unique(lo_, lo_+span, stride_); - auto r2 = std::make_unique(lo_+span, hi_, stride_); + auto r1 = std::make_unique(lo_, BoundType{lo_+span}, stride_); + auto r2 = std::make_unique(BoundType{lo_+span}, hi_, stride_); return std::make_tuple(std::move(r1),std::move(r2)); } @@ -135,9 +135,9 @@ Range::Range(Range const& in_other, BoundType in_remove_extent) auto const& child_size = size / num_splits; auto hi_bound = split == num_splits - 1 ? hi_ : std::min(static_cast(hi_), cur_lo + child_size*stride_); - auto r1 = std::make_unique(cur_lo, hi_bound, stride_); + auto r1 = std::make_unique(cur_lo, BoundType{hi_bound}, stride_); apply(std::move(r1)); - cur_lo += child_size*stride_; + cur_lo += BoundType{child_size*stride_}; } } diff --git a/src/vt/group/region/group_range.h b/src/vt/group/region/group_range.h index 86e7fb8400..548405f3ab 100644 --- a/src/vt/group/region/group_range.h +++ b/src/vt/group/region/group_range.h @@ -55,7 +55,7 @@ struct RangeData; struct Range : Region { Range( - BoundType const& in_lo, BoundType const& in_hi, BoundType const& stride = 1 + BoundType const& in_lo, BoundType const& in_hi, BoundType const& stride = BoundType{1} ); Range(Range const& in_other, BoundType in_remove_extent); @@ -67,7 +67,7 @@ struct Range : Region { virtual SizeType getSize() const override; virtual void sort() override; - virtual bool contains(NodeType const& node) override; + virtual bool contains(NodeT const& node) override; virtual ListType const& makeList() override; virtual bool isList() const override; virtual BoundType head() const override; @@ -79,9 +79,9 @@ struct Range : Region { friend struct RangeData; private: - BoundType const lo_ = uninitialized_destination; - BoundType const hi_ = uninitialized_destination; - BoundType const stride_ = 1; + BoundType const lo_ = BoundType{}; + BoundType const hi_ = BoundType{}; + BoundType const stride_ = BoundType{1}; bool made_list_ = false; ListType list_; }; @@ -91,7 +91,7 @@ struct Range : Region { * virtualization and inheritance */ struct RangeData { - using BoundType = NodeType; + using BoundType = NodeT ; using ListType = std::vector; RangeData() = default; @@ -109,9 +109,9 @@ struct RangeData { } private: - BoundType lo_ = uninitialized_destination; - BoundType hi_ = uninitialized_destination; - BoundType stride_ = 1; + BoundType lo_ = BoundType{}; + BoundType hi_ = BoundType{}; + BoundType stride_ = BoundType{1}; }; }}} /* end namespace vt::group::region */ diff --git a/src/vt/group/region/group_region.h b/src/vt/group/region/group_region.h index 7065d9a747..1a9b83131d 100644 --- a/src/vt/group/region/group_region.h +++ b/src/vt/group/region/group_region.h @@ -56,7 +56,7 @@ namespace vt { namespace group { namespace region { struct Region { - using BoundType = NodeType; + using BoundType = NodeT; using SizeType = size_t; using RegionPtr = Region*; using RegionUPtrType = std::unique_ptr; @@ -67,7 +67,7 @@ struct Region { virtual ~Region(){} virtual SizeType getSize() const = 0; virtual void sort() = 0; - virtual bool contains(NodeType const& node) = 0; + virtual bool contains(NodeT const& node) = 0; virtual bool isList() const = 0; virtual ListType const& makeList() = 0; virtual RegionUPtrType copy() const = 0; diff --git a/src/vt/group/region/group_shallow_list.cc b/src/vt/group/region/group_shallow_list.cc index c55ca6315d..c61811fad2 100644 --- a/src/vt/group/region/group_shallow_list.cc +++ b/src/vt/group/region/group_shallow_list.cc @@ -70,7 +70,7 @@ ShallowList::ShallowList(ListType const& in_list) vtAssert(0, "Can not be sorted"); } -/*virtual*/ bool ShallowList::contains(NodeType const& node) { +/*virtual*/ bool ShallowList::contains(NodeT const& node) { for (decltype(size_) i = 0; i < size_; i++) { if (bound_[i] == node) { return true; diff --git a/src/vt/group/region/group_shallow_list.h b/src/vt/group/region/group_shallow_list.h index 70cb243fac..639fd6f6f0 100644 --- a/src/vt/group/region/group_shallow_list.h +++ b/src/vt/group/region/group_shallow_list.h @@ -62,7 +62,7 @@ struct ShallowList : Region { virtual SizeType getSize() const override; virtual void sort() override; - virtual bool contains(NodeType const& node) override; + virtual bool contains(NodeT const& node) override; virtual ListType const& makeList () override; virtual bool isList() const override; virtual BoundType head() const override; diff --git a/src/vt/group/rooted/group_info_rooted.cc b/src/vt/group/rooted/group_info_rooted.cc index 757f85d97a..bfa494b517 100644 --- a/src/vt/group/rooted/group_info_rooted.cc +++ b/src/vt/group/rooted/group_info_rooted.cc @@ -80,7 +80,7 @@ void InfoRooted::setupRooted() { is_setup_ = true; } else { vtAssert( - size >= min_region_size, + size >= static_cast(min_region_size), "Size of the region must be at least min_region_size" ); auto const& this_node = theContext()->getNode(); @@ -89,7 +89,7 @@ void InfoRooted::setupRooted() { if (region_->isList() || size < max_region_list_size) { auto const& contains_this_node = region_->contains(this_node); region_list_ = region_->makeList(); - if (size < min_spanning_tree_size && contains_this_node) { + if (size < static_cast(min_spanning_tree_size) && contains_this_node) { this_node_included_ = true; default_spanning_tree_ = std::make_unique(region_list_); is_setup_ = true; @@ -109,20 +109,20 @@ void InfoRooted::setupRooted() { normal, group, "Info::setupRooted: sending as list\n" ); - auto const& low_node = region_list_[0]; + ::vt::NodeT const low_node = region_list_[0]; RemoteOperationIDType op = no_op_id; if (finished_setup_action_ != nullptr) { op = theGroup()->registerContinuation(finished_setup_action_); } - auto const& listsize = static_cast(region_list_.size()); + ::vt::NodeT const listsize = static_cast< ::vt::NodeT >(region_list_.size()); region::ShallowList lst(region_list_); auto msg = makeMessage( - low_node, listsize, group_, op, listsize, this_node, &lst + low_node, NodeT{listsize}, group_, op, listsize, this_node, &lst ); is_forward_ = true; forward_node_ = low_node; if (this_node != low_node) { - theMsg()->sendMsg(low_node, msg); + theMsg()->sendMsg(NodeT{low_node}, msg); } else { Info::groupSetupHandler(msg.get()); } @@ -137,7 +137,7 @@ void InfoRooted::setupRooted() { if (finished_setup_action_ != nullptr) { op = theGroup()->registerContinuation(finished_setup_action_); } - auto const& regsize = static_cast(region_->getSize()); + auto const& regsize = static_cast<::vt::NodeT >(region_->getSize()); auto msg = makeMessage( low_node, regsize, group_, op, regsize, this_node, static_cast(region_.get()) diff --git a/src/vt/group/rooted/group_info_rooted.h b/src/vt/group/rooted/group_info_rooted.h index f091f392a3..3cd5fcf9cd 100644 --- a/src/vt/group/rooted/group_info_rooted.h +++ b/src/vt/group/rooted/group_info_rooted.h @@ -75,7 +75,7 @@ struct InfoRooted : virtual InfoBase { protected: bool is_forward_ = false; bool this_node_included_ = false; - NodeType forward_node_ = uninitialized_destination; + ::vt::NodeT forward_node_ = {}; RegionPtrType region_ = nullptr; RegionType::SizeType total_size_ = 0; TreePtrType default_spanning_tree_ = nullptr; diff --git a/src/vt/messaging/active.cc b/src/vt/messaging/active.cc index 9ab3235191..33bba9c31f 100644 --- a/src/vt/messaging/active.cc +++ b/src/vt/messaging/active.cc @@ -206,7 +206,7 @@ MsgSizeType ActiveMessenger::packMsg( } EventType ActiveMessenger::sendMsgBytesWithPut( - NodeType const& dest, MsgSharedPtr const& base, + NodeT const& dest, MsgSharedPtr const& base, TagType const& send_tag ) { auto msg = base.get(); @@ -279,19 +279,19 @@ EventType ActiveMessenger::sendMsgBytesWithPut( } struct MultiMsg : vt::Message { - MultiMsg(SendInfo in_info, NodeType in_from, MsgSizeType in_size) + MultiMsg(SendInfo in_info, NodeT in_from, MsgSizeType in_size) : info(in_info), from(in_from), size(in_size) { } SendInfo getInfo() const { return info; } - NodeType getFrom() const { return from; } + NodeT getFrom() const { return from; } MsgSizeType getSize() const { return size; } private: SendInfo info; - NodeType from = uninitialized_destination; + NodeT from = {}; MsgSizeType size = 0; }; @@ -322,7 +322,7 @@ void ActiveMessenger::handleChunkedMultiMsg(MultiMsg* msg) { } EventType ActiveMessenger::sendMsgMPI( - NodeType const& dest, MsgSharedPtr const& base, + NodeT const& dest, MsgSharedPtr const& base, MsgSizeType const& msg_size, TagType const& send_tag ) { BaseMsgType* base_typed_msg = base.get(); @@ -393,7 +393,7 @@ EventType ActiveMessenger::sendMsgMPI( } EventType ActiveMessenger::sendMsgBytes( - NodeType const& dest, MsgSharedPtr const& base, + NodeT const& dest, MsgSharedPtr const& base, MsgSizeType const& msg_size, TagType const& send_tag ) { auto const& msg = base.get(); @@ -442,7 +442,7 @@ EventType ActiveMessenger::doMessageSend( auto msg = base.get(); - auto const dest = envelopeGetDest(msg->env); + auto const dest = NodeT{envelopeGetDest(msg->env)}; auto const is_bcast = envelopeIsBcast(msg->env); auto const is_term = envelopeIsTerm(msg->env); @@ -485,7 +485,7 @@ EventType ActiveMessenger::doMessageSend( bool deliver = false; EventType const ret_event = group::GroupActiveAttorney::groupHandler( - base, uninitialized_destination, true, &deliver + base, NodeT {}, true, &deliver ); // Don't go through MPI with self-send, schedule the message locally instead @@ -524,7 +524,7 @@ MPI_TagType ActiveMessenger::allocateNewTag() { } SendInfo ActiveMessenger::sendData( - PtrLenPairType const& ptr, NodeType const& dest, TagType const& tag + PtrLenPairType const& ptr, NodeT const& dest, TagType const& tag ) { auto const& data_ptr = std::get<0>(ptr); auto const& num_bytes = std::get<1>(ptr); @@ -562,7 +562,7 @@ SendInfo ActiveMessenger::sendData( } std::tuple ActiveMessenger::sendDataMPI( - PtrLenPairType const& payload, NodeType const& dest, TagType const& tag + PtrLenPairType const& payload, NodeT const& dest, TagType const& tag ) { auto ptr = static_cast(std::get<0>(payload)); auto remainder = std::get<1>(payload); @@ -628,14 +628,14 @@ std::tuple ActiveMessenger::sendDataMPI( } bool ActiveMessenger::recvDataMsgPriority( - int nchunks, PriorityType priority, TagType const& tag, NodeType const& node, + int nchunks, PriorityType priority, TagType const& tag, NodeT const& node, ContinuationDeleterType next ) { return recvDataMsg(nchunks, priority, tag, node, true, next); } bool ActiveMessenger::recvDataMsg( - int nchunks, TagType const& tag, NodeType const& node, + int nchunks, TagType const& tag, NodeT const& node, ContinuationDeleterType next ) { return recvDataMsg(nchunks, default_priority, tag, node, true, next); @@ -671,7 +671,7 @@ bool ActiveMessenger::tryProcessDataMsgRecv() { bool ActiveMessenger::recvDataMsgBuffer( int nchunks, void* const user_buf, TagType const& tag, - NodeType const& node, bool const& enqueue, ActionType dealloc, + NodeT const& node, bool const& enqueue, ActionType dealloc, ContinuationDeleterType next, bool is_user_buf ) { return recvDataMsgBuffer( @@ -682,7 +682,7 @@ bool ActiveMessenger::recvDataMsgBuffer( bool ActiveMessenger::recvDataMsgBuffer( int nchunks, void* const user_buf, PriorityType priority, TagType const& tag, - NodeType const& node, bool const& enqueue, ActionType dealloc_user_buf, + NodeT const& node, bool const& enqueue, ActionType dealloc_user_buf, ContinuationDeleterType next, bool is_user_buf ) { if (not enqueue) { @@ -693,7 +693,7 @@ bool ActiveMessenger::recvDataMsgBuffer( { VT_ALLOW_MPI_CALLS; const int probe_ret = MPI_Iprobe( - node == uninitialized_destination ? MPI_ANY_SOURCE : node, + node == NodeT{} ? NodeT{MPI_ANY_SOURCE} : node, tag, comm_, &flag, &stat ); vtAssertMPISuccess(probe_ret, "MPI_Iprobe"); @@ -706,7 +706,7 @@ bool ActiveMessenger::recvDataMsgBuffer( static_cast(thePool()->alloc(num_probe_bytes)) : static_cast(user_buf); - NodeType const sender = stat.MPI_SOURCE; + NodeT const sender = NodeT{stat.MPI_SOURCE}; recvDataDirect( nchunks, buf, tag, sender, num_probe_bytes, priority, dealloc_user_buf, @@ -740,7 +740,7 @@ bool ActiveMessenger::recvDataMsgBuffer( } void ActiveMessenger::recvDataDirect( - int nchunks, TagType const tag, NodeType const from, MsgSizeType len, + int nchunks, TagType const tag, NodeT const from, MsgSizeType len, ContinuationDeleterType next ) { char* buf = static_cast(thePool()->alloc(len)); @@ -751,7 +751,7 @@ void ActiveMessenger::recvDataDirect( } void ActiveMessenger::recvDataDirect( - int nchunks, void* const buf, TagType const tag, NodeType const from, + int nchunks, void* const buf, TagType const tag, NodeT const from, MsgSizeType len, PriorityType prio, ActionType dealloc, ContinuationDeleterType next, bool is_user_buf ) { @@ -864,7 +864,7 @@ void ActiveMessenger::finishPendingDataMsgAsyncRecv(InProgressDataIRecv* irecv) } void ActiveMessenger::recordLBDataCommForSend( - NodeType const dest, MsgSharedPtr const& base, + NodeT const dest, MsgSharedPtr const& base, MsgSizeType const msg_size ) { auto the_task = theContext()->getTask(); @@ -886,7 +886,7 @@ void ActiveMessenger::recordLBDataCommForSend( bool ActiveMessenger::recvDataMsg( int nchunks, PriorityType priority, TagType const& tag, - NodeType const& sender, bool const& enqueue, + NodeT const& sender, bool const& enqueue, ContinuationDeleterType next ) { return recvDataMsgBuffer( @@ -895,7 +895,7 @@ bool ActiveMessenger::recvDataMsg( } void ActiveMessenger::processActiveMsg( - MsgSharedPtr const& base, NodeType const& from, + MsgSharedPtr const& base, NodeT const& from, bool insert, ActionType cont ) { using ::vt::group::GroupActiveAttorney; @@ -928,7 +928,7 @@ void ActiveMessenger::processActiveMsg( } void ActiveMessenger::prepareActiveMsgToRun( - MsgSharedPtr const& base, NodeType const& in_from_node, + MsgSharedPtr const& base, NodeT const& in_from_node, bool insert, ActionType cont ) { using MsgType = ShortMessage; @@ -936,7 +936,7 @@ void ActiveMessenger::prepareActiveMsgToRun( auto const is_term = envelopeIsTerm(msg->env); auto const is_bcast = envelopeIsBcast(msg->env); - auto const dest = envelopeGetDest(msg->env); + auto const dest = NodeT{envelopeGetDest(msg->env)}; auto const handler = envelopeGetHandler(msg->env); auto const epoch = envelopeIsEpochType(msg->env) ? envelopeGetEpoch(msg->env) : term::any_epoch_sentinel; @@ -1000,7 +1000,7 @@ bool ActiveMessenger::tryProcessIncomingActiveMsg() { char* buf = static_cast(thePool()->alloc(num_probe_bytes)); - NodeType const sender = stat.MPI_SOURCE; + NodeT const sender = NodeT{stat.MPI_SOURCE}; MPI_Request req; diff --git a/src/vt/messaging/active.h b/src/vt/messaging/active.h index b1d8e198a7..5c78a421e1 100644 --- a/src/vt/messaging/active.h +++ b/src/vt/messaging/active.h @@ -65,6 +65,7 @@ #include "vt/elm/elm_id.h" #include "vt/elm/elm_lb_data.h" #include "vt/utils/strong/strong_type.h" +#include "vt/configs/types/types_node.h" #include "vt/utils/fntraits/fntraits.h" #if vt_check_enabled(trace_enabled) @@ -91,9 +92,6 @@ using ContinuationDeleterType = namespace vt { -struct StrongNodeType { }; -using Node = Strong; - namespace messaging { /** \file */ @@ -121,13 +119,13 @@ struct PendingRecv { void* user_buf = nullptr; ContinuationDeleterType cont = nullptr; ActionType dealloc_user_buf = nullptr; - NodeType sender = uninitialized_destination; + NodeT sender = {}; PriorityType priority = no_priority; bool is_user_buf = false; PendingRecv( int in_nchunks, void* in_user_buf, ContinuationDeleterType in_cont, - ActionType in_dealloc_user_buf, NodeType node, + ActionType in_dealloc_user_buf, NodeT node, PriorityType in_priority, bool in_is_user_buf ) : nchunks(in_nchunks), user_buf(in_user_buf), cont(in_cont), dealloc_user_buf(in_dealloc_user_buf), sender(node), @@ -153,7 +151,7 @@ struct PendingRecv { */ struct InProgressBase { InProgressBase( - char* in_buf, MsgSizeType in_probe_bytes, NodeType in_sender + char* in_buf, MsgSizeType in_probe_bytes, NodeT in_sender ) : buf(in_buf), probe_bytes(in_probe_bytes), sender(in_sender), valid(true) { } @@ -168,7 +166,7 @@ struct InProgressBase { char* buf = nullptr; MsgSizeType probe_bytes = 0; - NodeType sender = uninitialized_destination; + NodeT sender = {}; bool valid = false; }; @@ -180,7 +178,7 @@ struct InProgressBase { struct InProgressIRecv : InProgressBase { InProgressIRecv( - char* in_buf, MsgSizeType in_probe_bytes, NodeType in_sender, + char* in_buf, MsgSizeType in_probe_bytes, NodeT in_sender, MPI_Request in_req = MPI_REQUEST_NULL ) : InProgressBase(in_buf, in_probe_bytes, in_sender), req(in_req) @@ -207,7 +205,7 @@ struct InProgressIRecv : InProgressBase { */ struct InProgressDataIRecv : InProgressBase { InProgressDataIRecv( - char* in_buf, MsgSizeType in_probe_bytes, NodeType in_sender, + char* in_buf, MsgSizeType in_probe_bytes, NodeT in_sender, std::vector in_reqs, void* const in_user_buf, ActionType in_dealloc_user_buf, ContinuationDeleterType in_next, @@ -263,11 +261,11 @@ struct BufferedActiveMsg { using MessageType = MsgSharedPtr; MessageType buffered_msg; - NodeType from_node; + NodeT from_node; ActionType cont; BufferedActiveMsg( - MessageType const& in_buffered_msg, NodeType const& in_from_node, + MessageType const& in_buffered_msg, NodeT const& in_from_node, ActionType in_cont ) : buffered_msg(in_buffered_msg), from_node(in_from_node), cont(in_cont) { } @@ -324,7 +322,7 @@ struct ActiveMessenger : runtime::component::PollableComponent using CountType = int32_t; using PendingRecvType = PendingRecv; using EventRecordType = event::AsyncEvent::EventRecordType; - using SendFnType = std::function; + using SendFnType = std::function; using UserSendFnType = std::function; using ContainerPendingType = std::unordered_map; using ReadyHanTagType = std::tuple; @@ -409,7 +407,7 @@ struct ActiveMessenger : runtime::component::PollableComponent // This also includes additional guards to detect ambiguity. template ActiveMessenger::PendingSendType sendMsgSerializableImpl( - NodeType dest, + NodeT dest, HandlerType han, MsgSharedPtr& msg, TagType tag @@ -428,7 +426,7 @@ struct ActiveMessenger : runtime::component::PollableComponent > = 0 > inline ActiveMessenger::PendingSendType sendMsgImpl( - NodeType dest, + NodeT dest, HandlerType han, MsgSharedPtr& msg, TagType tag @@ -452,7 +450,7 @@ struct ActiveMessenger : runtime::component::PollableComponent > = 0 > inline ActiveMessenger::PendingSendType sendMsgImpl( - NodeType dest, + NodeT dest, HandlerType han, MsgSharedPtr& msg, TagType tag @@ -477,7 +475,7 @@ struct ActiveMessenger : runtime::component::PollableComponent > = 0 > inline ActiveMessenger::PendingSendType sendMsgImpl( - NodeType dest, + NodeT dest, HandlerType han, MsgSharedPtr& msg, TagType tag @@ -502,7 +500,7 @@ struct ActiveMessenger : runtime::component::PollableComponent > = 0 > inline ActiveMessenger::PendingSendType sendMsgImpl( - NodeType dest, + NodeT dest, HandlerType han, MsgSharedPtr& msg, TagType tag @@ -518,7 +516,7 @@ struct ActiveMessenger : runtime::component::PollableComponent template ActiveMessenger::PendingSendType sendMsgCopyableImpl( - NodeType dest, + NodeT dest, HandlerType han, MsgSharedPtr& msg, TagType tag @@ -570,7 +568,7 @@ struct ActiveMessenger : runtime::component::PollableComponent template [[deprecated("size must be set in makeMessageSz, use regular sendMsg")]] PendingSendType sendMsgSz( - NodeType dest, + NodeT dest, HandlerType han, MsgPtrThief msg, ByteType msg_size, @@ -591,7 +589,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ template PendingSendType sendMsg( - NodeType dest, + NodeT dest, HandlerType han, MsgPtrThief msg, TagType tag = no_tag @@ -613,7 +611,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ template PendingSendType sendMsgAuto( - NodeType dest, + NodeT dest, HandlerType han, MsgPtrThief msg, TagType tag = no_tag @@ -646,7 +644,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * * void sendCode() { * // myHandler is automatically registered with the overload - * theMsg()->sendMsg(1, msg); + * theMsg()->sendMsg(vt::NodeT{1}, msg); * } * \endcode * @@ -728,7 +726,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ template * f> PendingSendType sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief msg, TagType tag = no_tag ); @@ -746,7 +744,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ template PendingSendType sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief::MsgT> msg, TagType tag = no_tag ) { @@ -763,12 +761,12 @@ struct ActiveMessenger : runtime::component::PollableComponent * \return the \c PendingSend for the sent message */ template - PendingSendType send(Node dest, Params&&... params) { + PendingSendType send(NodeT dest, Params&&... params) { using Tuple = typename FuncTraits::TupleType; using MsgT = ParamMsg; auto msg = vt::makeMessage(std::forward(params)...); auto han = auto_registry::makeAutoHandlerParam(); - return sendMsg(dest.get(), han, msg, no_tag); + return sendMsg(dest, han, msg, no_tag); } /** @@ -807,7 +805,7 @@ struct ActiveMessenger : runtime::component::PollableComponent template * f> [[deprecated("size must be set in makeMessageSz, use regular sendMsg")]] PendingSendType sendMsgSz( - NodeType dest, + NodeT dest, MsgPtrThief msg, ByteType msg_size, TagType tag = no_tag @@ -846,7 +844,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ template * f> PendingSendType sendMsgAuto( - NodeType dest, + NodeT dest, MsgPtrThief msg, TagType tag = no_tag ); @@ -884,7 +882,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * * void sendCode() { * // myHandler is automatically registered with the overload - * theMsg()->sendMsg(1, msg); + * theMsg()->sendMsg(vt::NodeT{1}, msg); * } * \endcode * @@ -922,7 +920,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ template PendingSendType sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief msg, TagType tag = no_tag ); @@ -957,7 +955,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * void sendCode() { * // X is automatically registered with the overload and the message * // type is automatically detected - * theMsg()->sendMsg(1, msg); + * theMsg()->sendMsg(vt::NodeT{1}, msg); * } * \endcode * @@ -1037,7 +1035,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ template PendingSendType sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief msg, TagType tag = no_tag ); @@ -1055,7 +1053,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ template PendingSendType sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief::MessageType> msg, TagType tag = no_tag ); @@ -1078,7 +1076,7 @@ struct ActiveMessenger : runtime::component::PollableComponent typename MsgT = typename util::FunctorExtractor::MessageType > PendingSendType sendMsgAuto( - NodeType dest, + NodeT dest, MsgPtrThief msg, TagType tag = no_tag ); @@ -1106,7 +1104,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * }; * * void myHandler(PutMessage* msg) { - * NodeType send_node = 0; + * NodeT send_node = 0; * theMsg()->recvDataMsg( * msg->mpi_tag_to_recv, send_node, * [=](PtrLenPairType ptr, ActionType deleter){ @@ -1117,14 +1115,14 @@ struct ActiveMessenger : runtime::component::PollableComponent * } * * void sendCode() { - * NodeType put_node = 1; + * NodeT put_node = 1; * // The user's payload function that invokes the system send function * // passed to the lambda * auto send_payload = [&](Active::SendFnType send){ * auto ret = send(vt::PtrLenPairType{ptr, num_bytes}, put_node, vt::no_tag); * msg->mpi_tag_to_recv = std::get<1>(ret); * }; - * theMsg()->sendMsg(1, msg); + * theMsg()->sendMsg(vt::NodeT{1}, msg); * } * \endcode * @@ -1165,7 +1163,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ template PendingSendType sendMsg( - NodeType dest, + NodeT dest, HandlerType han, MsgPtrThief msg, UserSendFnType send_payload_fn @@ -1184,7 +1182,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ template * f> PendingSendType sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief msg, UserSendFnType send_payload_fn ); @@ -1247,7 +1245,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \return information about the send for receiving the payload */ SendInfo sendData( - PtrLenPairType const& ptr, NodeType const& dest, TagType const& tag + PtrLenPairType const& ptr, NodeT const& dest, TagType const& tag ); /** @@ -1261,7 +1259,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \return a tuple of the event and the number of sends */ std::tuple sendDataMPI( - PtrLenPairType const& ptr, NodeType const& dest, TagType const& tag + PtrLenPairType const& ptr, NodeT const& dest, TagType const& tag ); /** @@ -1278,7 +1276,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ bool recvDataMsgPriority( int nchunks, PriorityType priority, TagType const& tag, - NodeType const& node, ContinuationDeleterType next = nullptr + NodeT const& node, ContinuationDeleterType next = nullptr ); /** @@ -1293,7 +1291,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \return whether it was successful or pending */ bool recvDataMsg( - int nchunks, TagType const& tag, NodeType const& node, + int nchunks, TagType const& tag, NodeT const& node, ContinuationDeleterType next = nullptr ); @@ -1312,7 +1310,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ bool recvDataMsg( int nchunks, PriorityType priority, TagType const& tag, - NodeType const& sender, bool const& enqueue, + NodeT const& sender, bool const& enqueue, ContinuationDeleterType next = nullptr ); @@ -1334,7 +1332,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ bool recvDataMsgBuffer( int nchunks, void* const user_buf, PriorityType priority, TagType const& tag, - NodeType const& node = uninitialized_destination, bool const& enqueue = true, + NodeT const& node = {}, bool const& enqueue = true, ActionType dealloc_user_buf = nullptr, ContinuationDeleterType next = nullptr, bool is_user_buf = false ); @@ -1356,7 +1354,7 @@ struct ActiveMessenger : runtime::component::PollableComponent */ bool recvDataMsgBuffer( int nchunks, void* const user_buf, TagType const& tag, - NodeType const& node = uninitialized_destination, bool const& enqueue = true, + NodeT const& node = {}, bool const& enqueue = true, ActionType dealloc_user_buf = nullptr, ContinuationDeleterType next = nullptr, bool is_user_buf = false ); @@ -1375,7 +1373,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \param[in] is_user_buf is a user buffer that require user deallocation */ void recvDataDirect( - int nchunks, void* const buf, TagType const tag, NodeType const from, + int nchunks, void* const buf, TagType const tag, NodeT const from, MsgSizeType len, PriorityType prio, ActionType dealloc = nullptr, ContinuationDeleterType next = nullptr, bool is_user_buf = false ); @@ -1390,7 +1388,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \param[in] next the continuation that gets passed the data when ready */ void recvDataDirect( - int nchunks, TagType const tag, NodeType const from, + int nchunks, TagType const tag, NodeT const from, MsgSizeType len, ContinuationDeleterType next ); @@ -1448,7 +1446,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \param[in] cont continuation after message is processed */ void processActiveMsg( - MsgSharedPtr const& base, NodeType const& sender, + MsgSharedPtr const& base, NodeT const& sender, bool insert, ActionType cont = nullptr ); @@ -1462,7 +1460,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \param[in] cont continuation after message is processed */ void prepareActiveMsgToRun( - MsgSharedPtr const& base, NodeType const& from_node, + MsgSharedPtr const& base, NodeT const& from_node, bool insert, ActionType cont ); @@ -1478,7 +1476,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \return the event to test/wait for completion */ EventType sendMsgBytes( - NodeType const& dest, MsgSharedPtr const& base, + NodeT const& dest, MsgSharedPtr const& base, MsgSizeType const& msg_size, TagType const& send_tag ); @@ -1493,7 +1491,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \return the event to test/wait for completion */ EventType sendMsgBytesWithPut( - NodeType const& dest, MsgSharedPtr const& base, + NodeT const& dest, MsgSharedPtr const& base, TagType const& send_tag ); @@ -1510,7 +1508,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \return the event to test/wait for completion */ EventType sendMsgMPI( - NodeType const& dest, MsgSharedPtr const& base, + NodeT const& dest, MsgSharedPtr const& base, MsgSizeType const& msg_size, TagType const& send_tag ); @@ -1716,7 +1714,7 @@ struct ActiveMessenger : runtime::component::PollableComponent * \param[in] msg_size the size of the message being sent */ void recordLBDataCommForSend( - NodeType const dest, MsgSharedPtr const& base, + NodeT const dest, MsgSharedPtr const& base, MsgSizeType const msg_size ); @@ -1734,7 +1732,7 @@ struct ActiveMessenger : runtime::component::PollableComponent RequestHolder in_progress_active_msg_irecv; RequestHolder in_progress_data_irecv; RequestHolder in_progress_ops; - NodeType this_node_ = uninitialized_destination; + NodeT this_node_ = {}; private: // Diagnostic counter gauge combos for sent counts/bytes diff --git a/src/vt/messaging/active.impl.h b/src/vt/messaging/active.impl.h index a955bb8cb0..df3377bcb6 100644 --- a/src/vt/messaging/active.impl.h +++ b/src/vt/messaging/active.impl.h @@ -57,7 +57,7 @@ namespace vt { namespace messaging { -constexpr NodeType broadcast_dest = uninitialized_destination; +constexpr NodeT broadcast_dest = {}; template void ActiveMessenger::markAsTermMessage(MsgPtrT const msg) { @@ -103,7 +103,7 @@ void ActiveMessenger::setTagMessage(MsgT* msg, TagType tag) { template ActiveMessenger::PendingSendType ActiveMessenger::sendMsgSerializableImpl( - NodeType dest, + NodeT dest, HandlerType han, MsgSharedPtr& msg, TagType tag @@ -139,7 +139,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsgSerializableImpl( template ActiveMessenger::PendingSendType ActiveMessenger::sendMsgCopyableImpl( - NodeType dest, + NodeT dest, HandlerType han, MsgSharedPtr& msg, TagType tag @@ -185,7 +185,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsgCopyableImpl( template ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( - NodeType dest, + NodeT dest, HandlerType han, MsgPtrThief msg, TagType tag @@ -196,7 +196,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( template ActiveMessenger::PendingSendType ActiveMessenger::sendMsgSz( - NodeType dest, + NodeT dest, HandlerType han, MsgPtrThief msg, ByteType msg_size, @@ -208,7 +208,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsgSz( template ActiveMessenger::PendingSendType ActiveMessenger::sendMsgAuto( - NodeType dest, + NodeT dest, HandlerType han, MsgPtrThief msg, TagType tag @@ -252,7 +252,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::broadcastMsg( template * f> ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief msg, TagType tag ) { @@ -263,7 +263,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( template * f> ActiveMessenger::PendingSendType ActiveMessenger::sendMsgSz( - NodeType dest, + NodeT dest, MsgPtrThief msg, ByteType msg_size, TagType tag @@ -275,7 +275,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsgSz( template * f> ActiveMessenger::PendingSendType ActiveMessenger::sendMsgAuto( - NodeType dest, + NodeT dest, MsgPtrThief msg, TagType tag ) { @@ -312,7 +312,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::broadcastMsg( template ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief msg, TagType tag ) { @@ -347,7 +347,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::broadcastMsg( template ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief msg, TagType tag ) { @@ -358,7 +358,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( template ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief::MessageType> msg, TagType tag ) { @@ -380,7 +380,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::broadcastMsgAuto( template ActiveMessenger::PendingSendType ActiveMessenger::sendMsgAuto( - NodeType dest, + NodeT dest, MsgPtrThief msg, TagType tag ) { @@ -391,7 +391,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsgAuto( template ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( - NodeType dest, + NodeT dest, HandlerType han, MsgPtrThief msg, UserSendFnType send_payload_fn @@ -411,7 +411,7 @@ ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( template * f> ActiveMessenger::PendingSendType ActiveMessenger::sendMsg( - NodeType dest, + NodeT dest, MsgPtrThief msg, UserSendFnType send_payload_fn ) { diff --git a/src/vt/messaging/collection_chain_set.impl.h b/src/vt/messaging/collection_chain_set.impl.h index 424ea395fc..926a0805d6 100644 --- a/src/vt/messaging/collection_chain_set.impl.h +++ b/src/vt/messaging/collection_chain_set.impl.h @@ -69,7 +69,7 @@ CollectionChainSet::CollectionChainSet( auto const this_node = theContext()->getNode(); auto const proxy_bits = proxy.getProxy(); - ListenerType l = [=](ElementEventEnum event, IndexT idx, NodeType home) { + ListenerType l = [=](ElementEventEnum event, IndexT idx, NodeT home) { switch (event) { case ElementEventEnum::ElementCreated: case ElementEventEnum::ElementMigratedIn: diff --git a/src/vt/messaging/envelope/envelope_base.h b/src/vt/messaging/envelope/envelope_base.h index 1f0660a2b0..b4a07bf435 100644 --- a/src/vt/messaging/envelope/envelope_base.h +++ b/src/vt/messaging/envelope/envelope_base.h @@ -70,7 +70,7 @@ struct ActiveEnvelope { /// The envelope type bits: \c eEnvelopeType EnvelopeDataType type : envelope_num_bits; /// Destination node - NodeType dest : node_num_bits; + BaseNodeType dest : node_num_bits; /// Handler to execute on arrival HandlerType han : handler_num_bits; /// Local reference count for the outer message to manage memory diff --git a/src/vt/messaging/envelope/envelope_get.h b/src/vt/messaging/envelope/envelope_get.h index a906c071cd..08a5d8d577 100644 --- a/src/vt/messaging/envelope/envelope_get.h +++ b/src/vt/messaging/envelope/envelope_get.h @@ -72,7 +72,7 @@ inline HandlerType envelopeGetHandler(Env const& env); * \return the destination node in the envelope */ template -inline NodeType envelopeGetDest(Env const& env); +inline BaseNodeType envelopeGetDest(Env const& env); /** * \brief Check whether bcast should be delivered to sender diff --git a/src/vt/messaging/envelope/envelope_get.impl.h b/src/vt/messaging/envelope/envelope_get.impl.h index ae4fbf12fa..27ddbafb77 100644 --- a/src/vt/messaging/envelope/envelope_get.impl.h +++ b/src/vt/messaging/envelope/envelope_get.impl.h @@ -55,7 +55,7 @@ inline HandlerType envelopeGetHandler(Env const& env) { } template -inline NodeType envelopeGetDest(Env const& env) { +inline BaseNodeType envelopeGetDest(Env const& env) { return reinterpret_cast(&env)->dest; } diff --git a/src/vt/messaging/envelope/envelope_set.h b/src/vt/messaging/envelope/envelope_set.h index ca59e84ec4..d99f465f72 100644 --- a/src/vt/messaging/envelope/envelope_set.h +++ b/src/vt/messaging/envelope/envelope_set.h @@ -133,7 +133,7 @@ inline void envelopeSetHandler(Env& env, HandlerType const handler); * \param[in] dest the destination if set or root if (non-group) broadcast */ template -inline void envelopeSetDest(Env& env, NodeType const& dest); +inline void envelopeSetDest(Env& env, NodeT const& dest); /** * \brief Set reference count on envelope. diff --git a/src/vt/messaging/envelope/envelope_set.impl.h b/src/vt/messaging/envelope/envelope_set.impl.h index 7a5c59e996..5fa63be6d6 100644 --- a/src/vt/messaging/envelope/envelope_set.impl.h +++ b/src/vt/messaging/envelope/envelope_set.impl.h @@ -100,7 +100,7 @@ inline void envelopeSetHandler(Env& env, HandlerType const handler) { } template -inline void envelopeSetDest(Env& env, NodeType const& dest) { +inline void envelopeSetDest(Env& env, NodeT const& dest) { vtAssert(not envelopeIsLocked(env), "Envelope locked."); reinterpret_cast(&env)->dest = dest; } diff --git a/src/vt/messaging/envelope/envelope_setup.h b/src/vt/messaging/envelope/envelope_setup.h index c87ba86c3a..b5d62126c8 100644 --- a/src/vt/messaging/envelope/envelope_setup.h +++ b/src/vt/messaging/envelope/envelope_setup.h @@ -61,7 +61,7 @@ namespace vt { */ template inline void envelopeSetup( - Env& env, NodeType const& dest, HandlerType const handler + Env& env, NodeT const& dest, HandlerType const handler ); /** diff --git a/src/vt/messaging/envelope/envelope_setup.impl.h b/src/vt/messaging/envelope/envelope_setup.impl.h index ec7ed83d80..4ef436bdbf 100644 --- a/src/vt/messaging/envelope/envelope_setup.impl.h +++ b/src/vt/messaging/envelope/envelope_setup.impl.h @@ -52,7 +52,7 @@ namespace vt { template inline void envelopeSetup( - Env& env, NodeType const& dest, HandlerType const handler + Env& env, NodeT const& dest, HandlerType const handler ) { envelopeSetDest(env, dest); envelopeSetHandler(env, handler); @@ -62,7 +62,7 @@ template inline void envelopeInit(Env& env) { envelopeSetIsLocked(env, false); setNormalType(env); - envelopeSetDest(env, uninitialized_destination); + envelopeSetDest(env, NodeT{}); envelopeSetHandler(env, uninitialized_handler); envelopeSetRef(env, not_shared_message); envelopeSetGroup(env); @@ -93,7 +93,7 @@ inline void envelopeInitCopy(Env& env, Env const& src_env) { template inline void envelopeCopyBcastData(Env& env, Env const& src_env) { envelopeSetIsLocked(env, false); - envelopeSetDest(env, envelopeGetDest(src_env)); + envelopeSetDest(env, NodeT{envelopeGetDest(src_env)}); setBroadcastType(env); envelopeSetIsLocked(env, true); } diff --git a/src/vt/objgroup/manager.cc b/src/vt/objgroup/manager.cc index 18888093dc..09dc15e6ca 100644 --- a/src/vt/objgroup/manager.cc +++ b/src/vt/objgroup/manager.cc @@ -107,7 +107,7 @@ ObjGroupProxyType ObjGroupManager::makeCollectiveImpl( ObjGroupManager::HolderBaseType* ObjGroupManager::getHolderBase(HandlerType han) { auto const ctrl = HandlerManager::getHandlerControl(han); - auto const node = 0; + auto const node = NodeT{0}; auto const proxy = proxy::ObjGroupProxy::create(ctrl, node, true); vt_debug_print( normal, objgroup, diff --git a/src/vt/objgroup/manager.fwd.h b/src/vt/objgroup/manager.fwd.h index 14ad2bb4af..dc78aeba3e 100644 --- a/src/vt/objgroup/manager.fwd.h +++ b/src/vt/objgroup/manager.fwd.h @@ -62,16 +62,16 @@ holder::HolderBase* getHolderBase(HandlerType handler); template void dispatchObjGroup( - MsgSharedPtr msg, HandlerType han, NodeType from_node, ActionType cont + MsgSharedPtr msg, HandlerType han, NodeT from_node, ActionType cont ); std::unordered_map>& getObjs(); std::unordered_map>& getPending(); template -messaging::PendingSend send(MsgSharedPtr msg, HandlerType han, NodeType node); +messaging::PendingSend send(MsgSharedPtr msg, HandlerType han, NodeT node); template -decltype(auto) invoke(messaging::MsgSharedPtr msg, HandlerType han, NodeType node); +decltype(auto) invoke(messaging::MsgSharedPtr msg, HandlerType han, NodeT node); template messaging::PendingSend broadcast(MsgSharedPtr msg, HandlerType han); diff --git a/src/vt/objgroup/manager.h b/src/vt/objgroup/manager.h index 0080182e5e..f391c8512c 100644 --- a/src/vt/objgroup/manager.h +++ b/src/vt/objgroup/manager.h @@ -388,7 +388,7 @@ struct ObjGroupManager : runtime::component::Component { * \param[in] node node to send message */ template - PendingSendType send(MsgSharedPtr msg, HandlerType han, NodeType node); + PendingSendType send(MsgSharedPtr msg, HandlerType han, NodeT node); /** * \internal \brief Invoke a message handler on an objgroup @@ -400,7 +400,7 @@ struct ObjGroupManager : runtime::component::Component { */ template decltype(auto) invoke( - messaging::MsgSharedPtr msg, HandlerType han, NodeType node + messaging::MsgSharedPtr msg, HandlerType han, NodeT node ); /** diff --git a/src/vt/objgroup/manager.impl.h b/src/vt/objgroup/manager.impl.h index 936d2bc40b..b32993a9ee 100644 --- a/src/vt/objgroup/manager.impl.h +++ b/src/vt/objgroup/manager.impl.h @@ -246,14 +246,14 @@ ObjGroupManager::PendingSendType ObjGroupManager::broadcast(ProxyType prox template ObjGroupManager::PendingSendType ObjGroupManager::send( - MsgSharedPtr msg, HandlerType han, NodeType dest_node + MsgSharedPtr msg, HandlerType han, NodeT dest_node ) { return objgroup::send(msg,han,dest_node); } template decltype(auto) ObjGroupManager::invoke( - messaging::MsgSharedPtr msg, HandlerType han, NodeType dest_node + messaging::MsgSharedPtr msg, HandlerType han, NodeT dest_node ) { return objgroup::invoke(msg, han, dest_node); } @@ -268,7 +268,7 @@ ObjGroupManager::PendingSendType ObjGroupManager::reduce( ProxyType proxy, MsgSharedPtr msg, collective::reduce::ReduceStamp const& stamp ) { - auto const root = 0; + auto const root = ::vt::NodeT{0}; auto const objgroup = proxy.getProxy(); auto r = theCollective()->getReducerObjGroup(objgroup); diff --git a/src/vt/objgroup/manager.static.h b/src/vt/objgroup/manager.static.h index ac24a78aec..f8a70e14d2 100644 --- a/src/vt/objgroup/manager.static.h +++ b/src/vt/objgroup/manager.static.h @@ -54,7 +54,7 @@ namespace vt { namespace objgroup { template -messaging::PendingSend send(MsgSharedPtr msg, HandlerType han, NodeType dest_node) { +messaging::PendingSend send(MsgSharedPtr msg, HandlerType han, NodeT dest_node) { auto const num_nodes = theContext()->getNumNodes(); auto const this_node = theContext()->getNode(); vtAssert(dest_node < num_nodes, "Invalid node (must be < num_nodes)"); @@ -76,7 +76,7 @@ messaging::PendingSend send(MsgSharedPtr msg, HandlerType han, NodeType de template decltype(auto) invoke( - messaging::MsgSharedPtr msg, HandlerType han, NodeType dest_node + messaging::MsgSharedPtr msg, HandlerType han, NodeT dest_node ) { auto const this_node = theContext()->getNode(); @@ -108,7 +108,7 @@ namespace detail { template void dispatchImpl( - MsgSharedPtr const& msg, HandlerType han, NodeType from_node, + MsgSharedPtr const& msg, HandlerType han, NodeT from_node, ActionType cont, ObjT* obj ) { auto holder = detail::getHolderBase(han); @@ -124,7 +124,7 @@ void dispatchImpl( template void dispatch( - MsgSharedPtr msg, HandlerType han, NodeType from_node, + MsgSharedPtr msg, HandlerType han, NodeT from_node, ActionType cont ) { // Extract the control-bit sequence from the handler @@ -133,7 +133,7 @@ void dispatch( verbose, objgroup, "dispatch: ctrl={:x}, han={:x}\n", ctrl, han ); - auto const node = 0; + auto const node = NodeT {0}; auto const proxy = proxy::ObjGroupProxy::create(ctrl, node, true); auto& objs = getObjs(); auto obj_iter = objs.find(proxy); @@ -166,7 +166,7 @@ void dispatch( template void dispatchObjGroup( - MsgSharedPtr msg, HandlerType han, NodeType from_node, + MsgSharedPtr msg, HandlerType han, NodeT from_node, ActionType cont ) { vt_debug_print( diff --git a/src/vt/objgroup/proxy/proxy_bits.cc b/src/vt/objgroup/proxy/proxy_bits.cc index e5b0b97b1c..c06d4cb4bc 100644 --- a/src/vt/objgroup/proxy/proxy_bits.cc +++ b/src/vt/objgroup/proxy/proxy_bits.cc @@ -48,10 +48,10 @@ namespace vt { namespace objgroup { namespace proxy { /*static*/ ObjGroupProxyType ObjGroupProxy::create( - ObjGroupIDType id, NodeType node, bool is_collective + ObjGroupIDType id, ::vt::NodeT node, bool is_collective ) { - constexpr NodeType const default_node = 0; - NodeType const target_node = is_collective ? default_node : node; + constexpr NodeT const default_node = NodeT{0}; + NodeT const target_node = is_collective ? default_node : node; ObjGroupProxyType new_proxy = 0; setControl(new_proxy); @@ -75,7 +75,7 @@ namespace vt { namespace objgroup { namespace proxy { } /*static*/ void ObjGroupProxy::setNode( - ObjGroupProxyType& proxy, NodeType const& node + ObjGroupProxyType& proxy, ::vt::NodeT const& node ) { BitPackerType::setField( proxy, node @@ -98,9 +98,9 @@ namespace vt { namespace objgroup { namespace proxy { return BitPackerType::boolGetField(proxy); } -/*static*/ NodeType ObjGroupProxy::getNode(ObjGroupProxyType proxy) { +/*static*/ ::vt::NodeT ObjGroupProxy::getNode(ObjGroupProxyType proxy) { return BitPackerType::getField< - eObjGroupProxyBits::Node, objgrp_node_num_bits, NodeType + eObjGroupProxyBits::Node, objgrp_node_num_bits, ::vt::NodeT >(proxy); } diff --git a/src/vt/objgroup/proxy/proxy_bits.h b/src/vt/objgroup/proxy/proxy_bits.h index 8e81d6b5ae..2920382032 100644 --- a/src/vt/objgroup/proxy/proxy_bits.h +++ b/src/vt/objgroup/proxy/proxy_bits.h @@ -52,7 +52,7 @@ namespace vt { namespace objgroup { namespace proxy { static constexpr BitCountType const objgrp_is_collective_num_bits = 1; static constexpr BitCountType const objgrp_control_num_bits = 1; static constexpr BitCountType const objgrp_node_num_bits = - BitCounterType::value; + BitCounterType ::value; static constexpr BitCountType const objgrp_id_num_bits = BitCounterType::value; static constexpr BitCountType const objgrp_proxy_num_bits = @@ -67,18 +67,18 @@ enum eObjGroupProxyBits { struct ObjGroupProxy { // Creation of a new proxy with properties - static ObjGroupProxyType create(ObjGroupIDType id, NodeType node, bool coll); + static ObjGroupProxyType create(ObjGroupIDType id, ::vt::NodeT node, bool coll); // Setters for mixing the proxy bits static void setControl(ObjGroupProxyType& proxy, bool is_objgroup = true); static void setIsCollective(ObjGroupProxyType& proxy, bool is_coll); - static void setNode(ObjGroupProxyType& proxy, NodeType const& node); + static void setNode(ObjGroupProxyType& proxy, ::vt::NodeT const& node); static void setID(ObjGroupProxyType& proxy, ObjGroupIDType id); // Getters for obtaining info about the bit-pattern in the obj-group proxy static bool isControl(ObjGroupProxyType proxy); static bool isCollective(ObjGroupProxyType proxy); - static NodeType getNode(ObjGroupProxyType proxy); + static ::vt::NodeT getNode(ObjGroupProxyType proxy); static ObjGroupIDType getID(ObjGroupProxyType proxy); }; diff --git a/src/vt/objgroup/proxy/proxy_objgroup.h b/src/vt/objgroup/proxy/proxy_objgroup.h index b235bdcf95..be0c80185e 100644 --- a/src/vt/objgroup/proxy/proxy_objgroup.h +++ b/src/vt/objgroup/proxy/proxy_objgroup.h @@ -352,7 +352,7 @@ struct Proxy { * * \return an indexed proxy to that node */ - ProxyElm operator[](NodeType node) const; + ProxyElm operator[](::vt::NodeT node) const; /** * \brief Index the proxy to get the element proxy for a particular node @@ -361,7 +361,7 @@ struct Proxy { * * \return an indexed proxy to that node */ - ProxyElm operator()(NodeType node) const; + ProxyElm operator()(::vt::NodeT node) const; template void serialize(Serializer& s) { @@ -381,7 +381,7 @@ struct Proxy { * * \return an indexed proxy to that node */ - DefaultProxyElm operator[](NodeType node) const; + DefaultProxyElm operator[](::vt::NodeT node) const; /** * \brief Broadcast a message. @@ -460,7 +460,7 @@ struct Proxy { typename MsgT, typename... Args > - messaging::PendingSend reduce(NodeType root, Args&&... args) const; + messaging::PendingSend reduce(::vt::NodeT root, Args&&... args) const; template < typename OpT, @@ -469,7 +469,7 @@ struct Proxy { ActiveTypedFnType* f, typename... Args > - messaging::PendingSend reduce(NodeType root, Args&&... args) const; + messaging::PendingSend reduce(::vt::NodeT root, Args&&... args) const; /** * \brief Reduce a message up the tree, possibly delayed through a pending @@ -485,7 +485,7 @@ struct Proxy { typename FunctorT, typename MsgT > - messaging::PendingSend reduceMsg(NodeType root, MsgT* const msg) const; + messaging::PendingSend reduceMsg(::vt::NodeT root, MsgT* const msg) const; template < typename OpT, @@ -493,7 +493,7 @@ struct Proxy { typename MsgT, ActiveTypedFnType* f > - messaging::PendingSend reduceMsg(NodeType root, MsgT* const msg) const; + messaging::PendingSend reduceMsg(::vt::NodeT root, MsgT* const msg) const; }; using DefaultProxyType = Proxy; diff --git a/src/vt/objgroup/proxy/proxy_objgroup.impl.h b/src/vt/objgroup/proxy/proxy_objgroup.impl.h index 46cf20ad69..ee5e2f96b8 100644 --- a/src/vt/objgroup/proxy/proxy_objgroup.impl.h +++ b/src/vt/objgroup/proxy/proxy_objgroup.impl.h @@ -149,12 +149,12 @@ ObjT* Proxy::get() const { } template -ProxyElm Proxy::operator[](NodeType node) const { +ProxyElm Proxy::operator[](::vt::NodeT node) const { return ProxyElm(proxy_,node); } template -ProxyElm Proxy::operator()(NodeType node) const { +ProxyElm Proxy::operator()(::vt::NodeT node) const { return ProxyElm(proxy_,node); } @@ -230,7 +230,7 @@ void Proxy::destroyHandleSetRDMA(vt::rdma::HandleSet set) const { return vt::theHandleRDMA()->deleteHandleSetCollectiveObjGroup(set); } -inline DefaultProxyElm Proxy::operator[](NodeType node) const { +inline DefaultProxyElm Proxy::operator[](::vt::NodeT node) const { return DefaultProxyElm{node}; } @@ -247,7 +247,7 @@ Proxy::broadcastMsg(messaging::MsgPtrThief msg, TagType tag) const { template messaging::PendingSend -Proxy::reduce(NodeType root, Args&&... args) const { +Proxy::reduce(::vt::NodeT root, Args&&... args) const { return reduce< OpT, FunctorT, @@ -265,7 +265,7 @@ template < typename... Args > messaging::PendingSend -Proxy::reduce(NodeType root, Args&&... args) const { +Proxy::reduce(::vt::NodeT root, Args&&... args) const { auto const msg = makeMessage(std::forward(args)...); return reduceMsg(root, msg.get()); } @@ -276,7 +276,7 @@ template < typename MsgT > messaging::PendingSend -Proxy::reduceMsg(NodeType root, MsgT* const msg) const { +Proxy::reduceMsg(::vt::NodeT root, MsgT* const msg) const { return reduceMsg< OpT, FunctorT, @@ -292,7 +292,7 @@ template < ActiveTypedFnType* f > messaging::PendingSend -Proxy::reduceMsg(NodeType root, MsgT* const msg) const { +Proxy::reduceMsg(::vt::NodeT root, MsgT* const msg) const { return theCollective()->global()->reduce(root, msg); } diff --git a/src/vt/objgroup/proxy/proxy_objgroup_elm.h b/src/vt/objgroup/proxy/proxy_objgroup_elm.h index 812de35633..7e34371a44 100644 --- a/src/vt/objgroup/proxy/proxy_objgroup_elm.h +++ b/src/vt/objgroup/proxy/proxy_objgroup_elm.h @@ -85,7 +85,7 @@ struct ProxyElm { * \param[in] in_proxy the proxy ID * \param[in] in_node the node selected */ - ProxyElm(ObjGroupProxyType in_proxy, NodeType in_node) + ProxyElm(ObjGroupProxyType in_proxy, ::vt::NodeT in_node) : proxy_(in_proxy), node_(in_node) { } @@ -209,7 +209,7 @@ struct ProxyElm { * * \return the node indexed */ - NodeType getNode() const { return node_; } + ::vt::NodeT getNode() const { return node_; } public: /** @@ -222,12 +222,12 @@ struct ProxyElm { private: ObjGroupProxyType proxy_ = no_obj_group; /**< The raw proxy ID bits */ - NodeType node_ = uninitialized_destination; /**< The indexed node */ + ::vt::NodeT node_ = {}; /**< The indexed node */ }; template <> struct ProxyElm { - explicit ProxyElm(NodeType in_node); + explicit ProxyElm(::vt::NodeT in_node); /** * \brief Send a message to the node indexed by this proxy to be @@ -251,7 +251,7 @@ struct ProxyElm { } private: - NodeType node_ = uninitialized_destination; /**< The indexed node */ + ::vt::NodeT node_ = {}; /**< The indexed node */ }; using DefaultProxyElm = ProxyElm; diff --git a/src/vt/objgroup/proxy/proxy_objgroup_elm.impl.h b/src/vt/objgroup/proxy/proxy_objgroup_elm.impl.h index dccd7b4f09..78105aeffb 100644 --- a/src/vt/objgroup/proxy/proxy_objgroup_elm.impl.h +++ b/src/vt/objgroup/proxy/proxy_objgroup_elm.impl.h @@ -140,7 +140,7 @@ ObjT* ProxyElm::get() const { return theObjGroup()->get(proxy); } -inline ProxyElm::ProxyElm(NodeType in_node) : node_{in_node} {} +inline ProxyElm::ProxyElm(::vt::NodeT in_node) : node_{in_node} {} template * f, typename... Args> void ProxyElm::send(Args&&... args) const { diff --git a/src/vt/pipe/callback/cb_union/cb_raw.h b/src/vt/pipe/callback/cb_union/cb_raw.h index 0b7a99b0b9..a15f4d0f85 100644 --- a/src/vt/pipe/callback/cb_union/cb_raw.h +++ b/src/vt/pipe/callback/cb_union/cb_raw.h @@ -64,7 +64,7 @@ struct AnonCB : CallbackAnonTypeless { }; struct SendMsgCB : CallbackSendTypeless { SendMsgCB() = default; SendMsgCB( - HandlerType const in_handler, NodeType const& in_send_node + HandlerType const in_handler, ::vt::NodeT const& in_send_node ) : CallbackSendTypeless(in_handler, in_send_node) { } }; @@ -108,7 +108,7 @@ struct BcastObjGrpCB : CallbackObjGroupBcast { struct SendObjGrpCB : CallbackObjGroupSend { SendObjGrpCB() = default; - SendObjGrpCB(HandlerType in_handler, ObjGroupProxyType in_proxy, NodeType in_n) + SendObjGrpCB(HandlerType in_handler, ObjGroupProxyType in_proxy, ::vt::NodeT in_n) : CallbackObjGroupSend(in_handler, in_proxy, in_n) { } }; diff --git a/src/vt/pipe/callback/cb_union/cb_raw_base.cc b/src/vt/pipe/callback/cb_union/cb_raw_base.cc index 5a75be83b1..1d3cc984a8 100644 --- a/src/vt/pipe/callback/cb_union/cb_raw_base.cc +++ b/src/vt/pipe/callback/cb_union/cb_raw_base.cc @@ -49,7 +49,7 @@ namespace vt { namespace pipe { namespace callback { namespace cbunion { CallbackRawBaseSingle::CallbackRawBaseSingle( RawSendMsgTagType, PipeType const& in_pipe, HandlerType const in_handler, - NodeType const& in_node + ::vt::NodeT const& in_node ) : pipe_(in_pipe), cb_(SendMsgCB{in_handler,in_node}) { } @@ -87,7 +87,7 @@ CallbackRawBaseSingle::CallbackRawBaseSingle( CallbackRawBaseSingle::CallbackRawBaseSingle( RawSendObjGrpTagType, PipeType in_pipe, HandlerType in_handler, - ObjGroupProxyType in_proxy, NodeType in_node + ObjGroupProxyType in_proxy, ::vt::NodeT in_node ) : pipe_(in_pipe), cb_(SendObjGrpCB{in_handler,in_proxy,in_node}) { } diff --git a/src/vt/pipe/callback/cb_union/cb_raw_base.h b/src/vt/pipe/callback/cb_union/cb_raw_base.h index a48dd02308..32266484f9 100644 --- a/src/vt/pipe/callback/cb_union/cb_raw_base.h +++ b/src/vt/pipe/callback/cb_union/cb_raw_base.h @@ -85,7 +85,7 @@ struct CallbackRawBaseSingle { // Constructors for different types of callbacks CallbackRawBaseSingle( RawSendMsgTagType, PipeType const& in_pipe, HandlerType const in_handler, - NodeType const& in_node + ::vt::NodeT const& in_node ); CallbackRawBaseSingle( RawBcastMsgTagType, PipeType const& in_pipe, HandlerType const in_handler @@ -109,7 +109,7 @@ struct CallbackRawBaseSingle { ); CallbackRawBaseSingle( RawSendObjGrpTagType, PipeType in_pipe, HandlerType in_handler, - ObjGroupProxyType in_proxy, NodeType in_node + ObjGroupProxyType in_proxy, ::vt::NodeT in_node ); template @@ -166,7 +166,7 @@ struct CallbackTyped : CallbackRawBaseSingle { // Forwarding constructors for different types of callbacks CallbackTyped( RawSendMsgTagType, PipeType const& in_pipe, HandlerType const in_handler, - NodeType const& in_node + ::vt::NodeT const& in_node ) : CallbackRawBaseSingle(RawSendMsgTag,in_pipe,in_handler,in_node) { } CallbackTyped( @@ -207,7 +207,7 @@ struct CallbackTyped : CallbackRawBaseSingle { { } CallbackTyped( RawSendObjGrpTagType, PipeType in_pipe, HandlerType in_handler, - ObjGroupProxyType in_proxy, NodeType in_node + ObjGroupProxyType in_proxy, ::vt::NodeT in_node ) : CallbackRawBaseSingle( RawSendObjGrpTag,in_pipe,in_handler,in_proxy,in_node ) diff --git a/src/vt/pipe/callback/handler_send/callback_send.h b/src/vt/pipe/callback/handler_send/callback_send.h index 34210adadf..cdf90b37a4 100644 --- a/src/vt/pipe/callback/handler_send/callback_send.h +++ b/src/vt/pipe/callback/handler_send/callback_send.h @@ -72,7 +72,7 @@ struct CallbackSend : CallbackBase> { CallbackSend(CallbackSend&&) = default; CallbackSend( - HandlerType const in_handler, NodeType const& in_send_node + HandlerType const in_handler, NodeT const& in_send_node ); HandlerType getHandler() const { return handler_; } @@ -91,7 +91,7 @@ struct CallbackSend : CallbackBase> { void trigger_(SignalDataType* data) override; private: - NodeType send_node_ = uninitialized_destination; + NodeT send_node_ = {}; HandlerType handler_ = uninitialized_handler; }; diff --git a/src/vt/pipe/callback/handler_send/callback_send.impl.h b/src/vt/pipe/callback/handler_send/callback_send.impl.h index fd172c0eab..0e44085b54 100644 --- a/src/vt/pipe/callback/handler_send/callback_send.impl.h +++ b/src/vt/pipe/callback/handler_send/callback_send.impl.h @@ -55,7 +55,7 @@ namespace vt { namespace pipe { namespace callback { template CallbackSend::CallbackSend( - HandlerType const in_handler, NodeType const& in_send_node + HandlerType const in_handler, NodeT const& in_send_node ) : send_node_(in_send_node), handler_(in_handler) { } diff --git a/src/vt/pipe/callback/handler_send/callback_send_han.h b/src/vt/pipe/callback/handler_send/callback_send_han.h index d9b3b93a01..40d3d30563 100644 --- a/src/vt/pipe/callback/handler_send/callback_send_han.h +++ b/src/vt/pipe/callback/handler_send/callback_send_han.h @@ -59,7 +59,7 @@ struct CallbackSendHandler : CallbackBase> { using SignalDataType = typename SignalType::DataType; using MessageType = MsgT; - CallbackSendHandler(NodeType const& in_send_node); + CallbackSendHandler(NodeT const& in_send_node); template void serialize(SerializerT& s); @@ -68,7 +68,7 @@ struct CallbackSendHandler : CallbackBase> { void trigger_(SignalDataType* data) override; private: - NodeType send_node_ = uninitialized_destination; + NodeT send_node_ = {}; }; }}} /* end namespace vt::pipe::callback */ diff --git a/src/vt/pipe/callback/handler_send/callback_send_han.impl.h b/src/vt/pipe/callback/handler_send/callback_send_han.impl.h index 72b9a6a547..9e0671339f 100644 --- a/src/vt/pipe/callback/handler_send/callback_send_han.impl.h +++ b/src/vt/pipe/callback/handler_send/callback_send_han.impl.h @@ -56,7 +56,7 @@ namespace vt { namespace pipe { namespace callback { template * f> -CallbackSendHandler::CallbackSendHandler(NodeType const& in_send_node) +CallbackSendHandler::CallbackSendHandler(NodeT const& in_send_node) : send_node_(in_send_node) { } diff --git a/src/vt/pipe/callback/handler_send/callback_send_tl.cc b/src/vt/pipe/callback/handler_send/callback_send_tl.cc index 335d069019..bcbb0150de 100644 --- a/src/vt/pipe/callback/handler_send/callback_send_tl.cc +++ b/src/vt/pipe/callback/handler_send/callback_send_tl.cc @@ -53,7 +53,7 @@ namespace vt { namespace pipe { namespace callback { CallbackSendTypeless::CallbackSendTypeless( - HandlerType const in_handler, NodeType const& in_send_node + HandlerType const in_handler, ::vt::NodeT const& in_send_node ) : send_node_(in_send_node), handler_(in_handler) { } diff --git a/src/vt/pipe/callback/handler_send/callback_send_tl.h b/src/vt/pipe/callback/handler_send/callback_send_tl.h index e86d491132..84ce28bcfc 100644 --- a/src/vt/pipe/callback/handler_send/callback_send_tl.h +++ b/src/vt/pipe/callback/handler_send/callback_send_tl.h @@ -58,14 +58,14 @@ struct CallbackSendTypeless : CallbackBaseTL { CallbackSendTypeless& operator=(CallbackSendTypeless const&) = default; CallbackSendTypeless( - HandlerType const in_handler, NodeType const& in_send_node + HandlerType const in_handler, ::vt::NodeT const& in_send_node ); template void serialize(SerializerT& s); HandlerType getHandler() const { return handler_; } - NodeType getSendNode() const { return send_node_; } + ::vt::NodeT getSendNode() const { return send_node_; } bool operator==(CallbackSendTypeless const& other) const { return other.send_node_ == send_node_ && other.handler_ == handler_; @@ -77,7 +77,7 @@ struct CallbackSendTypeless : CallbackBaseTL { void triggerVoid(PipeType const& pipe); private: - NodeType send_node_ = uninitialized_destination; + ::vt::NodeT send_node_ = {}; HandlerType handler_ = uninitialized_handler; }; diff --git a/src/vt/pipe/callback/objgroup_send/callback_objgroup_send.h b/src/vt/pipe/callback/objgroup_send/callback_objgroup_send.h index 3a53e664c0..b03d03dced 100644 --- a/src/vt/pipe/callback/objgroup_send/callback_objgroup_send.h +++ b/src/vt/pipe/callback/objgroup_send/callback_objgroup_send.h @@ -55,7 +55,7 @@ namespace vt { namespace pipe { namespace callback { struct CallbackObjGroupSend : CallbackBaseTL { CallbackObjGroupSend() = default; CallbackObjGroupSend( - HandlerType in_han, ObjGroupProxyType in_objgroup, NodeType in_node + HandlerType in_han, ObjGroupProxyType in_objgroup, ::vt::NodeT in_node ) : handler_(in_han), objgroup_(in_objgroup), node_(in_node) { } @@ -77,7 +77,7 @@ struct CallbackObjGroupSend : CallbackBaseTL { private: HandlerType handler_ = uninitialized_handler; ObjGroupProxyType objgroup_ = no_obj_group; - NodeType node_ = uninitialized_destination; + ::vt::NodeT node_ = {}; }; }}} /* end namespace vt::pipe::callback */ diff --git a/src/vt/pipe/id/pipe_id.cc b/src/vt/pipe/id/pipe_id.cc index 90a2892543..121997892d 100644 --- a/src/vt/pipe/id/pipe_id.cc +++ b/src/vt/pipe/id/pipe_id.cc @@ -49,7 +49,7 @@ namespace vt { namespace pipe { /*static*/ PipeType PipeIDBuilder::createPipeID( - PipeIDType const& id, NodeType const& node, bool const& is_send_back, + PipeIDType const& id, ::vt::NodeT const& node, bool const& is_send_back, bool const& is_persist ) { PipeType new_pipe = 0; @@ -75,7 +75,7 @@ namespace vt { namespace pipe { } /*static*/ void PipeIDBuilder::setNode( - PipeType& pipe, NodeType const& node + PipeType& pipe, ::vt::NodeT const& node ) { BitPackerType::setField(pipe, node); } @@ -94,9 +94,9 @@ namespace vt { namespace pipe { return BitPackerType::boolGetField(pipe); } -/*static*/ NodeType PipeIDBuilder::getNode(PipeType const& pipe) { +/*static*/ ::vt::NodeT PipeIDBuilder::getNode(PipeType const& pipe) { return BitPackerType::getField< - ePipeIDBits::Node, pipe_node_num_bits, NodeType + ePipeIDBits::Node, pipe_node_num_bits, ::vt::NodeT >(pipe); } diff --git a/src/vt/pipe/id/pipe_id.h b/src/vt/pipe/id/pipe_id.h index cef1318d8e..a08a59ee0c 100644 --- a/src/vt/pipe/id/pipe_id.h +++ b/src/vt/pipe/id/pipe_id.h @@ -53,7 +53,7 @@ namespace vt { namespace pipe { static constexpr BitCountType const pipe_send_back_num_bits = 1; static constexpr BitCountType const pipe_persist_num_bits = 1; static constexpr BitCountType const pipe_node_num_bits = - BitCounterType::value; + BitCounterType ::value; static constexpr BitCountType const pipe_id_num_bits = BitCounterType::value; @@ -66,17 +66,17 @@ enum ePipeIDBits { struct PipeIDBuilder { static PipeType createPipeID( - PipeIDType const& id, NodeType const& node, + PipeIDType const& id, ::vt::NodeT const& node, bool const& is_send_back = false, bool const& is_persist = true ); static void setIsSendback(PipeType& pipe, bool const& is_send_back); static void setIsPersist(PipeType& pipe, bool const& is_persist); - static void setNode(PipeType& pipe, NodeType const& node); + static void setNode(PipeType& pipe, ::vt::NodeT const& node); static void setID(PipeType& pipe, PipeIDType const& id); static bool isSendback(PipeType const& pipe); static bool isPersist(PipeType const& pipe); - static NodeType getNode(PipeType const& pipe); + static ::vt::NodeT getNode(PipeType const& pipe); static PipeIDType getPipeID(PipeType const& pipe); }; diff --git a/src/vt/pipe/pipe_manager.h b/src/vt/pipe/pipe_manager.h index 0a6e933e13..3d45411cd5 100644 --- a/src/vt/pipe/pipe_manager.h +++ b/src/vt/pipe/pipe_manager.h @@ -229,7 +229,7 @@ struct PipeManager * \return the new callback */ template * f> - Callback makeSend(NodeType const& node); + Callback makeSend(NodeT const& node); /** * \brief Make a callback to a functor handler to be invoked on a certain @@ -240,7 +240,7 @@ struct PipeManager * \return the new callback */ template > - Callback makeSend(NodeType const& node); + Callback makeSend(NodeT const& node); /** * \brief Make a callback to a void functor handler to be invoked on a certain @@ -254,7 +254,7 @@ struct PipeManager typename FunctorT, typename = std::enable_if_t::has_no_msg_type> > - Callback makeSend(NodeType const& node); + Callback makeSend(NodeT const& node); /** * \brief Make a callback to a particular collection element invoking a diff --git a/src/vt/pipe/pipe_manager.impl.h b/src/vt/pipe/pipe_manager.impl.h index 749f90d6f2..25b7e2f554 100644 --- a/src/vt/pipe/pipe_manager.impl.h +++ b/src/vt/pipe/pipe_manager.impl.h @@ -99,17 +99,17 @@ Callback PipeManager::makeFunc(LifetimeEnum life, FuncMsgType fn) { } template * f> -Callback PipeManager::makeSend(NodeType const& node) { +Callback PipeManager::makeSend(NodeT const& node) { return makeCallbackSingleSend(node); } template -Callback PipeManager::makeSend(NodeType const& node) { +Callback PipeManager::makeSend(NodeT const& node) { return makeCallbackFunctorSend(node); } template -Callback PipeManager::makeSend(NodeType const& node) { +Callback PipeManager::makeSend(NodeT const& node) { return makeCallbackFunctorSendVoid(node); } diff --git a/src/vt/pipe/pipe_manager_tl.h b/src/vt/pipe/pipe_manager_tl.h index 5792fcc51f..60d5e0d0bf 100644 --- a/src/vt/pipe/pipe_manager_tl.h +++ b/src/vt/pipe/pipe_manager_tl.h @@ -90,11 +90,11 @@ struct PipeManagerTL : virtual PipeManagerBase { template * f, typename CbkT = DefType> - CbkT makeCallbackSingleSendT(NodeType const& node); + CbkT makeCallbackSingleSendT(NodeT const& node); // Single active message function-handler template * f, typename CbkT = DefType> - CbkT makeCallbackSingleSend(NodeType const& node); + CbkT makeCallbackSingleSend(NodeT const& node); template * f, typename CbkT = DefType> CbkT makeCallbackSingleBcast(); @@ -105,7 +105,7 @@ struct PipeManagerTL : virtual PipeManagerBase { typename T = typename util::FunctorExtractor::MessageType, typename CbkT = DefType > - CbkT makeCallbackFunctorSend(NodeType const& node); + CbkT makeCallbackFunctorSend(NodeT const& node); template < typename FunctorT, @@ -116,7 +116,7 @@ struct PipeManagerTL : virtual PipeManagerBase { // Single active message functor-handler void param template > - CbkT makeCallbackFunctorSendVoid(NodeType const& node); + CbkT makeCallbackFunctorSendVoid(NodeT const& node); template > CbkT makeCallbackFunctorBcastVoid(); @@ -184,7 +184,7 @@ struct PipeManagerTL : virtual PipeManagerBase { CallbackMsgType makeCallbackTyped(); template * f, typename CbkT = DefType> - void addListener(CbkT const& cb, NodeType const& node); + void addListener(CbkT const& cb, NodeT const& node); template * f, typename CbkT = DefType> void addListenerBcast(CbkT const& cb); @@ -194,10 +194,10 @@ struct PipeManagerTL : virtual PipeManagerBase { typename T = typename util::FunctorExtractor::MessageType, typename CbkT = DefType > - void addListenerFunctor(CbkT const& cb, NodeType const& node); + void addListenerFunctor(CbkT const& cb, NodeT const& node); template > - void addListenerFunctorVoid(CbkT const& cb, NodeType const& node); + void addListenerFunctorVoid(CbkT const& cb, NodeT const& node); template < typename FunctorT, diff --git a/src/vt/pipe/pipe_manager_tl.impl.h b/src/vt/pipe/pipe_manager_tl.impl.h index c396165ee2..29171cf2b2 100644 --- a/src/vt/pipe/pipe_manager_tl.impl.h +++ b/src/vt/pipe/pipe_manager_tl.impl.h @@ -86,7 +86,7 @@ PipeManagerTL::CallbackMsgType PipeManagerTL::makeCallbackTyped() { } template * f, typename CallbackT> -void PipeManagerTL::addListener(CallbackT const& cb, NodeType const& node) { +void PipeManagerTL::addListener(CallbackT const& cb, NodeT const& node) { auto const& han = auto_registry::makeAutoHandler(); addListenerAny( cb.getPipe(), std::make_unique>(han,node) @@ -103,7 +103,7 @@ void PipeManagerTL::addListenerBcast(CallbackT const& cb) { template void PipeManagerTL::addListenerFunctor( - CallbackT const& cb, NodeType const& node + CallbackT const& cb, NodeT const& node ) { using MsgT = typename util::FunctorExtractor::MessageType; auto const& han = auto_registry::makeAutoHandlerFunctor(); @@ -114,7 +114,7 @@ void PipeManagerTL::addListenerFunctor( template void PipeManagerTL::addListenerFunctorVoid( - CallbackT const& cb, NodeType const& node + CallbackT const& cb, NodeT const& node ) { auto const& han = auto_registry::makeAutoHandlerFunctor(); addListenerAny( @@ -274,7 +274,7 @@ PipeManagerTL::makeCallbackSingleProxyBcastDirect(ColProxyType proxy) { template * f, typename CallbackT> CallbackT -PipeManagerTL::makeCallbackSingleSend(NodeType const& send_to_node) { +PipeManagerTL::makeCallbackSingleSend(NodeT const& send_to_node) { auto const& new_pipe_id = makePipeID(true,false); auto const& handler = auto_registry::makeAutoHandler(); auto cb = CallbackT( @@ -285,7 +285,7 @@ PipeManagerTL::makeCallbackSingleSend(NodeType const& send_to_node) { template * f, typename CallbackT> CallbackT - PipeManagerTL::makeCallbackSingleSendT(NodeType const& send_to_node) { + PipeManagerTL::makeCallbackSingleSendT(NodeT const& send_to_node) { auto const& new_pipe_id = makePipeID(true,false); auto const& handler = auto_registry::makeAutoHandler(); auto cb = CallbackT( @@ -378,7 +378,7 @@ PipeManagerTL::makeCallbackSingleAnon(LifetimeEnum life, FuncMsgType fn) { template CallbackT -PipeManagerTL::makeCallbackFunctorSend(NodeType const& send_to_node) { +PipeManagerTL::makeCallbackFunctorSend(NodeT const& send_to_node) { using MsgT = typename util::FunctorExtractor::MessageType; auto const& new_pipe_id = makePipeID(true,false); auto const& handler = @@ -404,7 +404,7 @@ PipeManagerTL::makeCallbackFunctorBcast() { template CallbackT -PipeManagerTL::makeCallbackFunctorSendVoid(NodeType const& send_to_node) { +PipeManagerTL::makeCallbackFunctorSendVoid(NodeT const& send_to_node) { auto const& new_pipe_id = makePipeID(true,false); auto const& handler = auto_registry::makeAutoHandlerFunctor(); auto cb = CallbackT( diff --git a/src/vt/pipe/pipe_manager_typed.h b/src/vt/pipe/pipe_manager_typed.h index edf0fc2d4b..4e2ea8540e 100644 --- a/src/vt/pipe/pipe_manager_typed.h +++ b/src/vt/pipe/pipe_manager_typed.h @@ -93,7 +93,7 @@ struct PipeManagerTyped : virtual PipeManagerBase { typename RepeatNImpl>::ResultType > makeCallbackMultiSendTyped( - bool const is_persist, NodeType const& send_to_node + bool const is_persist, NodeT const& send_to_node ); template * f> @@ -103,10 +103,10 @@ struct PipeManagerTyped : virtual PipeManagerBase { auto pushTargetBcast(CallbackT in, bool const& inc); template * f> - auto pushTarget(NodeType const& send_to_node); + auto pushTarget(NodeT const& send_to_node); template * f, typename CallbackT> - auto pushTarget(CallbackT in, NodeType const& send_to_node); + auto pushTarget(CallbackT in, NodeT const& send_to_node); template auto buildMultiCB(CallbackT in); @@ -117,7 +117,7 @@ struct PipeManagerTyped : virtual PipeManagerBase { */ template * f> CallbackSendType makeCallbackSingleSendTyped( - bool const is_persist, NodeType const& send_to_node + bool const is_persist, NodeT const& send_to_node ); template < @@ -125,12 +125,12 @@ struct PipeManagerTyped : virtual PipeManagerBase { typename MsgT = typename util::FunctorExtractor::MessageType > CallbackSendType makeCallbackSingleSendFunctorTyped( - bool const is_persist, NodeType const& send_to_node + bool const is_persist, NodeT const& send_to_node ); template CallbackSendVoidType makeCallbackSingleSendFunctorVoidTyped( - bool const is_persist, NodeType const& send_to_node + bool const is_persist, NodeT const& send_to_node ); /* diff --git a/src/vt/pipe/pipe_manager_typed.impl.h b/src/vt/pipe/pipe_manager_typed.impl.h index dd8aa3371f..4fd6575937 100644 --- a/src/vt/pipe/pipe_manager_typed.impl.h +++ b/src/vt/pipe/pipe_manager_typed.impl.h @@ -100,7 +100,7 @@ PipeManagerTyped::makeCallbackSingleAnonVoidTyped( template * f> PipeManagerTyped::CallbackSendType PipeManagerTyped::makeCallbackSingleSendTyped( - bool const is_persist, NodeType const& send_to_node + bool const is_persist, NodeT const& send_to_node ) { auto const& new_pipe_id = makePipeID(is_persist,false); auto const& handler = auto_registry::makeAutoHandler(); @@ -113,7 +113,7 @@ PipeManagerTyped::makeCallbackSingleSendTyped( template PipeManagerTyped::CallbackSendType PipeManagerTyped::makeCallbackSingleSendFunctorTyped( - bool const is_persist, NodeType const& send_to_node + bool const is_persist, NodeT const& send_to_node ) { auto const& new_pipe_id = makePipeID(is_persist,false); auto const& handler = @@ -125,7 +125,7 @@ PipeManagerTyped::makeCallbackSingleSendFunctorTyped( template PipeManagerTyped::CallbackSendVoidType PipeManagerTyped::makeCallbackSingleSendFunctorVoidTyped( - bool const is_persist, NodeType const& send_to_node + bool const is_persist, NodeT const& send_to_node ) { auto const& new_pipe_id = makePipeID(is_persist,false); auto const& handler = auto_registry::makeAutoHandlerFunctor(); @@ -205,16 +205,16 @@ interface::CallbackDirectSendMulti< typename RepeatNImpl>::ResultType > PipeManagerTyped::makeCallbackMultiSendTyped( - bool const is_persist, NodeType const& send_to_node + bool const is_persist, NodeT const& send_to_node ) { using CBSendT = callback::CallbackSend; - using ConsT = std::tuple; + using ConsT = std::tuple ; using TupleConsT = typename RepeatNImpl::ResultType; using ConstructMeta = ConstructCallbacks; using TupleCBType = typename ConstructMeta::ResultType; auto const& new_pipe_id = makePipeID(is_persist,false); - std::array send_node_array; + std::array send_node_array; send_node_array.fill(send_to_node); auto const cons = TupleConsT{send_node_array}; auto const tuple = ConstructMeta::make(cons); @@ -239,7 +239,7 @@ auto PipeManagerTyped::pushTargetBcast(bool const& inc) { } template * f, typename CallbackT> -auto PipeManagerTyped::pushTarget(CallbackT in, NodeType const& send_to_node) { +auto PipeManagerTyped::pushTarget(CallbackT in, NodeT const& send_to_node) { auto const& han = auto_registry::makeAutoHandler(); return std::tuple_cat( std::make_tuple(callback::CallbackSend(han,send_to_node)), in @@ -247,7 +247,7 @@ auto PipeManagerTyped::pushTarget(CallbackT in, NodeType const& send_to_node) { } template * f> -auto PipeManagerTyped::pushTarget(NodeType const& send_to_node) { +auto PipeManagerTyped::pushTarget(NodeT const& send_to_node) { auto const& han = auto_registry::makeAutoHandler(); return std::make_tuple(callback::CallbackSend(han,send_to_node)); } diff --git a/src/vt/rdma/channel/rdma_channel.cc b/src/vt/rdma/channel/rdma_channel.cc index 79fb0504aa..c534108f73 100644 --- a/src/vt/rdma/channel/rdma_channel.cc +++ b/src/vt/rdma/channel/rdma_channel.cc @@ -51,8 +51,8 @@ namespace vt { namespace rdma { Channel::Channel( RDMA_HandleType const& in_rdma_handle, RDMA_TypeType const& in_op_type, - NodeType const& in_target, TagType const& in_channel_group_tag, - NodeType const& in_non_target, RDMA_PtrType const& in_ptr, ByteType const& in_num_bytes + NodeT const& in_target, TagType const& in_channel_group_tag, + NodeT const& in_non_target, RDMA_PtrType const& in_ptr, ByteType const& in_num_bytes ) : rdma_handle_(in_rdma_handle), target_(in_target), non_target_(in_non_target), num_bytes_(in_num_bytes), ptr_(in_ptr), op_type_(in_op_type), channel_group_tag_(in_channel_group_tag) @@ -64,8 +64,8 @@ Channel::Channel( vtAssertExpr(target_ != non_target_); vtAssert( - non_target_ != uninitialized_destination and - target_ != uninitialized_destination, + non_target_ != NodeT{} and + target_ != NodeT{}, "Channel must know both target and non_target" ); @@ -328,12 +328,12 @@ Channel::initChannelWindow() { ); } -NodeType +NodeT Channel::getTarget() const { return target_; } -NodeType +NodeT Channel::getNonTarget() const { return non_target_; } diff --git a/src/vt/rdma/channel/rdma_channel.h b/src/vt/rdma/channel/rdma_channel.h index 1ec3a4c47f..904b0d7235 100644 --- a/src/vt/rdma/channel/rdma_channel.h +++ b/src/vt/rdma/channel/rdma_channel.h @@ -68,8 +68,8 @@ struct Channel { Channel( RDMA_HandleType const& in_rdma_handle, RDMA_TypeType const& in_op_type, - NodeType const& in_target, TagType const& in_channel_group_tag, - NodeType const& in_non_target = uninitialized_destination, + NodeT const& in_target, TagType const& in_channel_group_tag, + NodeT const& in_non_target = {}, RDMA_PtrType const& in_ptr = nullptr, ByteType const& in_num_bytes = no_byte ); @@ -86,8 +86,8 @@ struct Channel { RDMA_PtrType const& ptr, ByteType const& ptr_num_bytes, ByteType const& offset ); - NodeType getTarget() const; - NodeType getNonTarget() const; + NodeT getTarget() const; + NodeT getNonTarget() const; template void serialize(Serializer& s) { @@ -118,8 +118,8 @@ struct Channel { RDMA_HandleType const rdma_handle_ = no_rdma_handle; RDMA_GroupPosType target_pos_ = no_group_pos; RDMA_GroupPosType non_target_pos_ = no_group_pos; - NodeType target_ = uninitialized_destination; - NodeType non_target_ = uninitialized_destination; + NodeT target_ = {}; + NodeT non_target_ = {}; ByteType num_bytes_ = no_byte; RDMA_PtrType ptr_ = no_rdma_ptr; RDMA_TypeType op_type_ = uninitialized_rdma_type; diff --git a/src/vt/rdma/channel/rdma_channel_lookup.h b/src/vt/rdma/channel/rdma_channel_lookup.h index 802260e366..1cff86b2e3 100644 --- a/src/vt/rdma/channel/rdma_channel_lookup.h +++ b/src/vt/rdma/channel/rdma_channel_lookup.h @@ -54,16 +54,16 @@ namespace vt { namespace rdma { struct ChannelLookup { RDMA_HandleType handle = no_rdma_handle; - NodeType target = uninitialized_destination; - NodeType non_target = uninitialized_destination; + NodeT target = {}; + NodeT non_target = {}; ChannelLookup( - RDMA_HandleType const& han, NodeType const& in_target, - NodeType const& in_non_target + RDMA_HandleType const& han, NodeT const& in_target, + NodeT const& in_non_target ) : handle(han), target(in_target), non_target(in_non_target) { - vtAssertExpr(target != uninitialized_destination); - vtAssertExpr(non_target != uninitialized_destination); + vtAssertExpr(target != NodeT{}); + vtAssertExpr(non_target != NodeT{}); } ChannelLookup(ChannelLookup const&) = default; @@ -90,8 +90,8 @@ template <> struct hash { size_t operator()(vt::rdma::ChannelLookup const& in) const { auto const& combined = std::hash()(in.handle) ^ - std::hash()(in.target) ^ - std::hash()(in.non_target); + std::hash()(in.target) ^ + std::hash()(in.non_target); return combined; } }; diff --git a/src/vt/rdma/collection/rdma_collection.cc b/src/vt/rdma/collection/rdma_collection.cc index c8565a1b9a..641a9136a0 100644 --- a/src/vt/rdma/collection/rdma_collection.cc +++ b/src/vt/rdma/collection/rdma_collection.cc @@ -190,7 +190,7 @@ namespace vt { namespace rdma { auto msg = makeMessage( new_op, num_bytes, elm, tag, rdma_handle, - action_after_put ? this_node : uninitialized_destination, + action_after_put ? this_node : NodeT {}, this_node ); diff --git a/src/vt/rdma/group/rdma_group.cc b/src/vt/rdma/group/rdma_group.cc index b867e9079c..219d77b49a 100644 --- a/src/vt/rdma/group/rdma_group.cc +++ b/src/vt/rdma/group/rdma_group.cc @@ -59,7 +59,7 @@ Group::get_map() const { return map; } -NodeType +NodeT Group::findDefaultNode(RDMA_ElmType const& elm) { auto const& elms = num_total_elems; auto const& default_node = map.block_map(elm, elms); diff --git a/src/vt/rdma/group/rdma_group.h b/src/vt/rdma/group/rdma_group.h index d52e8e023c..92c65237e8 100644 --- a/src/vt/rdma/group/rdma_group.h +++ b/src/vt/rdma/group/rdma_group.h @@ -73,7 +73,7 @@ struct Group { RDMA_ElmType hi = region.hi; RDMA_ElmType elm_hi = lo; RDMA_BlockType blk_lo; - NodeType cur_node; + NodeT cur_node; vtAssertExpr(map.elm_map != nullptr); vtAssertExpr(map.block_map != nullptr); @@ -90,7 +90,7 @@ struct Group { } } - NodeType findDefaultNode(RDMA_ElmType const& elm); + NodeT findDefaultNode(RDMA_ElmType const& elm); template void serialize(Serializer& s) { diff --git a/src/vt/rdma/group/rdma_map.h b/src/vt/rdma/group/rdma_map.h index d6386fb354..466026a576 100644 --- a/src/vt/rdma/group/rdma_map.h +++ b/src/vt/rdma/group/rdma_map.h @@ -59,11 +59,11 @@ struct Map { : block_map(in_block_map), elm_map(in_elm_map) { } - static NodeType defaultBlockMap( + static NodeT defaultBlockMap( RDMA_BlockType block, RDMA_BlockType __attribute__((unused)) num_blocks ) { auto const& num_nodes = theContext()->getNumNodes(); - return block % num_nodes; + return NodeT{block % num_nodes}; }; static RDMA_BlockElmRangeType defaultElmMap( diff --git a/src/vt/rdma/rdma.cc b/src/vt/rdma/rdma.cc index 522bec52f3..4160b39109 100644 --- a/src/vt/rdma/rdma.cc +++ b/src/vt/rdma/rdma.cc @@ -185,7 +185,7 @@ RDMAManager::RDMAManager() normal, rdma, "put_data: after put trigger: send_back={}\n", send_back ); - if (send_back != uninitialized_destination) { + if (send_back != NodeT{}) { auto new_msg = makeMessage(op_id); theMsg()->sendMsg(send_back, new_msg); } @@ -226,7 +226,7 @@ RDMAManager::RDMAManager() normal, rdma, "put_data: after put trigger: send_back={}\n", send_back ); - if (send_back != uninitialized_destination) { + if (send_back != NodeT{}) { auto new_msg = makeMessage(op_id); theMsg()->sendMsg( send_back, new_msg @@ -396,7 +396,7 @@ RDMAManager::allocateNewRdmaHandler() { void RDMAManager::requestGetData( GetMessage* msg, bool const& is_user_msg, RDMA_HandleType const& han, TagType const& tag, ByteType const& num_bytes, ByteType const& offset, - bool const& is_local, RDMA_PtrType const& ptr, NodeType const& from_node, + bool const& is_local, RDMA_PtrType const& ptr, NodeT const& from_node, RDMA_ContinuationType cont, ActionType next_action ) { auto const& this_node = theContext()->getNode(); @@ -482,7 +482,7 @@ void RDMAManager::triggerPutBackData(RDMA_OpType const& op) { void RDMAManager::triggerPutRecvData( RDMA_HandleType const& han, TagType const& tag, RDMA_PtrType ptr, ByteType const& num_bytes, ByteType const& offset, ActionType const& action, - bool const& is_local, NodeType const& from_node + bool const& is_local, NodeT const& from_node ) { auto const& this_node = theContext()->getNode(); auto const handler_node = RDMA_HandleManagerType::getRdmaNode(han); @@ -545,7 +545,7 @@ RDMAManager::tryPutPtr( void RDMAManager::syncChannel( bool const& is_local, RDMA_HandleType const& han, RDMA_TypeType const& type, - NodeType const& target, NodeType const& non_target, ActionType const& action + NodeT const& target, NodeT const& non_target, ActionType const& action ) { vt_debug_print( normal, rdma_channel, @@ -569,8 +569,8 @@ void RDMAManager::syncChannel( void RDMAManager::sendDataChannel( RDMA_TypeType const& type, RDMA_HandleType const& han, RDMA_PtrType const& ptr, - ByteType const& num_bytes, ByteType const& offset, NodeType const& target, - NodeType const& non_target, ActionType action_after_remote_op + ByteType const& num_bytes, ByteType const& offset, NodeT const& target, + NodeT const& non_target, ActionType action_after_remote_op ) { auto channel = findChannel(han, type, target, non_target, false, true); @@ -602,7 +602,7 @@ void RDMAManager::sendDataChannel( void RDMAManager::putData( RDMA_HandleType const& han, RDMA_PtrType const& ptr, ByteType const& num_bytes, ByteType const& offset, TagType const& tag, ByteType const& elm_size, - ActionType action_after_put, NodeType const& collective_node, + ActionType action_after_put, NodeT const& collective_node, bool const direct_message_send ) { auto const& this_node = theContext()->getNode(); @@ -618,7 +618,7 @@ void RDMAManager::putData( put_node, print_ptr(ptr), num_bytes, offset, tag, han ); - if (is_collective and collective_node == uninitialized_destination) { + if (is_collective and collective_node == NodeT{}) { return putDataIntoBufCollective( han, ptr, num_bytes, elm_size, offset, action_after_put ); @@ -648,7 +648,7 @@ void RDMAManager::putData( if (direct_message_send) { msg = promoteMsg(reinterpret_cast(ptr)); msg->send_back = - action_after_put ? this_node : uninitialized_destination; + action_after_put ? this_node : NodeT {}; msg->rdma_handle = han; msg->recv_node = this_node; msg->op_id = new_op; @@ -658,7 +658,7 @@ void RDMAManager::putData( } else { msg = makeMessageSz( num_bytes, new_op, num_bytes, offset, no_tag, han, - action_after_put ? this_node : uninitialized_destination, + action_after_put ? this_node : NodeT {}, this_node, direct_put_pack ); auto msg_ptr = reinterpret_cast(msg.get()) + sizeof(PutMessage); @@ -683,7 +683,7 @@ void RDMAManager::putData( } else { auto msg = makeMessage( new_op, num_bytes, offset, no_tag, han, - action_after_put ? this_node : uninitialized_destination, + action_after_put ? this_node : NodeT {}, this_node ); @@ -772,7 +772,7 @@ void RDMAManager::putRegionTypeless( auto remote_action = new Action(1, after_put_action); group->walk_region(region, [&]( - NodeType node, RDMA_BlockElmRangeType rng, RDMA_ElmType lo, RDMA_ElmType hi + NodeT node, RDMA_BlockElmRangeType rng, RDMA_ElmType lo, RDMA_ElmType hi ) { auto const& blk = std::get<0>(rng); auto const& blk_lo = std::get<1>(rng); @@ -834,7 +834,7 @@ void RDMAManager::getRegionTypeless( auto action = new Action(1, next_action); group->walk_region(region, [&]( - NodeType node, RDMA_BlockElmRangeType rng, RDMA_ElmType lo, RDMA_ElmType hi + NodeT node, RDMA_BlockElmRangeType rng, RDMA_ElmType lo, RDMA_ElmType hi ) { auto const& blk = std::get<0>(rng); auto const& blk_lo = std::get<1>(rng); @@ -915,7 +915,7 @@ void RDMAManager::getDataIntoBufCollective( void RDMAManager::getDataIntoBuf( RDMA_HandleType const& han, RDMA_PtrType const& ptr, ByteType const& num_bytes, ByteType const& offset, TagType const& tag, ActionType next_action, - ByteType const& elm_size, NodeType const& collective_node + ByteType const& elm_size, NodeT const& collective_node ) { auto const& this_node = theContext()->getNode(); auto const& handle_getNode = RDMA_HandleManagerType::getRdmaNode(han); @@ -930,7 +930,7 @@ void RDMAManager::getDataIntoBuf( auto const& getNode = is_collective ? collective_node : handle_getNode; - if (is_collective and collective_node == uninitialized_destination) { + if (is_collective and collective_node == NodeT{}) { return getDataIntoBufCollective( han, ptr, num_bytes, elm_size, offset, next_action ); @@ -1024,13 +1024,13 @@ void RDMAManager::getData( } void RDMAManager::newChannel( - RDMA_TypeType const& type, RDMA_HandleType const& han, NodeType const& spec_target, - NodeType const& in_non_target, ActionType const& action + RDMA_TypeType const& type, RDMA_HandleType const& han, NodeT const& spec_target, + NodeT const& in_non_target, ActionType const& action ) { auto const& this_node = theContext()->getNode(); auto const target = getTarget(han, spec_target); auto const non_target = - in_non_target == uninitialized_destination ? this_node : in_non_target; + in_non_target == NodeT{} ? this_node : in_non_target; vt_debug_print( normal, rdma, @@ -1038,7 +1038,7 @@ void RDMAManager::newChannel( ); vtAssert( - (target == spec_target or spec_target == uninitialized_destination) + (target == spec_target or spec_target == NodeT{}) , "Target must match handle" ); @@ -1067,8 +1067,8 @@ void RDMAManager::newChannel( } void RDMAManager::setupChannelWithRemote( - RDMA_TypeType const& type, RDMA_HandleType const& han, NodeType const& dest, - ActionType const& action, NodeType const& override_target + RDMA_TypeType const& type, RDMA_HandleType const& han, NodeT const& dest, + ActionType const& action, NodeT const& override_target ) { auto const& this_node = theContext()->getNode(); auto const target = getTarget(han, override_target); @@ -1107,7 +1107,7 @@ void RDMAManager::setupChannelWithRemote( void RDMAManager::createDirectChannel( RDMA_TypeType const& type, RDMA_HandleType const& han, ActionType const& action, - NodeType const& override_target + NodeT const& override_target ) { auto const& this_node = theContext()->getNode(); auto const target = getTarget(han, override_target); @@ -1123,9 +1123,9 @@ void RDMAManager::createDirectChannel( } void RDMAManager::createDirectChannelFinish( - RDMA_TypeType const& type, RDMA_HandleType const& han, NodeType const& non_target, + RDMA_TypeType const& type, RDMA_HandleType const& han, NodeT const& non_target, ActionType const& action, TagType const& channel_tag, bool const& is_target, - ByteType const& num_bytes, NodeType const& override_target + ByteType const& num_bytes, NodeT const& override_target ) { auto const target = getTarget(han, override_target); @@ -1186,7 +1186,7 @@ void RDMAManager::createDirectChannelFinish( RDMAManager::RDMA_ChannelLookupType RDMAManager::makeChannelLookup( RDMA_HandleType const& han, RDMA_TypeType const& rdma_op_type, - NodeType const& target, NodeType const& non_target + NodeT const& target, NodeT const& non_target ) { RDMA_HandleType ch_han = han; RDMA_HandleManagerType::setOpType(ch_han, rdma_op_type); @@ -1194,8 +1194,8 @@ RDMAManager::RDMA_ChannelLookupType RDMAManager::makeChannelLookup( } RDMAManager::RDMA_ChannelType* RDMAManager::findChannel( - RDMA_HandleType const& han, RDMA_TypeType const& rdma_op_type, NodeType const& target, - NodeType const& non_target, bool const& should_insert, bool const& must_exist + RDMA_HandleType const& han, RDMA_TypeType const& rdma_op_type, NodeT const& target, + NodeT const& non_target, bool const& should_insert, bool const& must_exist ) { auto chan_iter = channels_.find( makeChannelLookup(han,rdma_op_type,target,non_target) @@ -1218,8 +1218,8 @@ RDMAManager::RDMA_ChannelType* RDMAManager::findChannel( } void RDMAManager::createDirectChannelInternal( - RDMA_TypeType const& type, RDMA_HandleType const& han, NodeType const& non_target, - ActionType const& action, NodeType const& override_target, + RDMA_TypeType const& type, RDMA_HandleType const& han, NodeT const& non_target, + ActionType const& action, NodeT const& override_target, TagType const& channel_tag, ByteType const& num_bytes ) { auto const& this_node = theContext()->getNode(); @@ -1315,7 +1315,7 @@ ByteType RDMAManager::lookupBytesHandler(RDMA_HandleType const& han) { } void RDMAManager::removeDirectChannel( - RDMA_HandleType const& han, NodeType const& override_target, ActionType const& action + RDMA_HandleType const& han, NodeT const& override_target, ActionType const& action ) { auto const& this_node = theContext()->getNode(); auto const target = getTarget(han, override_target); @@ -1352,7 +1352,7 @@ void RDMAManager::removeDirectChannel( TagType RDMAManager::nextRdmaChannelTag() { TagType next_tag = next_channel_tag_++; - NodeType this_node = theContext()->getNode(); + NodeT this_node = theContext()->getNode(); TagType const& ret = (this_node << 16) | next_tag; return ret; } diff --git a/src/vt/rdma/rdma.h b/src/vt/rdma/rdma.h index d7930f2468..9e7618296b 100644 --- a/src/vt/rdma/rdma.h +++ b/src/vt/rdma/rdma.h @@ -205,7 +205,7 @@ struct RDMAManager : runtime::component::Component { ByteType const& num_bytes, ByteType const& offset, TagType const& tag, ByteType const& elm_size = rdma_default_byte_size, ActionType action_after_put = no_action, - NodeType const& collective_node = uninitialized_destination, + NodeT const& collective_node = {}, bool const direct_message_send = false ); @@ -226,7 +226,7 @@ struct RDMAManager : runtime::component::Component { ByteType const& num_bytes, ByteType const& offset, TagType const& tag = no_tag, ActionType next_action = no_action, ByteType const& elm_size = rdma_default_byte_size, - NodeType const& collective_node = uninitialized_destination + NodeT const& collective_node = {} ); /** @@ -544,8 +544,8 @@ struct RDMAManager : runtime::component::Component { * \param[in] action action when complete */ void newChannel( - RDMA_TypeType const& type, RDMA_HandleType const& han, NodeType const& target, - NodeType const& non_target, ActionType const& action + RDMA_TypeType const& type, RDMA_HandleType const& han, NodeT const& target, + NodeT const& non_target, ActionType const& action ); /** @@ -574,8 +574,8 @@ struct RDMAManager : runtime::component::Component { * \param[in] action action when complete */ void newGetChannel( - RDMA_HandleType const& han, NodeType const& target, - NodeType const& non_target, ActionType const& action = nullptr + RDMA_HandleType const& han, NodeT const& target, + NodeT const& non_target, ActionType const& action = nullptr ) { #if vt_check_enabled(mpi_rdma) return newChannel( @@ -595,8 +595,8 @@ struct RDMAManager : runtime::component::Component { * \param[in] action action when complete */ void newPutChannel( - RDMA_HandleType const& han, NodeType const& target, - NodeType const& non_target, ActionType const& action = nullptr + RDMA_HandleType const& han, NodeT const& target, + NodeT const& non_target, ActionType const& action = nullptr ) { #if vt_check_enabled(mpi_rdma) @@ -617,7 +617,7 @@ struct RDMAManager : runtime::component::Component { void syncLocalGetChannel( RDMA_HandleType const& han, ActionType const& action ) { - return syncLocalGetChannel(han, uninitialized_destination, action); + return syncLocalGetChannel(han, NodeT {}, action); } /** @@ -628,7 +628,7 @@ struct RDMAManager : runtime::component::Component { * \param[in] action action when sync completes */ void syncLocalGetChannel( - RDMA_HandleType const& han, NodeType const& in_target, + RDMA_HandleType const& han, NodeT const& in_target, ActionType const& action = nullptr ) { auto const& this_node = theContext()->getNode(); @@ -648,9 +648,9 @@ struct RDMAManager : runtime::component::Component { * \param[in] action action when sync completes */ void syncLocalPutChannel( - RDMA_HandleType const& han, NodeType const& dest, ActionType const& action = nullptr + RDMA_HandleType const& han, NodeT const& dest, ActionType const& action = nullptr ) { - return syncLocalPutChannel(han, dest, uninitialized_destination, action); + return syncLocalPutChannel(han, dest, NodeT {}, action); } /** @@ -662,8 +662,8 @@ struct RDMAManager : runtime::component::Component { * \param[in] action action when sync completes */ void syncLocalPutChannel( - RDMA_HandleType const& han, NodeType const& dest, - NodeType const& in_target, ActionType const& action = nullptr + RDMA_HandleType const& han, NodeT const& dest, + NodeT const& in_target, ActionType const& action = nullptr ) { auto const& target = getTarget(han, in_target); bool const is_local = true; @@ -678,7 +678,7 @@ struct RDMAManager : runtime::component::Component { * \param[in] action action after completion */ void syncRemoteGetChannel( - RDMA_HandleType const& han, NodeType const& in_target = uninitialized_destination, + RDMA_HandleType const& han, NodeT const& in_target = {}, ActionType const& action = nullptr ) { auto const& this_node = theContext()->getNode(); @@ -699,7 +699,7 @@ struct RDMAManager : runtime::component::Component { void syncRemotePutChannel( RDMA_HandleType const& han, ActionType const& action ) { - return syncRemotePutChannel(han, uninitialized_destination, action); + return syncRemotePutChannel(han, NodeT {}, action); } /** @@ -710,7 +710,7 @@ struct RDMAManager : runtime::component::Component { * \param[in] action action after completion */ void syncRemotePutChannel( - RDMA_HandleType const& han, NodeType const& in_target, + RDMA_HandleType const& han, NodeT const& in_target, ActionType const& action = nullptr ) { auto const& this_node = theContext()->getNode(); @@ -730,54 +730,54 @@ struct RDMAManager : runtime::component::Component { * \param[in] action action after removal */ void removeDirectChannel( - RDMA_HandleType const& han, NodeType const& override_target = uninitialized_destination, + RDMA_HandleType const& han, NodeT const& override_target = NodeT{}, ActionType const& action = nullptr ); private: - static NodeType getTarget( - RDMA_HandleType const& han, NodeType const& in_tar = uninitialized_destination + static NodeT getTarget( + RDMA_HandleType const& han, NodeT const& in_tar = NodeT{} ) { - auto const target = in_tar == uninitialized_destination ? + auto const target = in_tar == NodeT{} ? RDMA_HandleManagerType::getRdmaNode(han) : in_tar; return target; } void syncChannel( bool const& is_local, RDMA_HandleType const& han, RDMA_TypeType const& type, - NodeType const& target, NodeType const& non_target, ActionType const& action + NodeT const& target, NodeT const& non_target, ActionType const& action ); void setupChannelWithRemote( - RDMA_TypeType const& type, RDMA_HandleType const& han, NodeType const& dest, + RDMA_TypeType const& type, RDMA_HandleType const& han, NodeT const& dest, ActionType const& action, - NodeType const& override_target = uninitialized_destination + NodeT const& override_target = {} ); void sendDataChannel( RDMA_TypeType const& type, RDMA_HandleType const& han, RDMA_PtrType const& ptr, - ByteType const& num_bytes, ByteType const& offset, NodeType const& target, - NodeType const& non_target, ActionType action_after_put + ByteType const& num_bytes, ByteType const& offset, NodeT const& target, + NodeT const& non_target, ActionType action_after_put ); void createDirectChannel( RDMA_TypeType const& type, RDMA_HandleType const& han, ActionType const& action = nullptr, - NodeType const& override_target = uninitialized_destination + NodeT const& override_target = NodeT{} ); void createDirectChannelInternal( - RDMA_TypeType const& type, RDMA_HandleType const& han, NodeType const& non_target, + RDMA_TypeType const& type, RDMA_HandleType const& han, NodeT const& non_target, ActionType const& action = nullptr, - NodeType const& override_target = uninitialized_destination, + NodeT const& override_target = NodeT{}, TagType const& channel_tag = no_tag, ByteType const& num_bytes = no_byte ); void createDirectChannelFinish( - RDMA_TypeType const& type, RDMA_HandleType const& han, NodeType const& non_target, + RDMA_TypeType const& type, RDMA_HandleType const& han, NodeT const& non_target, ActionType const& action, TagType const& channel_tag, bool const& is_target, ByteType const& num_bytes, - NodeType const& override_target = uninitialized_destination + NodeT const& override_target = NodeT{} ); template < @@ -849,7 +849,7 @@ struct RDMAManager : runtime::component::Component { RDMA_HandleType const& rdma_handle, TagType const& tag, ByteType const& num_bytes, ByteType const& offset, bool const& is_local, RDMA_PtrType const& ptr = nullptr, - NodeType const& from_node = uninitialized_destination, + NodeT const& from_node = NodeT{}, RDMA_ContinuationType cont = no_action, ActionType next_action = no_action ); @@ -861,7 +861,7 @@ struct RDMAManager : runtime::component::Component { void triggerPutRecvData( RDMA_HandleType const& han, TagType const& tag, RDMA_PtrType ptr, ByteType const& num_bytes, ByteType const& offset, ActionType const& action, - bool const& is_local, NodeType const& from_node + bool const& is_local, NodeT const& from_node ); RDMA_DirectType tryGetDataPtrDirect(RDMA_OpType const& op); @@ -872,12 +872,12 @@ struct RDMAManager : runtime::component::Component { RDMA_ChannelLookupType makeChannelLookup( RDMA_HandleType const& han, RDMA_TypeType const& rdma_op_type, - NodeType const& target, NodeType const& non_target + NodeT const& target, NodeT const& non_target ); RDMA_ChannelType* findChannel( RDMA_HandleType const& han, RDMA_TypeType const& rdma_op_type, - NodeType const& target, NodeType const& non_target, + NodeT const& target, NodeT const& non_target, bool const& should_insert = false, bool const& must_exist = false ); diff --git a/src/vt/rdma/rdma_common.h b/src/vt/rdma/rdma_common.h index e79685830b..7a497c91e4 100644 --- a/src/vt/rdma/rdma_common.h +++ b/src/vt/rdma/rdma_common.h @@ -108,7 +108,7 @@ using RDMA_RecvType = std::function; using RDMA_NumElemsType = int64_t; using RDMA_BlockElmRangeType = std::tuple; -using RDMA_BlockMapType = std::function; +using RDMA_BlockMapType = std::function; using RDMA_ElmMapType = std::function; static constexpr Type uninitialized_rdma_type = Type::Uninitialized; diff --git a/src/vt/rdma/rdma_handle.cc b/src/vt/rdma/rdma_handle.cc index 77d60748cb..6f31b5d5cd 100644 --- a/src/vt/rdma/rdma_handle.cc +++ b/src/vt/rdma/rdma_handle.cc @@ -73,7 +73,7 @@ namespace vt { namespace rdma { } /*static*/ void HandleManager::setRdmaNode( - RDMA_UniversalIdType& handle, NodeType const& node + RDMA_UniversalIdType& handle, NodeT const& node ) { BitPackerType::setField(handle, node); } @@ -86,10 +86,10 @@ namespace vt { namespace rdma { ); } -/*static*/ NodeType HandleManager::getRdmaNode( +/*static*/ NodeT HandleManager::getRdmaNode( RDMA_UniversalIdType const& handle ) { - return BitPackerType::getField(handle); + return BitPackerType::getField(handle); } /*static*/ RDMA_IdentifierType HandleManager::getRdmaIdentifier( diff --git a/src/vt/rdma/rdma_handle.h b/src/vt/rdma/rdma_handle.h index 0ee0c2ca71..46e4c16ecb 100644 --- a/src/vt/rdma/rdma_handle.h +++ b/src/vt/rdma/rdma_handle.h @@ -67,11 +67,11 @@ struct HandleManager { static void setOpType( RDMA_UniversalIdType& handle, RDMA_TypeType const& rdma_type ); - static void setRdmaNode(RDMA_UniversalIdType& handle, NodeType const& node); + static void setRdmaNode(RDMA_UniversalIdType& handle, NodeT const& node); static void setRdmaIdentifier( RDMA_UniversalIdType& handle, RDMA_IdentifierType const& ident ); - static NodeType getRdmaNode(RDMA_UniversalIdType const& handle); + static NodeT getRdmaNode(RDMA_UniversalIdType const& handle); static RDMA_IdentifierType getRdmaIdentifier(RDMA_UniversalIdType const& handle); static bool isSized(RDMA_UniversalIdType const& handle); static bool isCollective(RDMA_UniversalIdType const& handle); diff --git a/src/vt/rdma/rdma_msg.h b/src/vt/rdma/rdma_msg.h index 289cec6b8b..6109eb5e60 100644 --- a/src/vt/rdma/rdma_msg.h +++ b/src/vt/rdma/rdma_msg.h @@ -55,7 +55,7 @@ template struct RequestDataMessage : ActiveMessage { RequestDataMessage( - RDMA_OpType const& in_op, NodeType const in_node, + RDMA_OpType const& in_op, NodeT const in_node, RDMA_HandleType const& in_han, ByteType const& in_num_bytes = no_byte, ByteType const& in_offset = no_byte ) : ActiveMessage(), @@ -64,7 +64,7 @@ struct RequestDataMessage : ActiveMessage { { } RDMA_OpType op_id = no_rdma_op; - NodeType requesting = uninitialized_destination; + NodeT requesting = {}; RDMA_HandleType rdma_handle = no_rdma_handle; ByteType num_bytes = no_byte; ByteType offset = no_byte; @@ -78,8 +78,8 @@ struct SendDataMessage : ActiveMessage { RDMA_OpType const& in_op, ByteType const& in_num_bytes, ByteType const& in_offset, TagType const& in_mpi_tag, RDMA_HandleType const& in_han = no_rdma_handle, - NodeType const& back = uninitialized_destination, - NodeType const& in_recv_node = uninitialized_destination, + NodeT const& back = {}, + NodeT const& in_recv_node = {}, bool const in_packed_direct = false ) : rdma_handle(in_han), send_back(back), recv_node(in_recv_node), mpi_tag_to_recv(in_mpi_tag), op_id(in_op), @@ -89,8 +89,8 @@ struct SendDataMessage : ActiveMessage { int nchunks = 0; RDMA_HandleType rdma_handle = no_rdma_handle; - NodeType send_back = uninitialized_destination; - NodeType recv_node = uninitialized_destination; + NodeT send_back = {}; + NodeT recv_node = {}; TagType mpi_tag_to_recv = no_tag; RDMA_OpType op_id = no_rdma_op; ByteType num_bytes = no_byte; @@ -120,8 +120,8 @@ struct CreateChannel : vt::Message { CreateChannel( RDMA_TypeType const& in_type, RDMA_HandleType const& in_han, - TagType const& in_channel_tag, NodeType const& in_target, - NodeType const& in_non_target, Callback in_cb + TagType const& in_channel_tag, NodeT const& in_target, + NodeT const& in_non_target, Callback in_cb ) : channel_tag(in_channel_tag), rdma_handle(in_han), type(in_type), target(in_target), non_target(in_non_target), cb(in_cb) { } @@ -130,8 +130,8 @@ struct CreateChannel : vt::Message { TagType channel_tag = no_tag; RDMA_HandleType rdma_handle = no_rdma_handle; RDMA_TypeType type = uninitialized_rdma_type; - NodeType target = uninitialized_destination; - NodeType non_target = uninitialized_destination; + NodeT target = {}; + NodeT non_target = {}; Callback cb; }; @@ -142,8 +142,8 @@ struct ChannelMessage : vt::Message { RDMA_TypeType const& in_type, RDMA_HandleType const& in_han, ByteType const& in_num_bytes, TagType const& in_channel_tag, Callback<> in_cb, - NodeType const& in_non_target = uninitialized_destination, - NodeType const& in_override_target = uninitialized_destination + NodeT const& in_non_target = {}, + NodeT const& in_override_target = {} ) : channel_tag(in_channel_tag), type(in_type), han(in_han), num_bytes(in_num_bytes), non_target(in_non_target), override_target(in_override_target), cb(in_cb) @@ -153,8 +153,8 @@ struct ChannelMessage : vt::Message { RDMA_TypeType type = uninitialized_rdma_type; RDMA_HandleType han = no_rdma_handle; ByteType num_bytes = no_byte; - NodeType non_target = uninitialized_destination; - NodeType override_target = uninitialized_destination; + NodeT non_target = {}; + NodeT override_target = {}; Callback<> cb; }; diff --git a/src/vt/rdma/rdma_types.h b/src/vt/rdma/rdma_types.h index 204ffccf17..bdb1dd5fcc 100644 --- a/src/vt/rdma/rdma_types.h +++ b/src/vt/rdma/rdma_types.h @@ -48,7 +48,7 @@ namespace vt { namespace rdma { -using UnderlyingNodeType = NodeType; +using UnderlyingNodeType = NodeT ; struct Endpoint { Endpoint( @@ -64,7 +64,7 @@ struct Endpoint { private: bool is_target = false; - UnderlyingNodeType value = uninitialized_destination; + UnderlyingNodeType value = {}; }; struct Target : Endpoint { diff --git a/src/vt/rdma/state/rdma_state.cc b/src/vt/rdma/state/rdma_state.cc index bd8190d48b..4d9948bab0 100644 --- a/src/vt/rdma/state/rdma_state.cc +++ b/src/vt/rdma/state/rdma_state.cc @@ -221,7 +221,7 @@ bool State::testReadyPutData(TagType const& tag) { void State::getData( GetMessage* msg, bool const& is_user_msg, RDMA_InfoType const& info, - NodeType const& from_node + NodeT const& from_node ) { auto const& tag = info.tag; @@ -289,7 +289,7 @@ void State::getData( void State::putData( PutMessage* msg, bool const& is_user_msg, RDMA_InfoType const& info, - NodeType const& from_node + NodeT const& from_node ) { auto const& tag = info.tag; @@ -387,7 +387,7 @@ void State::processPendingGet(TagType const& tag) { // } -// NodeType +// NodeT // State::getNode(RDMA_ElmType const& elm) { // vtAssert( // collective_map != vtAullptr, RDMA_HandleManagerType::is_collective(handle) diff --git a/src/vt/rdma/state/rdma_state.h b/src/vt/rdma/state/rdma_state.h index 1d6530dd14..6cce532291 100644 --- a/src/vt/rdma/state/rdma_state.h +++ b/src/vt/rdma/state/rdma_state.h @@ -122,12 +122,12 @@ struct State { void getData( GetMessage* msg, bool const& is_user_msg, RDMA_InfoType const& info, - NodeType const& from_node + NodeT const& from_node ); void putData( PutMessage* msg, bool const& is_user_msg, RDMA_InfoType const& info, - NodeType const& from_node + NodeT const& from_node ); void processPendingGet(TagType const& tag = no_tag); diff --git a/src/vt/rdmahandle/handle.fwd.h b/src/vt/rdmahandle/handle.fwd.h index a3749776c6..f74fe44e90 100644 --- a/src/vt/rdmahandle/handle.fwd.h +++ b/src/vt/rdmahandle/handle.fwd.h @@ -52,7 +52,7 @@ namespace vt { namespace rdma { template < typename T, HandleEnum E = rdma::HandleEnum::StaticSize, - typename IndexT = vt::NodeType, + typename IndexT = vt::NodeT , typename = void > struct Handle; diff --git a/src/vt/rdmahandle/handle.h b/src/vt/rdmahandle/handle.h index f955d849c7..8e1ede0ffd 100644 --- a/src/vt/rdmahandle/handle.h +++ b/src/vt/rdmahandle/handle.h @@ -50,7 +50,7 @@ namespace vt { -template +template using HandleRDMA = rdma::Handle; } /* end namespace vt */ diff --git a/src/vt/rdmahandle/handle.index.h b/src/vt/rdmahandle/handle.index.h index 861da4f588..e854321a3b 100644 --- a/src/vt/rdmahandle/handle.index.h +++ b/src/vt/rdmahandle/handle.index.h @@ -68,7 +68,7 @@ template struct Handle< T, E, IndexT, typename std::enable_if_t< - not std::is_same::value + not std::is_same::value > > : BaseTypedHandle { diff --git a/src/vt/rdmahandle/handle.index.impl.h b/src/vt/rdmahandle/handle.index.impl.h index 1fbf6072c7..59f440f3f1 100644 --- a/src/vt/rdmahandle/handle.index.impl.h +++ b/src/vt/rdmahandle/handle.index.impl.h @@ -50,7 +50,7 @@ namespace vt { namespace rdma { template bool Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::ready() const { if (proxy_ != no_obj_group) { auto proxy = vt::objgroup::proxy::Proxy>(proxy_); @@ -62,7 +62,7 @@ bool Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::readExclusive( std::function fn ) { @@ -72,7 +72,7 @@ void Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::readShared( std::function fn ) { @@ -82,7 +82,7 @@ void Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::modifyExclusive( std::function fn ) { @@ -92,7 +92,7 @@ void Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::modifyShared( std::function fn ) { @@ -102,21 +102,21 @@ void Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::lock(Lock l, I const& index) { //@todo: implement this } template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::unlock() { this->lock_ = nullptr; } template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::get( I const& index, T* ptr, std::size_t len, int offset, Lock l ) { @@ -126,10 +126,10 @@ void Handle< template typename Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::RequestType Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::rget( I const& index, T* ptr, std::size_t len, int offset, Lock l ) { @@ -139,7 +139,7 @@ Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::get( I const& index, std::size_t len, int offset, Lock l ) { @@ -149,10 +149,10 @@ void Handle< template typename Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::RequestType Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::rget( I const& index, std::size_t len, int offset, Lock l ) { @@ -183,7 +183,7 @@ Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::put( I const& index, T* ptr, std::size_t len, int offset, Lock l ) { @@ -193,10 +193,10 @@ void Handle< template typename Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::RequestType Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::rput( I const& index, T* ptr, std::size_t len, int offset, Lock l ) { @@ -206,7 +206,7 @@ Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::accum( I const& index, T* ptr, std::size_t len, int offset, MPI_Op op, Lock l ) { @@ -216,10 +216,10 @@ void Handle< template typename Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::RequestType Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::raccum( I const& index, T* ptr, std::size_t len, int offset, MPI_Op op, Lock l ) { @@ -229,7 +229,7 @@ Handle< template T Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::fetchOp( I const& index, T ptr, int offset, MPI_Op op, Lock l ) { @@ -239,7 +239,7 @@ T Handle< template std::size_t Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::getCount(I const& index) { auto proxy = vt::objgroup::proxy::Proxy>(proxy_); if (proxy.get()->isUniform()) { diff --git a/src/vt/rdmahandle/handle.node.h b/src/vt/rdmahandle/handle.node.h index fdcc6aac6e..446064a90d 100644 --- a/src/vt/rdmahandle/handle.node.h +++ b/src/vt/rdmahandle/handle.node.h @@ -69,11 +69,11 @@ template struct Handle< T, E, IndexT, typename std::enable_if_t< - std::is_same::value + std::is_same::value > -> : BaseTypedHandle +> : BaseTypedHandle { - using RequestType = typename BaseTypedHandle::RequestType; + using RequestType = typename BaseTypedHandle::RequestType; friend struct Manager; friend struct SubHandle; @@ -100,7 +100,7 @@ struct Handle< NodeTagType, HandleKey in_key, std::size_t in_count, std::size_t in_hoff = 0, std::shared_ptr in_lock = nullptr - ) : BaseTypedHandle( + ) : BaseTypedHandle( in_count, in_hoff, in_lock @@ -121,7 +121,7 @@ struct Handle< * * \return the node */ - vt::NodeType getNode() const { return vt::theContext()->getNode(); } + vt::NodeT getNode() const { return vt::theContext()->getNode(); } /** * \brief Check if the handle is ready to be used; implies that all MPI @@ -176,7 +176,7 @@ struct Handle< * \param[in] l lock to apply * \param[in] node which node to lock */ - void lock(Lock l, vt::NodeType node); + void lock(Lock l, vt::NodeT node); /** * \brief Unlock the handle @@ -217,13 +217,13 @@ struct Handle< * \brief Perform a window flush on the data window \c MPI_Win_flush for a * certain node */ - void flush(vt::NodeType node); + void flush(vt::NodeT node); /** * \brief Perform a local window flush on the data window \c * MPI_Win_flush_local for a certain node */ - void flushLocal(vt::NodeType node); + void flushLocal(vt::NodeT node); /** * \brief Perform a window flush on the data window \c MPI_Win_flush_all for @@ -245,7 +245,7 @@ struct Handle< * \param[in] l the lock to apply for the get */ void get( - vt::NodeType node, std::size_t len, int offset, Lock l = Lock::None + vt::NodeT node, std::size_t len, int offset, Lock l = Lock::None ); /** @@ -259,7 +259,7 @@ struct Handle< * \param[in] l the lock to apply for the get */ void get( - vt::NodeType node, T* ptr, std::size_t len, int offset, Lock l = Lock::None + vt::NodeT node, T* ptr, std::size_t len, int offset, Lock l = Lock::None ); /** @@ -273,7 +273,7 @@ struct Handle< * \param[in] l the lock to apply for the put */ void put( - vt::NodeType node, T* ptr, std::size_t len, int offset, Lock l = Lock::None + vt::NodeT node, T* ptr, std::size_t len, int offset, Lock l = Lock::None ); /** @@ -288,7 +288,7 @@ struct Handle< * \param[in] l the lock to apply for the accumulate */ void accum( - vt::NodeType node, T* ptr, std::size_t len, int offset, MPI_Op op, Lock l = Lock::None + vt::NodeT node, T* ptr, std::size_t len, int offset, MPI_Op op, Lock l = Lock::None ); /** @@ -308,7 +308,7 @@ struct Handle< * \return the request holder to wait on */ RequestType rget( - vt::NodeType no, std::size_t len, int offset, Lock l = Lock::None + vt::NodeT no, std::size_t len, int offset, Lock l = Lock::None ); /** @@ -327,7 +327,7 @@ struct Handle< * \return the request holder to wait on */ RequestType rget( - vt::NodeType node, T* ptr, std::size_t len, int offset, Lock l = Lock::None + vt::NodeT node, T* ptr, std::size_t len, int offset, Lock l = Lock::None ); /** @@ -344,7 +344,7 @@ struct Handle< * \param[in] l the lock to apply for the put */ RequestType rput( - vt::NodeType node, T* ptr, std::size_t len, int offset, Lock l = Lock::None + vt::NodeT node, T* ptr, std::size_t len, int offset, Lock l = Lock::None ); /** @@ -362,7 +362,7 @@ struct Handle< * \param[in] l the lock to apply for the accumulate */ RequestType raccum( - vt::NodeType node, T* ptr, std::size_t len, int offset, MPI_Op op, + vt::NodeT node, T* ptr, std::size_t len, int offset, MPI_Op op, Lock l = Lock::None ); @@ -379,7 +379,7 @@ struct Handle< * \return the value fetched */ T fetchOp( - vt::NodeType node, T val, int offset, MPI_Op op, Lock l = Lock::None + vt::NodeT node, T val, int offset, MPI_Op op, Lock l = Lock::None ); /** @@ -390,7 +390,7 @@ struct Handle< * * \return the length of the handle's data */ - std::size_t getCount(vt::NodeType node); + std::size_t getCount(vt::NodeT node); /** * \brief Serializer for the handle @@ -400,7 +400,7 @@ struct Handle< template void serialize(SerializerT& s) { s | key_; - BaseTypedHandle::serialize(s); + BaseTypedHandle::serialize(s); } protected: diff --git a/src/vt/rdmahandle/handle.node.impl.h b/src/vt/rdmahandle/handle.node.impl.h index 702552a755..3872ee403f 100644 --- a/src/vt/rdmahandle/handle.node.impl.h +++ b/src/vt/rdmahandle/handle.node.impl.h @@ -50,48 +50,48 @@ namespace vt { namespace rdma { template bool Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::ready() const { return vt::theHandleRDMA()->getEntry(key_).ready(); } template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::get( - vt::NodeType node, T* ptr, std::size_t len, int offset, Lock l + vt::NodeT node, T* ptr, std::size_t len, int offset, Lock l ) { return vt::theHandleRDMA()->getEntry(key_).get(node, l, ptr, len, offset + this->hoff()); } template typename Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::RequestType Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::rget( - vt::NodeType node, T* ptr, std::size_t len, int offset, Lock l + vt::NodeT node, T* ptr, std::size_t len, int offset, Lock l ) { return vt::theHandleRDMA()->getEntry(key_).rget(node, l, ptr, len, offset + this->hoff()); } template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::get( - vt::NodeType node, std::size_t len, int offset, Lock l + vt::NodeT node, std::size_t len, int offset, Lock l ) { rget(node, len, offset); } template typename Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::RequestType Handle< - T,E,I,typename std::enable_if_t::value> ->::rget(vt::NodeType node, std::size_t len, int offset, Lock l) { + T,E,I,typename std::enable_if_t::value> +>::rget(vt::NodeT node, std::size_t len, int offset, Lock l) { if (this->getBuffer() == nullptr) { auto ptr = std::make_unique(len); auto r = vt::theHandleRDMA()->getEntry(key_).rget( @@ -118,57 +118,57 @@ Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::put( - vt::NodeType node, T* ptr, std::size_t len, int offset, Lock l + vt::NodeT node, T* ptr, std::size_t len, int offset, Lock l ) { return vt::theHandleRDMA()->getEntry(key_).put(node, l, ptr, len, offset + this->hoff()); } template typename Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::RequestType -Handle::value>>::rput( - vt::NodeType node, T* ptr, std::size_t len, int offset, Lock l +Handle::value>>::rput( + vt::NodeT node, T* ptr, std::size_t len, int offset, Lock l ) { return vt::theHandleRDMA()->getEntry(key_).rput(node, l, ptr, len, offset + this->hoff()); } template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::accum( - vt::NodeType node, T* ptr, std::size_t len, int offset, MPI_Op op, Lock l + vt::NodeT node, T* ptr, std::size_t len, int offset, MPI_Op op, Lock l ) { return vt::theHandleRDMA()->getEntry(key_).accum(node, l, ptr, len, offset + this->hoff(), op); } template typename Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::RequestType Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::raccum( - vt::NodeType node, T* ptr, std::size_t len, int offset, MPI_Op op, Lock l + vt::NodeT node, T* ptr, std::size_t len, int offset, MPI_Op op, Lock l ) { return vt::theHandleRDMA()->getEntry(key_).raccum(node, l, ptr, len, offset + this->hoff(), op); } template T Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::fetchOp( - vt::NodeType node, T ptr, int offset, MPI_Op op, Lock l + vt::NodeT node, T ptr, int offset, MPI_Op op, Lock l ) { return vt::theHandleRDMA()->getEntry(key_).fetchOp(node, l, ptr, offset, op); } template std::size_t Handle< - T,E,I,typename std::enable_if_t::value> ->::getCount(vt::NodeType node) { + T,E,I,typename std::enable_if_t::value> +>::getCount(vt::NodeT node) { if (vt::theHandleRDMA()->getEntry(key_).isUniform()) { return this->count(); } else { @@ -178,7 +178,7 @@ std::size_t Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::readExclusive( std::function fn ) { @@ -187,7 +187,7 @@ void Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::readShared( std::function fn ) { @@ -196,7 +196,7 @@ void Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::modifyExclusive( std::function fn ) { @@ -205,7 +205,7 @@ void Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::modifyShared( std::function fn ) { @@ -214,7 +214,7 @@ void Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::access( Lock l, std::function fn, std::size_t offset ) { @@ -223,49 +223,49 @@ void Handle< template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::fence(int assert) { vt::theHandleRDMA()->getEntry(key_).fence(assert); } template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::sync() { vt::theHandleRDMA()->getEntry(key_).sync(); } template void Handle< - T,E,I,typename std::enable_if_t::value> ->::flush(vt::NodeType node) { + T,E,I,typename std::enable_if_t::value> +>::flush(vt::NodeT node) { vt::theHandleRDMA()->getEntry(key_).flush(node); } template void Handle< - T,E,I,typename std::enable_if_t::value> ->::flushLocal(vt::NodeType node) { + T,E,I,typename std::enable_if_t::value> +>::flushLocal(vt::NodeT node) { vt::theHandleRDMA()->getEntry(key_).flushLocal(node); } template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::flushAll() { vt::theHandleRDMA()->getEntry(key_).flushAll(); } template void Handle< - T,E,I,typename std::enable_if_t::value> ->::lock(Lock l, vt::NodeType node) { + T,E,I,typename std::enable_if_t::value> +>::lock(Lock l, vt::NodeT node) { this->lock_ = vt::theHandleRDMA()->getEntry(key_).lock(l, node); } template void Handle< - T,E,I,typename std::enable_if_t::value> + T,E,I,typename std::enable_if_t::value> >::unlock() { this->lock_ = nullptr; } diff --git a/src/vt/rdmahandle/holder.h b/src/vt/rdmahandle/holder.h index 98defa0620..ceb5366415 100644 --- a/src/vt/rdmahandle/holder.h +++ b/src/vt/rdmahandle/holder.h @@ -74,7 +74,7 @@ struct Holder { void allocateDataWindow(std::size_t const in_len = 0); public: - std::shared_ptr lock(Lock l, vt::NodeType node); + std::shared_ptr lock(Lock l, vt::NodeT node); public: void deallocate(); @@ -82,33 +82,33 @@ struct Holder { template void access(Lock l, Callable fn, std::size_t offset); - std::size_t getCount(vt::NodeType node, Lock l = Lock::Shared); + std::size_t getCount(vt::NodeT node, Lock l = Lock::Shared); RequestHolder rget( - vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset + vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset ); - void get(vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset); + void get(vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset); RequestHolder rput( - vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset + vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset ); - void put(vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset); + void put(vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset); RequestHolder raccum( - vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset, + vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset, MPI_Op op ); void accum( - vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset, + vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset, MPI_Op op ); - T fetchOp(vt::NodeType node, Lock l, T ptr, int offset, MPI_Op op); + T fetchOp(vt::NodeT node, Lock l, T ptr, int offset, MPI_Op op); void fence(int assert = 0); void sync(); - void flush(vt::NodeType node); - void flushLocal(vt::NodeType node); + void flush(vt::NodeT node); + void flushLocal(vt::NodeT node); void flushAll(); bool isUniform() const { return uniform_size_; } diff --git a/src/vt/rdmahandle/holder.impl.h b/src/vt/rdmahandle/holder.impl.h index 9cf8057d8b..756822b4d2 100644 --- a/src/vt/rdmahandle/holder.impl.h +++ b/src/vt/rdmahandle/holder.impl.h @@ -99,7 +99,7 @@ void Holder::allocateDataWindow(std::size_t const in_len) { } template -std::size_t Holder::getCount(vt::NodeType node, Lock l) { +std::size_t Holder::getCount(vt::NodeT node, Lock l) { uint64_t result = 0; auto mpi_type = TypeMPI::getType(); { @@ -129,7 +129,7 @@ void Holder::deallocate() { } template -std::shared_ptr Holder::lock(Lock l, vt::NodeType node) { +std::shared_ptr Holder::lock(Lock l, vt::NodeT node) { return std::make_shared(l, node, data_window_); } @@ -144,7 +144,7 @@ void Holder::access(Lock l, Callable fn, std::size_t offset) { template RequestHolder Holder::rget( - vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset + vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset ) { auto mpi_type = TypeMPI::getType(); auto mpi_type_str = TypeMPI::getTypeStr(); @@ -175,14 +175,14 @@ RequestHolder Holder::rget( template void Holder::get( - vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset + vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset ) { rget(node, l, ptr, len, offset); } template RequestHolder Holder::rput( - vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset + vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset ) { auto mpi_type = TypeMPI::getType(); auto mpi_type_str = TypeMPI::getTypeStr(); @@ -213,13 +213,13 @@ RequestHolder Holder::rput( template void Holder::put( - vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset + vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset ) { rput(node, l, ptr, len, offset); } template -T Holder::fetchOp(vt::NodeType node, Lock l, T in, int offset, MPI_Op op) { +T Holder::fetchOp(vt::NodeT node, Lock l, T in, int offset, MPI_Op op) { auto mpi_type = TypeMPI::getType(); auto mpi_type_str = TypeMPI::getTypeStr(); T out; @@ -238,7 +238,7 @@ T Holder::fetchOp(vt::NodeType node, Lock l, T in, int offset, MPI_Op op) { template RequestHolder Holder::raccum( - vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset, + vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset, MPI_Op op ) { auto mpi_type = TypeMPI::getType(); @@ -274,7 +274,7 @@ RequestHolder Holder::raccum( template void Holder::accum( - vt::NodeType node, Lock l, T* ptr, std::size_t len, int offset, + vt::NodeT node, Lock l, T* ptr, std::size_t len, int offset, MPI_Op op ) { raccum(node, l, ptr, len, offset, op); @@ -293,13 +293,13 @@ void Holder::sync() { } template -void Holder::flush(vt::NodeType node) { +void Holder::flush(vt::NodeT node) { VT_ALLOW_MPI_CALLS; MPI_Win_flush(node, data_window_); } template -void Holder::flushLocal(vt::NodeType node) { +void Holder::flushLocal(vt::NodeT node) { VT_ALLOW_MPI_CALLS; MPI_Win_flush_local(node, data_window_); } diff --git a/src/vt/rdmahandle/index_info.h b/src/vt/rdmahandle/index_info.h index a12091b3ce..d069eb36ef 100644 --- a/src/vt/rdmahandle/index_info.h +++ b/src/vt/rdmahandle/index_info.h @@ -50,23 +50,23 @@ namespace vt { namespace rdma { struct IndexInfo { IndexInfo() = default; - IndexInfo(vt::NodeType in_node, uint64_t in_offset, uint64_t in_count) + IndexInfo(vt::NodeT in_node, uint64_t in_offset, uint64_t in_count) : node_(in_node), offset_(in_offset), count_(in_count) { } IndexInfo(uint64_t in_node, uint64_t in_offset, uint64_t in_count) - : node_(static_cast(in_node)), + : node_(static_cast(in_node)), offset_(in_offset), count_(in_count) { } - vt::NodeType getNode() const { return node_; } + vt::NodeT getNode() const { return node_; } uint64_t getOffset() const { return offset_; } uint64_t getCount() const { return count_; } private: - vt::NodeType node_ = vt::uninitialized_destination; + vt::NodeT node_ = vt::NodeT {}; uint64_t offset_ = 0; uint64_t count_ = 0; }; diff --git a/src/vt/rdmahandle/lock_mpi.h b/src/vt/rdmahandle/lock_mpi.h index d563cc7b71..95e1c2e161 100644 --- a/src/vt/rdmahandle/lock_mpi.h +++ b/src/vt/rdmahandle/lock_mpi.h @@ -57,7 +57,7 @@ enum struct Lock : int8_t { struct LockMPI { LockMPI( - Lock in_l, vt::NodeType in_rank, MPI_Win in_window, + Lock in_l, vt::NodeT in_rank, MPI_Win in_window, bool get_mpi_access = true ) : l_(in_l), rank_(in_rank), @@ -90,7 +90,7 @@ struct LockMPI { private: Lock l_ = Lock::None; - vt::NodeType rank_ = vt::uninitialized_destination; + vt::NodeT rank_ = vt::NodeT {}; MPI_Win window_; bool get_mpi_access_ = true; }; diff --git a/src/vt/rdmahandle/manager.collection.impl.h b/src/vt/rdmahandle/manager.collection.impl.h index fb4b2e8fd1..0b795bc456 100644 --- a/src/vt/rdmahandle/manager.collection.impl.h +++ b/src/vt/rdmahandle/manager.collection.impl.h @@ -106,7 +106,7 @@ Handle Manager::makeCollectionHandles( } sub_proxy = SubType::construct(true, range, true, map_han); // Register the migration listener - ListenerType fn = [=](ElementListener event, IndexT lidx, NodeType) { + ListenerType fn = [=](ElementListener event, IndexT lidx, NodeT ) { if (event == ElementListener::ElementMigratedOut) { sub_proxy.get()->migratedOutIndex(lidx); } else if (event == ElementListener::ElementMigratedIn) { diff --git a/src/vt/rdmahandle/manager.h b/src/vt/rdmahandle/manager.h index e1f648dad0..5a04b514fa 100644 --- a/src/vt/rdmahandle/manager.h +++ b/src/vt/rdmahandle/manager.h @@ -217,10 +217,10 @@ struct Manager : runtime::component::Component { Holder& getEntry(HandleKey const& key); private: - static vt::NodeType staticHandleMap( - vt::Index2D* idx, vt::Index2D*, vt::NodeType + static vt::NodeT staticHandleMap( + vt::Index2D* idx, vt::Index2D*, vt::NodeT ) { - return static_cast(idx->x()); + return static_cast(idx->x()); } std::size_t getHolderFootprint() const; diff --git a/src/vt/rdmahandle/sub_handle.h b/src/vt/rdmahandle/sub_handle.h index 6872599701..6b3bd91469 100644 --- a/src/vt/rdmahandle/sub_handle.h +++ b/src/vt/rdmahandle/sub_handle.h @@ -89,11 +89,11 @@ struct SubHandle { typename IndexT::DenseIndexType linearize(IndexT idx); - NodeType getHomeNode(IndexT const& idx); + NodeT getHomeNode(IndexT const& idx); IndexInfo fetchInfo(IndexT const& idx); - void updateInfo(IndexT const& idx, IndexInfo info, NodeType home); + void updateInfo(IndexT const& idx, IndexInfo info, NodeT home); IndexInfo resolveLocation(IndexT const& idx); @@ -130,7 +130,7 @@ struct SubHandle { Handle addLocalIndex(IndexT index, uint64_t count); - int getOrderedOffset(IndexT idx, NodeType home_node); + int getOrderedOffset(IndexT idx, NodeT home_node); void stageLocalIndex(IndexT index, uint64_t count); diff --git a/src/vt/rdmahandle/sub_handle.impl.h b/src/vt/rdmahandle/sub_handle.impl.h index db18fdad96..4868840d23 100644 --- a/src/vt/rdmahandle/sub_handle.impl.h +++ b/src/vt/rdmahandle/sub_handle.impl.h @@ -152,7 +152,7 @@ SubHandle::linearize(IndexT idx) { } template -NodeType SubHandle::getHomeNode(IndexT const& idx) { +NodeT SubHandle::getHomeNode(IndexT const& idx) { auto const& fn = auto_registry::getHandlerMap(map_han_); auto const num_nodes = theContext()->getNumNodes(); auto idx_p = idx; @@ -160,7 +160,7 @@ NodeType SubHandle::getHomeNode(IndexT const& idx) { } template -int SubHandle::getOrderedOffset(IndexT idx, NodeType home_node) { +int SubHandle::getOrderedOffset(IndexT idx, NodeT home_node) { auto iter = ordered_local_offset_.find(idx); int found_offset = 0; if (iter == ordered_local_offset_.end()) { @@ -185,7 +185,7 @@ int SubHandle::getOrderedOffset(IndexT idx, NodeType home_node) { template void SubHandle::updateInfo( - IndexT const& idx, IndexInfo info, NodeType home + IndexT const& idx, IndexInfo info, NodeT home ) { vtAssertExpr(not ordered_opt_); vtAssertExpr(is_migratable_); diff --git a/src/vt/registry/auto/auto_registry_common.h b/src/vt/registry/auto/auto_registry_common.h index a428bbc7a0..6fa572df71 100644 --- a/src/vt/registry/auto/auto_registry_common.h +++ b/src/vt/registry/auto/auto_registry_common.h @@ -135,10 +135,10 @@ struct HandlersDispatcher final : BaseHandlersDispatcher { struct BaseMapsDispatcher { virtual ~BaseMapsDispatcher() = default; - virtual NodeType dispatch( + virtual NodeT dispatch( index::BaseIndex* cur_idx_ptr, index::BaseIndex* range_ptr, - NodeType num_nodes + NodeT num_nodes ) const = 0; }; @@ -147,10 +147,10 @@ struct MapsDispatcher final : BaseMapsDispatcher { explicit MapsDispatcher(HandlerT in_fn_ptr) : fp(in_fn_ptr) { } public: - NodeType dispatch( + NodeT dispatch( index::BaseIndex* cur_idx_ptr, index::BaseIndex* range_ptr, - NodeType num_nodes + NodeT num_nodes ) const override { using T = HandlerT; @@ -162,7 +162,7 @@ struct MapsDispatcher final : BaseMapsDispatcher { ); } else { vtAbort("Invalid function type for map handler"); - return uninitialized_destination; + return NodeT{}; } } diff --git a/src/vt/runnable/make_runnable.h b/src/vt/runnable/make_runnable.h index e3b713b83e..aa783a7b23 100644 --- a/src/vt/runnable/make_runnable.h +++ b/src/vt/runnable/make_runnable.h @@ -74,7 +74,7 @@ struct RunnableMaker { */ RunnableMaker( RunnableNew* in_impl, MsgSharedPtr const& in_msg, - HandlerType in_handler, NodeType in_from_node + HandlerType in_handler, NodeT in_from_node ) : impl_(in_impl), msg_(in_msg), handler_(in_handler), @@ -312,7 +312,7 @@ struct RunnableMaker { MsgSharedPtr const& msg_; HandlerType handler_ = uninitialized_handler; bool set_handler_ = false; - NodeType from_node_ = uninitialized_destination; + NodeT from_node_ = {}; bool is_done_ = false; bool is_term_ = false; bool has_msg_ = true; @@ -331,7 +331,7 @@ struct RunnableMaker { */ template RunnableMaker makeRunnable( - MsgSharedPtr const& msg, bool is_threaded, HandlerType handler, NodeType from + MsgSharedPtr const& msg, bool is_threaded, HandlerType handler, NodeT from ) { auto r = new RunnableNew(msg, is_threaded); #if vt_check_enabled(trace_enabled) @@ -356,7 +356,7 @@ RunnableMaker makeRunnable( * \return the maker for further customization */ inline RunnableMaker makeRunnableVoid( - bool is_threaded, HandlerType handler, NodeType from + bool is_threaded, HandlerType handler, NodeT from ) { // These are currently only types of registry entries that can be void auto r = new RunnableNew(is_threaded); diff --git a/src/vt/runtime/component/diagnostic_value.cc b/src/vt/runtime/component/diagnostic_value.cc index 5347770e74..8c7562b91b 100644 --- a/src/vt/runtime/component/diagnostic_value.cc +++ b/src/vt/runtime/component/diagnostic_value.cc @@ -84,7 +84,7 @@ void reduceHelper( } } ); - r->reduce>(0, msg.get(), cb); + r->reduce>(NodeT{0}, msg.get(), cb); } } /* end anon namespace */ diff --git a/src/vt/runtime/runtime.cc b/src/vt/runtime/runtime.cc index 3958fed6b5..fde0fdbaca 100644 --- a/src/vt/runtime/runtime.cc +++ b/src/vt/runtime/runtime.cc @@ -250,8 +250,8 @@ bool Runtime::hasSchedRun() const { void Runtime::pauseForDebugger() { if (theConfig()->vt_pause) { char node_str[256]; - auto node = vt::theContext() ? vt::theContext()->getNode() : -1; - sprintf(node_str, "prog-%d.pid", node); + auto node = vt::theContext() ? vt::theContext()->getNode() : NodeT{-1}; + sprintf(node_str, "prog-%d.pid", node.get()); auto const pid = getpid(); FILE* f = fopen(node_str, "w+"); fprintf(f, "%d", pid); @@ -261,7 +261,7 @@ void Runtime::pauseForDebugger() { } /*static*/ void Runtime::sigHandlerINT(int sig) { - auto node = vt::theContext() ? vt::theContext()->getNode() : -1; + auto node = vt::theContext() ? vt::theContext()->getNode() : NodeT{-1}; auto vt_pre = debug::vtPre(); auto node_str = ::vt::debug::proc(node); auto prefix = vt_pre + node_str + " "; @@ -324,7 +324,7 @@ void Runtime::pauseForDebugger() { /*static*/ bool Runtime::nodeStackWrite() { auto const& node = debug::preNode(); - if (node == uninitialized_destination) { + if (node == NodeT{}) { return true; } else if (vt::theConfig()->vt_stack_mod == 0) { return true; @@ -585,7 +585,7 @@ void Runtime::output( std::string const abort_str, ErrorCodeType const code, bool error, bool decorate, bool formatted ) { - auto node = theContext ? theContext->getNode() : -1; + auto node = theContext ? theContext->getNode() : NodeT{-1}; auto green = debug::green(); auto byellow = debug::byellow(); auto red = debug::red(); @@ -601,7 +601,7 @@ void Runtime::output( if (decorate) { if (error) { auto f1 = fmt::format(" Runtime Error: System Aborting! "); - auto const info = ::fmt::format(" Fatal Error on Node {} ", node); + auto const info = ::fmt::format(" Fatal Error on NodeT {} ", node); // fmt::print(stderr, "{}", space); fmt::print(stderr, "{}", seperator); fmt::print(stderr, "{}{}{:-^120}{}\n", prefix, bred, f1, reset); @@ -609,7 +609,7 @@ void Runtime::output( fmt::print(stderr, "{}", seperator); } else { auto f1 = fmt::format(" Runtime Warning "); - auto const info = ::fmt::format(" Warning on Node {} ", node); + auto const info = ::fmt::format(" Warning on NodeT {} ", node); // fmt::print(stderr, "{}", space); fmt::print(stderr, "{}", warn_sep); fmt::print(stderr, "{}{}{:-^120}{}\n", prefix, byellow, f1, reset); diff --git a/src/vt/runtime/runtime_banner.cc b/src/vt/runtime/runtime_banner.cc index ee02c32387..124a5249be 100644 --- a/src/vt/runtime/runtime_banner.cc +++ b/src/vt/runtime/runtime_banner.cc @@ -71,7 +71,7 @@ void Runtime::printStartupBanner() { return; } - NodeType const nodes = theContext->getNumNodes(); + NodeT const nodes = theContext->getNumNodes(); std::string is_interop_str = is_interop_ ? diff --git a/src/vt/scheduler/scheduler.cc b/src/vt/scheduler/scheduler.cc index d67a23da11..c68166546a 100644 --- a/src/vt/scheduler/scheduler.cc +++ b/src/vt/scheduler/scheduler.cc @@ -58,7 +58,7 @@ namespace vt { namespace sched { /*static*/ void Scheduler::checkTermSingleNode() { auto const& num_nodes = theContext()->getNumNodes(); - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { theTerm()->maybePropagate(); } } diff --git a/src/vt/serialization/messaging/serialized_data_msg.h b/src/vt/serialization/messaging/serialized_data_msg.h index 64de26b34e..641411c1c1 100644 --- a/src/vt/serialization/messaging/serialized_data_msg.h +++ b/src/vt/serialization/messaging/serialized_data_msg.h @@ -62,7 +62,7 @@ struct SerializedDataMsgAny : MessageT { ByteType ptr_size = 0; HandlerType handler = uninitialized_handler; TagType data_recv_tag = no_tag; - NodeType from_node = uninitialized_destination; + NodeT from_node = {}; int nchunks = 0; }; diff --git a/src/vt/serialization/messaging/serialized_messenger.h b/src/vt/serialization/messaging/serialized_messenger.h index 68be3352bd..ac00f9a9c4 100644 --- a/src/vt/serialization/messaging/serialized_messenger.h +++ b/src/vt/serialization/messaging/serialized_messenger.h @@ -63,7 +63,7 @@ template using ActionEagerSend = std::function> msg )>; -using ActionNodeSendType = std::function; +using ActionNodeSendType = std::function; using ActionDataSend = std::function; struct SerializedMessenger { @@ -87,7 +87,7 @@ struct SerializedMessenger { template static messaging::PendingSend sendSerialMsg( - NodeType dest, MsgT* msg, HandlerType han, + NodeT dest, MsgT* msg, HandlerType han, ActionEagerSend eager = nullptr ); diff --git a/src/vt/serialization/messaging/serialized_messenger.impl.h b/src/vt/serialization/messaging/serialized_messenger.impl.h index 5b9c296ae0..02a672e0c7 100644 --- a/src/vt/serialization/messaging/serialized_messenger.impl.h +++ b/src/vt/serialization/messaging/serialized_messenger.impl.h @@ -203,7 +203,7 @@ template template /*static*/ messaging::PendingSend SerializedMessenger::sendSerialMsg( - NodeType dest, MsgT* msg, HandlerType handler, + NodeT dest, MsgT* msg, HandlerType handler, ActionEagerSend eager_sender ) { auto eager_default_send = @@ -387,7 +387,7 @@ template vtAssertExpr(payload_msg == nullptr && data_sender != nullptr); - auto send_data = [=](NodeType dest) -> messaging::PendingSend { + auto send_data = [=](NodeT dest) -> messaging::PendingSend { auto const& node = theContext()->getNode(); if (node != dest) { auto sys_msg = makeMessage>(); diff --git a/src/vt/standalone/vt_main.h b/src/vt/standalone/vt_main.h index 3c3aaea113..2ebcb90ca3 100644 --- a/src/vt/standalone/vt_main.h +++ b/src/vt/standalone/vt_main.h @@ -54,7 +54,7 @@ namespace vt { namespace standalone { -static constexpr NodeType const main_node = 0; +static constexpr NodeT const main_node = NodeT{0}; template inline void vrLaunchMainContext() { diff --git a/src/vt/termination/dijkstra-scholten/ack_msg.h b/src/vt/termination/dijkstra-scholten/ack_msg.h index 2c44154a44..8c60d69e15 100644 --- a/src/vt/termination/dijkstra-scholten/ack_msg.h +++ b/src/vt/termination/dijkstra-scholten/ack_msg.h @@ -54,20 +54,20 @@ namespace vt { namespace term { namespace ds { struct AckMsg : ::vt::Message { AckMsg() = default; AckMsg( - EpochType const& in_epoch, NodeType const& in_this, NodeType const& in_pred, + EpochType const& in_epoch, NodeT const& in_this, NodeT const& in_pred, int64_t const in_count ) : epoch_(in_epoch), node_(in_this), pred_(in_pred), count_(in_count) { } EpochType getEpoch() const { return epoch_; } - NodeType getNode() const { return node_; } - NodeType getPred() const { return pred_; } + NodeT getNode() const { return node_; } + NodeT getPred() const { return pred_; } int64_t getCount() const { return count_; } private: EpochType epoch_ = no_epoch; - NodeType node_ = uninitialized_destination; - NodeType pred_ = uninitialized_destination; + NodeT node_ = {}; + NodeT pred_ = {}; int64_t count_ = 0; }; diff --git a/src/vt/termination/dijkstra-scholten/ack_request.h b/src/vt/termination/dijkstra-scholten/ack_request.h index 5aa15a28d4..3ff816fc9c 100644 --- a/src/vt/termination/dijkstra-scholten/ack_request.h +++ b/src/vt/termination/dijkstra-scholten/ack_request.h @@ -51,9 +51,9 @@ namespace vt { namespace term { namespace ds { struct AckRequest { - AckRequest(NodeType p, int64_t c) : pred(p), count(c) { } + AckRequest(NodeT p, int64_t c) : pred(p), count(c) { } - NodeType pred = uninitialized_destination; + NodeT pred = {}; int64_t count = 0; }; diff --git a/src/vt/termination/dijkstra-scholten/comm.h b/src/vt/termination/dijkstra-scholten/comm.h index 3307781e10..65cd3db657 100644 --- a/src/vt/termination/dijkstra-scholten/comm.h +++ b/src/vt/termination/dijkstra-scholten/comm.h @@ -53,7 +53,7 @@ namespace vt { namespace term { namespace ds { struct StateDS { - using Endpoint = NodeType; + using Endpoint = NodeT ; using TerminatorType = TermDS; StateDS() = default; diff --git a/src/vt/termination/dijkstra-scholten/ds.cc b/src/vt/termination/dijkstra-scholten/ds.cc index a38c8c53f9..e7c716bcb2 100644 --- a/src/vt/termination/dijkstra-scholten/ds.cc +++ b/src/vt/termination/dijkstra-scholten/ds.cc @@ -53,7 +53,7 @@ namespace vt { namespace term { namespace ds { template -TermDS::TermDS(EpochType in_epoch, bool isRoot_, NodeType self_) +TermDS::TermDS(EpochType in_epoch, bool isRoot_, NodeT self_) : EpochDependency(in_epoch, true), parent(-1), self(self_), C(0), ackedArbitrary(0), ackedParent(0), reqedParent(0), engagementMessageCount(0), D(0), processedSum(C) @@ -90,7 +90,7 @@ void TermDS::setRoot(bool isRoot) { } template -void TermDS::msgSent(NodeType successor, CountType count) { +void TermDS::msgSent(NodeT successor, CountType count) { vtAssertExpr(successor >= 0); vtAssertInfo( 1 && (C == processedSum - (ackedArbitrary + ackedParent)), @@ -140,7 +140,7 @@ void TermDS::doneSending() { } template -void TermDS::msgProcessed(NodeType predecessor, CountType count) { +void TermDS::msgProcessed(NodeT predecessor, CountType count) { vtAssertInfo( 4 && (C == processedSum - (ackedArbitrary + ackedParent)), "DS-invariant", C, D, processedSum, ackedArbitrary, @@ -214,7 +214,7 @@ void TermDS::msgProcessed(NodeType predecessor, CountType count) { template void TermDS::needAck( - NodeType const predecessor, CountType const count + NodeT const predecessor, CountType const count ) { vtAssertInfo( 5 && (C == processedSum - (ackedArbitrary + ackedParent)), @@ -309,7 +309,7 @@ void TermDS::tryLast() { CommType::acknowledge(epoch_, parent, engagementMessageCount); } - parent = -1; + parent = NodeT{-1}; C = ackedParent = ackedArbitrary = reqedParent = 0; engagementMessageCount = processedSum = 0; diff --git a/src/vt/termination/dijkstra-scholten/ds.h b/src/vt/termination/dijkstra-scholten/ds.h index cf403c5cc4..9dbcec667b 100644 --- a/src/vt/termination/dijkstra-scholten/ds.h +++ b/src/vt/termination/dijkstra-scholten/ds.h @@ -80,18 +80,18 @@ struct TermDS : EpochDependency, EpochLabel { using CountType = int64_t; using AckReqListType = std::list; - TermDS(EpochType in_epoch, bool isRoot_, NodeType self_); + TermDS(EpochType in_epoch, bool isRoot_, NodeT self_); TermDS(TermDS&&) = default; TermDS(TermDS const&) = delete; virtual ~TermDS() = default; void setRoot(bool isRoot); - void msgSent(NodeType successor, CountType count); + void msgSent(NodeT successor, CountType count); void gotAck(CountType count); void doneSending(); - void msgProcessed(NodeType predecessor, CountType count); - void needAck(NodeType const predecessor, CountType const count); + void msgProcessed(NodeT predecessor, CountType count); + void needAck(NodeT const predecessor, CountType const count); void tryAck(); void terminated(); bool hasParent(); @@ -102,8 +102,8 @@ struct TermDS : EpochDependency, EpochLabel { void tryLast(); protected: - NodeType parent = uninitialized_destination; - NodeType self = uninitialized_destination; + NodeT parent = {}; + NodeT self = {}; CountType C = 0; CountType ackedArbitrary = 0; CountType ackedParent = 0; diff --git a/src/vt/termination/graph/epoch_graph.cc b/src/vt/termination/graph/epoch_graph.cc index 8a01842f03..0d5759d15f 100644 --- a/src/vt/termination/graph/epoch_graph.cc +++ b/src/vt/termination/graph/epoch_graph.cc @@ -107,7 +107,7 @@ EpochGraph::EpFormat EpochGraph::formatDOTEpoch( EpochType epoch, std::string label ) { if (epoch == term::any_epoch_sentinel) { - return std::make_tuple(epoch, static_cast(-1), true, "Global"); + return std::make_tuple(epoch, static_cast (-1), true, "Global"); } else { std::string label_format = ""; if (label != "") { @@ -128,7 +128,7 @@ EpochGraph::EpFormat EpochGraph::formatDOTEpoch( } } else { auto str = fmt::format("{}{:x}-C", label_format, epoch); - return std::make_tuple(epoch, static_cast(-1), true, str); + return std::make_tuple(epoch, static_cast (-1), true, str); } } } @@ -178,7 +178,7 @@ std::string EpochGraph::outputDOT(bool verbose) { builder += "\t]\n"; for (auto&& elm : eps) { EpochType ep = std::get<0>(elm.second); - NodeType node = std::get<1>(elm.second); + NodeT node = std::get<1>(elm.second); bool collective = std::get<2>(elm.second); std::string str = std::get<3>(elm.second); if (not theConfig()->vt_epoch_graph_terse or verbose) { diff --git a/src/vt/termination/graph/epoch_graph.h b/src/vt/termination/graph/epoch_graph.h index 4d9833d840..782103dbdd 100644 --- a/src/vt/termination/graph/epoch_graph.h +++ b/src/vt/termination/graph/epoch_graph.h @@ -57,7 +57,7 @@ namespace vt { namespace termination { namespace graph { struct EpochGraph { - using EpFormat = std::tuple; + using EpFormat = std::tuple; EpochGraph() = default; EpochGraph(EpochGraph&&) = default; diff --git a/src/vt/termination/term_interface.h b/src/vt/termination/term_interface.h index 08df8bcfdf..f6c9a8f2c5 100644 --- a/src/vt/termination/term_interface.h +++ b/src/vt/termination/term_interface.h @@ -58,8 +58,8 @@ struct TermInterface { EpochType epoch = any_epoch_sentinel, TermCounterType const& num_units = 1 ); /// Interface for Dijkstra-Scholten termination - void send(NodeType const& node, EpochType const& epoch = any_epoch_sentinel); - void recv(NodeType const& node, EpochType const& epoch = any_epoch_sentinel); + void send(NodeT const& node, EpochType const& epoch = any_epoch_sentinel); + void recv(NodeT const& node, EpochType const& epoch = any_epoch_sentinel); }; }} /* end namespace vt::term */ diff --git a/src/vt/termination/term_msgs.h b/src/vt/termination/term_msgs.h index b2ff313d1b..0d6c9f49cc 100644 --- a/src/vt/termination/term_msgs.h +++ b/src/vt/termination/term_msgs.h @@ -62,16 +62,16 @@ struct TermMsg : vt::ShortMessage { struct TermTerminatedMsg : vt::Message { TermTerminatedMsg() = default; - TermTerminatedMsg(EpochType const& in_epoch, NodeType const& in_from_node) + TermTerminatedMsg(EpochType const& in_epoch, NodeT const& in_from_node) : epoch_(in_epoch), from_node_(in_from_node) { } EpochType getEpoch() const { return epoch_; } - NodeType getFromNode() const { return from_node_; } + NodeT getFromNode() const { return from_node_; } private: EpochType epoch_ = no_epoch; - NodeType from_node_ = uninitialized_destination; + NodeT from_node_ = {}; }; struct TermTerminatedReplyMsg : vt::Message { diff --git a/src/vt/termination/term_state.cc b/src/vt/termination/term_state.cc index 76cb40d251..e339c05329 100644 --- a/src/vt/termination/term_state.cc +++ b/src/vt/termination/term_state.cc @@ -55,7 +55,7 @@ void TermState::setCurWave(TermWaveType const& wave) { cur_wave_ = wave; } -NodeType TermState::getNumChildren() const { +NodeT TermState::getNumChildren() const { return num_children_; } @@ -123,7 +123,7 @@ TermCounterType TermState::decrementDependency() { bool TermState::readySubmitParent() const { vtAssert( - num_children_ != uninitialized_destination, "Children must be valid" + num_children_ != NodeT{}, "Children must be valid" ); auto const ret = epoch_active_ and local_terminated_ and @@ -145,7 +145,7 @@ bool TermState::readySubmitParent() const { TermState::TermState( EpochType const& in_epoch, bool const in_local_terminated, bool const active, - NodeType const& children + NodeT const& children ) : EpochDependency(in_epoch, false), local_terminated_(in_local_terminated), epoch_active_(active), num_children_(children) @@ -158,7 +158,7 @@ TermState::TermState( ); } -TermState::TermState(EpochType const& in_epoch, NodeType const& children) +TermState::TermState(EpochType const& in_epoch, NodeT const& children) : EpochDependency(in_epoch, false), num_children_(children) { vt_debug_print( diff --git a/src/vt/termination/term_state.h b/src/vt/termination/term_state.h index 1e0d2aaa25..d80f77e236 100644 --- a/src/vt/termination/term_state.h +++ b/src/vt/termination/term_state.h @@ -71,7 +71,7 @@ struct TermState : EpochDependency, EpochLabel { EpochType getEpoch() const; TermWaveType getCurWave() const; void setCurWave(TermWaveType const& wave); - NodeType getNumChildren() const; + NodeT getNumChildren() const; bool noLocalUnits() const; void incrementDependency(); TermCounterType decrementDependency(); @@ -80,9 +80,9 @@ struct TermState : EpochDependency, EpochLabel { TermState( EpochType const& in_epoch, bool const in_local_terminated, bool const active, - NodeType const& children + NodeT const& children ); - TermState(EpochType const& in_epoch, NodeType const& children); + TermState(EpochType const& in_epoch, NodeT const& children); TermState(TermState const&) = default; TermState(TermState&&) = default; @@ -128,7 +128,7 @@ struct TermState : EpochDependency, EpochLabel { TermCounterType deps_ = 0; EventCountType recv_child_count_ = 0; - NodeType num_children_ = uninitialized_destination; + NodeT num_children_ = {}; TermWaveType cur_wave_ = 0; TermWaveType submitted_wave_ = -1; }; diff --git a/src/vt/termination/termination.cc b/src/vt/termination/termination.cc index a8a5db7dd7..5c18f4cbee 100644 --- a/src/vt/termination/termination.cc +++ b/src/vt/termination/termination.cc @@ -574,7 +574,7 @@ void TerminationDetector::startEpochGraphBuild() { auto str = graph->outputDOT(); graph->writeToFile(str); auto msg = makeMessage(graph); - NodeType root = 0; + NodeT root = NodeT{0}; auto cb = vt::theCB()->makeSend(root); auto r = theTerm()->reducer(); @@ -680,7 +680,7 @@ void TerminationDetector::epochTerminated(EpochType const& epoch, CallFromEnum f } void TerminationDetector::inquireTerminated( - EpochType const& epoch, NodeType const& from + EpochType const& epoch, NodeT const& from ) { auto const& is_rooted = epoch::EpochManip::isRooted(epoch); auto const& epoch_root_node = epoch::EpochManip::node(epoch); diff --git a/src/vt/termination/termination.h b/src/vt/termination/termination.h index 8e99a02b33..7bb473da14 100644 --- a/src/vt/termination/termination.h +++ b/src/vt/termination/termination.h @@ -153,7 +153,7 @@ struct TerminationDetector : */ void produce( EpochType epoch = any_epoch_sentinel, TermCounterType num_units = 1, - NodeType node = uninitialized_destination + NodeT node = {} ); /** @@ -165,7 +165,7 @@ struct TerminationDetector : */ void consume( EpochType epoch = any_epoch_sentinel, TermCounterType num_units = 1, - NodeType node = uninitialized_destination + NodeT node = {} ); /** @@ -447,7 +447,7 @@ struct TerminationDetector : */ inline void produceConsume( EpochType epoch = any_epoch_sentinel, TermCounterType num_units = 1, - bool produce = true, NodeType node = uninitialized_destination + bool produce = true, NodeT node = {} ); /** @@ -502,7 +502,7 @@ struct TerminationDetector : * \param[in] epoch the epoch * \param[in] from_node the node inquiring */ - void inquireTerminated(EpochType const& epoch, NodeType const& from_node); + void inquireTerminated(EpochType const& epoch, NodeT const& from_node); /** * \internal \brief Reply to a node whether an epoch has terminated @@ -822,7 +822,7 @@ struct TerminationDetector : std::unordered_set epoch_wait_status_ = {}; // has printed epoch graph during abort bool has_printed_epoch_graph = false; - NodeType this_node_ = uninitialized_destination; + NodeT this_node_ = {}; EpochStackType epoch_stack_; }; diff --git a/src/vt/termination/termination.impl.h b/src/vt/termination/termination.impl.h index 219ed4c44c..a830b38e6c 100644 --- a/src/vt/termination/termination.impl.h +++ b/src/vt/termination/termination.impl.h @@ -52,7 +52,7 @@ namespace vt { namespace term { inline void TerminationDetector::produce( - EpochType epoch, TermCounterType num_units, NodeType node + EpochType epoch, TermCounterType num_units, NodeT node ) { vt_debug_print(verbose, term, "produce: epoch={:x}, node={}\n", epoch, node); auto const in_epoch = epoch == no_epoch ? any_epoch_sentinel : epoch; @@ -60,7 +60,7 @@ inline void TerminationDetector::produce( } inline void TerminationDetector::consume( - EpochType epoch, TermCounterType num_units, NodeType node + EpochType epoch, TermCounterType num_units, NodeT node ) { vt_debug_print(verbose, term, "consume: epoch={:x}, node={}\n", epoch, node); auto const in_epoch = epoch == no_epoch ? any_epoch_sentinel : epoch; @@ -103,7 +103,7 @@ inline void TerminationDetector::produceConsumeState( } inline void TerminationDetector::produceConsume( - EpochType epoch, TermCounterType num_units, bool produce, NodeType node + EpochType epoch, TermCounterType num_units, bool produce, NodeT node ) { vt_debug_print( normal, term, @@ -119,7 +119,7 @@ inline void TerminationDetector::produceConsume( auto ds_term = getDSTerm(epoch); // If a node is not passed, use the current node (self-prod/cons) - if (node == uninitialized_destination) { + if (node.get() == uninitialized_destination) { node = this_node_; } diff --git a/src/vt/topos/location/location.h b/src/vt/topos/location/location.h index 1e465e0e34..0dd691925d 100644 --- a/src/vt/topos/location/location.h +++ b/src/vt/topos/location/location.h @@ -103,7 +103,7 @@ struct EntityLocationCoord : LocationCoord { using PendingLocLookupsType = std::unordered_map; using ActionContainerType = std::unordered_map; using LocMsgType = LocationMsg; - using LocAsksType = std::unordered_map>; + using LocAsksType = std::unordered_map>; template using EntityMsgType = EntityMsg; @@ -140,7 +140,7 @@ struct EntityLocationCoord : LocationCoord { * \param[in] migrated whether it migrated in: \c entityEmigrated is preferred */ void registerEntity( - EntityID const& id, NodeType const& home, + EntityID const& id, NodeT const& home, LocMsgActionType msg_action = nullptr, bool const& migrated = false ); @@ -157,7 +157,7 @@ struct EntityLocationCoord : LocationCoord { * \param[in] msg_action function to trigger when message arrives for it */ void registerEntityRemote( - EntityID const& id, NodeType const& home, NodeType const create_node, + EntityID const& id, NodeT const& home, NodeT const create_node, LocMsgActionType msg_action = nullptr ); @@ -175,7 +175,7 @@ struct EntityLocationCoord : LocationCoord { * \param[in] id the entity ID * \param[in] new_node the node it was migrated to */ - void entityEmigrated(EntityID const& id, NodeType const& new_node); + void entityEmigrated(EntityID const& id, NodeT const& new_node); /** * \brief Register a migrated entity on new node @@ -184,17 +184,17 @@ struct EntityLocationCoord : LocationCoord { * This should be called after the entity is migrated when it arrived on the * new node: order of operations: * - * 1) Node 0: registerEntity(my_id, ...); - * 2) Node 0: entityEmigrated(my_id, 1); - * 3) Node 1: entityImmigrated(my_id, , 0, ...); + * 1) NodeT 0: registerEntity(my_id, ...); + * 2) NodeT 0: entityEmigrated(my_id, 1); + * 3) NodeT 1: entityImmigrated(my_id, , 0, ...); * * \param[in] id the entity ID * \param[in] home_node the home node for the entity * \param[in] msg_action function to trigger when message arrives for it */ void entityImmigrated( - EntityID const& id, NodeType const& home_node, - NodeType const& __attribute__((unused)) from_node, + EntityID const& id, NodeT const& home_node, + NodeT const& __attribute__((unused)) from_node, LocMsgActionType msg_action = nullptr ); @@ -221,12 +221,12 @@ struct EntityLocationCoord : LocationCoord { * \param[in] action the action to trigger with the discovered location */ void getLocation( - EntityID const& id, NodeType const& home_node, NodeActionType const& action + EntityID const& id, NodeT const& home_node, NodeActionType const& action ); template *f> void setupMessageForRouting( - EntityID const& id, NodeType const& home_node, + EntityID const& id, NodeT const& home_node, MsgSharedPtr const& msg ); @@ -239,7 +239,7 @@ struct EntityLocationCoord : LocationCoord { */ template *f> void routeMsgHandler( - EntityID const& id, NodeType const& home_node, + EntityID const& id, NodeT const& home_node, MsgSharedPtr const& msg ); @@ -277,9 +277,9 @@ struct EntityLocationCoord : LocationCoord { */ template void routeMsg( - EntityID const& id, NodeType const& home_node, + EntityID const& id, NodeT const& home_node, MsgSharedPtr const& msg, - NodeType from_node = uninitialized_destination + NodeT from_node = {} ); /** @@ -290,7 +290,7 @@ struct EntityLocationCoord : LocationCoord { * \param[in] action action once entity is found */ void routeNonEagerAction( - EntityID const& id, NodeType const& home_node, ActionNodeType action + EntityID const& id, NodeT const& home_node, ActionNodeType action ); /** @@ -303,7 +303,7 @@ struct EntityLocationCoord : LocationCoord { */ void updatePendingRequest( LocEventID const& event_id, EntityID const& id, - NodeType const& resolved_node, NodeType const& home_node + NodeT const& resolved_node, NodeT const& home_node ); /** @@ -334,8 +334,8 @@ struct EntityLocationCoord : LocationCoord { * \param[in] deliver_node the node discovered which delivered the message */ void sendEagerUpdate( - EntityID const& id, NodeType ask_node, NodeType home_node, - NodeType deliver_node + EntityID const& id, NodeT ask_node, NodeT home_node, + NodeT deliver_node ); /** @@ -346,7 +346,7 @@ struct EntityLocationCoord : LocationCoord { * \param[in] deliver_node the node discovered which delivered the message */ void handleEagerUpdate( - EntityID const& id, NodeType home_node, NodeType deliver_node + EntityID const& id, NodeT home_node, NodeT deliver_node ); /** @@ -404,7 +404,7 @@ struct EntityLocationCoord : LocationCoord { */ template void routeMsgEager( - EntityID const& id, NodeType const& home_node, + EntityID const& id, NodeT const& home_node, MsgSharedPtr const& msg ); @@ -418,7 +418,7 @@ struct EntityLocationCoord : LocationCoord { */ template void routeMsgNode( - EntityID const& id, NodeType const& home_node, NodeType const& to_node, + EntityID const& id, NodeT const& home_node, NodeT const& to_node, MsgSharedPtr const& msg ); diff --git a/src/vt/topos/location/location.impl.h b/src/vt/topos/location/location.impl.h index b0f065f3ad..7cff4cc1ca 100644 --- a/src/vt/topos/location/location.impl.h +++ b/src/vt/topos/location/location.impl.h @@ -94,7 +94,7 @@ template template void EntityLocationCoord::registerEntity( - EntityID const& id, NodeType const& home, LocMsgActionType msg_action, + EntityID const& id, NodeT const& home, LocMsgActionType msg_action, bool const& migrated ) { auto const& this_node = theContext()->getNode(); @@ -159,7 +159,7 @@ void EntityLocationCoord::registerEntity( * constructed in an alternative non-default location. Thus we need to * inform the home so that messages can be forwarded. */ - vtAssert(home != uninitialized_destination, "Must have home node info"); + vtAssert(home != NodeT{}, "Must have home node info"); if (home != this_node) { vt_debug_print( normal, location, @@ -168,7 +168,7 @@ void EntityLocationCoord::registerEntity( id, home ); - auto const& ask_node = uninitialized_destination; + auto const& ask_node = NodeT{}; auto msg = makeMessage( this_inst, id, no_location_event_id, ask_node, home ); @@ -181,7 +181,7 @@ void EntityLocationCoord::registerEntity( template void EntityLocationCoord::registerEntityRemote( - EntityID const& id, NodeType const& home, NodeType const create_node, + EntityID const& id, NodeT const& home, NodeT const create_node, LocMsgActionType msg_action ) { auto reg_iter = local_registered_.find(id); @@ -240,7 +240,7 @@ void EntityLocationCoord::unregisterEntity(EntityID const& id) { template void EntityLocationCoord::entityEmigrated( - EntityID const& id, NodeType const& new_node + EntityID const& id, NodeT const& new_node ) { vt_debug_print( normal, location, @@ -259,7 +259,7 @@ void EntityLocationCoord::entityEmigrated( template void EntityLocationCoord::entityImmigrated( - EntityID const& id, NodeType const& home_node, NodeType const& from, + EntityID const& id, NodeT const& home_node, NodeT const& from, LocMsgActionType msg_action ) { // @todo: currently `from' is unused, but is passed to this method in case we @@ -336,11 +336,11 @@ void EntityLocationCoord::insertPendingEntityAction( template template void EntityLocationCoord::routeMsgEager( - EntityID const& id, NodeType const& home_node, + EntityID const& id, NodeT const& home_node, MsgSharedPtr const& msg ) { auto const& this_node = theContext()->getNode(); - NodeType route_to_node = uninitialized_destination; + auto route_to_node = NodeT{}; auto reg_iter = local_registered_.find(id); bool const found = reg_iter != local_registered_.end(); @@ -376,8 +376,8 @@ void EntityLocationCoord::routeMsgEager( } vtAssert( - route_to_node != uninitialized_destination, - "Node to route to must be set by this point" + route_to_node != NodeT{}, + "NodeT to route to must be set by this point" ); vt_debug_print( @@ -392,7 +392,7 @@ void EntityLocationCoord::routeMsgEager( template void EntityLocationCoord::getLocation( - EntityID const& id, NodeType const& home_node, NodeActionType const& action + EntityID const& id, NodeT const& home_node, NodeActionType const& action ) { auto const& this_node = theContext()->getNode(); @@ -455,11 +455,11 @@ void EntityLocationCoord::getLocation( template void EntityLocationCoord::handleEagerUpdate( - EntityID const& id, NodeType home_node, NodeType deliver_node + EntityID const& id, NodeT home_node, NodeT deliver_node ) { auto this_node = theContext()->getNode(); vtAssert(this_node != deliver_node, "This should have been a forwarding node"); - vtAssert(home_node != uninitialized_destination, "Home node should be valid"); + vtAssert(home_node != NodeT{}, "Home node should be valid"); vtAssert(home_node < theContext()->getNumNodes(), "Home node should be valid"); vt_debug_print( @@ -482,8 +482,8 @@ void EntityLocationCoord::handleEagerUpdate( template void EntityLocationCoord::sendEagerUpdate( - EntityID const& id, NodeType ask_node, NodeType home_node, - NodeType deliver_node + EntityID const& id, NodeT ask_node, NodeT home_node, + NodeT deliver_node ) { vt_debug_print( normal, location, @@ -493,7 +493,7 @@ void EntityLocationCoord::sendEagerUpdate( auto this_node = theContext()->getNode(); if (ask_node != this_node) { - vtAssert(ask_node != uninitialized_destination, "Ask node must be valid"); + vtAssert(ask_node != NodeT{}, "Ask node must be valid"); auto msg = makeMessage( this_inst, id, ask_node, home_node, deliver_node ); @@ -504,7 +504,7 @@ void EntityLocationCoord::sendEagerUpdate( template template void EntityLocationCoord::routeMsgNode( - EntityID const& id, NodeType const& home_node, NodeType const& to_node, + EntityID const& id, NodeT const& home_node, NodeT const& to_node, MsgSharedPtr const& msg ) { auto const& this_node = theContext()->getNode(); @@ -524,7 +524,7 @@ void EntityLocationCoord::routeMsgNode( if (to_node != this_node) { // Get the current ask node, which is the from node for the first hop auto ask_node = msg->getAskNode(); - if (ask_node != uninitialized_destination) { + if (ask_node != NodeT{}) { // Insert into the ask list for a later update when information is known loc_asks_[id].insert(ask_node); } @@ -580,7 +580,7 @@ void EntityLocationCoord::routeMsgNode( auto ask_node = msg->getAskNode(); - if (ask_node != uninitialized_destination) { + if (ask_node != NodeT{}) { auto delivered_node = theContext()->getNode(); sendEagerUpdate(hid, ask_node, home_node, delivered_node); } @@ -614,7 +614,7 @@ void EntityLocationCoord::routeMsgNode( EntityID id_ = id; // buffer the message here, the entity will be registered in the future - insertPendingEntityAction(id_, [=](NodeType resolved) { + insertPendingEntityAction(id_, [=](NodeT resolved) { auto const& my_node = theContext()->getNode(); vt_debug_print( @@ -644,9 +644,9 @@ void EntityLocationCoord::routeMsgNode( template void EntityLocationCoord::routeNonEagerAction( - EntityID const& id, NodeType const& home_node, ActionNodeType action + EntityID const& id, NodeT const& home_node, ActionNodeType action ) { - getLocation(id, home_node, [=](NodeType node) { + getLocation(id, home_node, [=](NodeT node) { action(node); }); } @@ -654,7 +654,7 @@ void EntityLocationCoord::routeNonEagerAction( template template *f> void EntityLocationCoord::routeMsgHandler( - EntityID const& id, NodeType const& home_node, + EntityID const& id, NodeT const& home_node, MsgSharedPtr const& msg ) { setupMessageForRouting(id, home_node, msg); @@ -677,7 +677,7 @@ void EntityLocationCoord::routePreparedMsgHandler( template template *f> void EntityLocationCoord::setupMessageForRouting( - EntityID const& id, NodeType const& home_node, + EntityID const& id, NodeT const& home_node, MsgSharedPtr const& msg ) { using auto_registry::HandlerManagerType; @@ -732,7 +732,7 @@ void EntityLocationCoord::routePreparedMsg( } else { theTerm()->produce(epoch); // non-eager protocol: get location first then send message after resolution - getLocation(msg->getEntity(), msg->getHomeNode(), [=](NodeType node) { + getLocation(msg->getEntity(), msg->getHomeNode(), [=](NodeT node) { theMsg()->pushEpoch(epoch); routeMsgNode( msg->getEntity(), msg->getHomeNode(), node, msg @@ -746,11 +746,11 @@ void EntityLocationCoord::routePreparedMsg( template template void EntityLocationCoord::routeMsg( - EntityID const& id, NodeType const& home_node, - MsgSharedPtr const& msg, NodeType from_node + EntityID const& id, NodeT const& home_node, + MsgSharedPtr const& msg, NodeT from_node ) { auto const from = - from_node == uninitialized_destination ? theContext()->getNode() : + from_node == NodeT{} ? theContext()->getNode() : from_node; // set field for location routed message @@ -764,7 +764,7 @@ void EntityLocationCoord::routeMsg( template void EntityLocationCoord::updatePendingRequest( LocEventID const& event_id, EntityID const& id, - NodeType const& node, NodeType const& home_node + NodeT const& node, NodeT const& home_node ) { vt_debug_print( @@ -880,7 +880,7 @@ template event_id, epoch ); - loc->getLocation(entity, home_node, [=](NodeType node) { + loc->getLocation(entity, home_node, [=](NodeT node) { vt_debug_print( verbose, location, "getLocation: (action) event_id={}, epoch={:x}\n", diff --git a/src/vt/topos/location/location_common.h b/src/vt/topos/location/location_common.h index 2743d1979f..2140841fac 100644 --- a/src/vt/topos/location/location_common.h +++ b/src/vt/topos/location/location_common.h @@ -52,7 +52,7 @@ namespace vt { namespace location { -using NodeActionType = std::function; +using NodeActionType = std::function; using LocMsgActionType = std::function; using LocEventID = int64_t; diff --git a/src/vt/topos/location/lookup/lookup.h b/src/vt/topos/location/lookup/lookup.h index 0a53cf4e7c..0168bb4ea2 100644 --- a/src/vt/topos/location/lookup/lookup.h +++ b/src/vt/topos/location/lookup/lookup.h @@ -54,7 +54,7 @@ namespace vt { namespace location { template struct LocLookup { - LocLookup(LocationSizeType const& in_max_cache_size, NodeType in_this_node) + LocLookup(LocationSizeType const& in_max_cache_size, NodeT in_this_node) : max_cache_size_(in_max_cache_size), cache_(in_max_cache_size), this_node_(in_this_node) @@ -64,7 +64,7 @@ struct LocLookup { LocationSizeType getCacheSize() const; ValueT const& get(KeyT const& key); void remove(KeyT const& key); - void insert(KeyT const& key, NodeType const home, ValueT const& value); + void insert(KeyT const& key, NodeT const home, ValueT const& value); void update(KeyT const& key, ValueT const& value); void clearCache(); void printCache() const; @@ -81,7 +81,7 @@ struct LocLookup { LocationSizeType max_cache_size_ = 0; Directory directory_; LocationCache cache_; - NodeType this_node_ = uninitialized_destination; + NodeT this_node_ = {}; }; }} /* end namespace vt::location */ diff --git a/src/vt/topos/location/lookup/lookup.impl.h b/src/vt/topos/location/lookup/lookup.impl.h index bf4839487e..9314f6909f 100644 --- a/src/vt/topos/location/lookup/lookup.impl.h +++ b/src/vt/topos/location/lookup/lookup.impl.h @@ -75,7 +75,7 @@ void LocLookup::remove(KeyT const& key) { template void LocLookup::insert( - KeyT const& key, NodeType const home, ValueT const& value + KeyT const& key, NodeT const home, ValueT const& value ) { // If this node is the home, maintain location in permanent directory, // otherwise, insert/update in local cache of locations diff --git a/src/vt/topos/location/message/msg.h b/src/vt/topos/location/message/msg.h index d6e53825c8..990c8fe2eb 100644 --- a/src/vt/topos/location/message/msg.h +++ b/src/vt/topos/location/message/msg.h @@ -58,27 +58,27 @@ struct LocationMsg : vt::Message { LocInstType loc_man_inst = 0; EntityID entity{}; LocEventID loc_event = no_location_event_id; - NodeType ask_node = uninitialized_destination; - NodeType home_node = uninitialized_destination; - NodeType resolved_node = uninitialized_destination; + NodeT ask_node = {}; + NodeT home_node = {}; + NodeT resolved_node = {}; LocationMsg( LocInstType const& in_loc_man_inst, EntityID const& in_entity, - LocEventID const& in_loc_event, NodeType const& in_ask_node, - NodeType in_home_node + LocEventID const& in_loc_event, NodeT const& in_ask_node, + NodeT in_home_node ) : loc_man_inst(in_loc_man_inst), entity(in_entity), loc_event(in_loc_event), ask_node(in_ask_node), home_node(in_home_node) { } LocationMsg( LocInstType const& in_loc_man_inst, EntityID const& in_entity, - NodeType const& in_ask_node, NodeType const& in_home_node, - NodeType in_resolved + NodeT const& in_ask_node, NodeT const& in_home_node, + NodeT in_resolved ) : loc_man_inst(in_loc_man_inst), entity(in_entity), ask_node(in_ask_node), home_node(in_home_node), resolved_node(in_resolved) { } - void setResolvedNode(NodeType const& node) { + void setResolvedNode(NodeT const& node) { resolved_node = node; } }; @@ -89,16 +89,16 @@ struct EntityMsg : ActiveMessageT { vt_msg_serialize_if_needed_by_parent(); EntityMsg() = default; - EntityMsg(EntityID const& in_entity_id, NodeType const& in_home_node) + EntityMsg(EntityID const& in_entity_id, NodeT const& in_home_node) : ActiveMessageT(), entity_id_(in_entity_id), home_node_(in_home_node) { } void setEntity(EntityID const& entity) { entity_id_ = entity; } EntityID getEntity() const { return entity_id_; } - void setHomeNode(NodeType const& node) { home_node_ = node; } - NodeType getHomeNode() const { return home_node_; } - void setLocFromNode(NodeType const& node) { loc_from_node_ = node; } - NodeType getLocFromNode() const { return loc_from_node_; } + void setHomeNode(NodeT const& node) { home_node_ = node; } + NodeT getHomeNode() const { return home_node_; } + void setLocFromNode(NodeT const& node) { loc_from_node_ = node; } + NodeT getLocFromNode() const { return loc_from_node_; } void setLocInst(LocInstType const& inst) { loc_man_inst_ = inst; } LocInstType getLocInst() const { return loc_man_inst_; } bool hasHandler() const { return handler_ != uninitialized_handler; } @@ -106,8 +106,8 @@ struct EntityMsg : ActiveMessageT { HandlerType getHandler() const { return handler_; } void incHops() { hops_ += 1; } int16_t getHops() const { return hops_; } - void setAskNode(NodeType const& node) { ask_node_ = node; } - NodeType getAskNode() const { return ask_node_; } + void setAskNode(NodeT const& node) { ask_node_ = node; } + NodeT getAskNode() const { return ask_node_; } template void serialize(SerializerT& s) { @@ -123,12 +123,12 @@ struct EntityMsg : ActiveMessageT { private: EntityID entity_id_{}; - NodeType home_node_ = uninitialized_destination; - NodeType loc_from_node_ = uninitialized_destination; + NodeT home_node_ = {}; + NodeT loc_from_node_ = {}; LocInstType loc_man_inst_ = no_loc_inst; HandlerType handler_ = uninitialized_handler; int16_t hops_ = 0; - NodeType ask_node_ = uninitialized_destination; + NodeT ask_node_ = NodeT {}; }; }} // end namespace vt::location diff --git a/src/vt/topos/location/record/record.h b/src/vt/topos/location/record/record.h index b131ea4105..76d36f529b 100644 --- a/src/vt/topos/location/record/record.h +++ b/src/vt/topos/location/record/record.h @@ -57,13 +57,13 @@ struct LocRecord { LocRecord( EntityID const& in_id, LocStateType const& in_state, - NodeType const& in_node + NodeT const& in_node ); - void updateNode(NodeType const& new_node); + void updateNode(NodeT const& new_node); bool isLocal() const; bool isRemote() const; - NodeType getRemoteNode() const; + NodeT getRemoteNode() const; EntityID getEntityID() const; template @@ -79,7 +79,7 @@ struct LocRecord { private: EntityID id_; LocStateType state_ = eLocState::Invalid; - NodeType cur_node_ = uninitialized_destination; + NodeT cur_node_ = {}; }; }} // end namespace vt::location diff --git a/src/vt/topos/location/record/record.impl.h b/src/vt/topos/location/record/record.impl.h index b3f370fa4e..c6c0218aba 100644 --- a/src/vt/topos/location/record/record.impl.h +++ b/src/vt/topos/location/record/record.impl.h @@ -53,12 +53,12 @@ namespace vt { namespace location { template LocRecord::LocRecord( EntityID const& in_id, LocStateType const& in_state, - NodeType const& in_node + NodeT const& in_node ) : id_(in_id), state_(in_state), cur_node_(in_node) { } template -void LocRecord::updateNode(NodeType const& new_node) { +void LocRecord::updateNode(NodeT const& new_node) { if (new_node == theContext()->getNode()) { state_ = eLocState::Local; } else { @@ -79,7 +79,7 @@ bool LocRecord::isRemote() const { } template -NodeType LocRecord::getRemoteNode() const { +NodeT LocRecord::getRemoteNode() const { return cur_node_; } diff --git a/src/vt/topos/location/utility/pending.h b/src/vt/topos/location/utility/pending.h index d695490a34..dd2e32b71f 100644 --- a/src/vt/topos/location/utility/pending.h +++ b/src/vt/topos/location/utility/pending.h @@ -56,7 +56,7 @@ struct PendingLocationLookup { : entity_(in_entity), action_(in_act) { } - void applyNodeAction(NodeType const& node) { + void applyNodeAction(NodeT const& node) { action_(node); } diff --git a/src/vt/topos/mapping/adapt_mappers.h b/src/vt/topos/mapping/adapt_mappers.h index 58ecd3a83d..f4be64ecaf 100644 --- a/src/vt/topos/mapping/adapt_mappers.h +++ b/src/vt/topos/mapping/adapt_mappers.h @@ -50,7 +50,7 @@ namespace vt { namespace mapping { template -using MapAdapter = PhysicalResourceType(IndexT*, IndexT*, PhysicalResourceType); +using MapAdapter = NodeT(IndexT*, IndexT*, NodeT); template using FunctorAdapt = ::vt::auto_registry::FunctorAdapter; diff --git a/src/vt/topos/mapping/base_mapper_object.h b/src/vt/topos/mapping/base_mapper_object.h index 52ecad8229..6582a76aab 100644 --- a/src/vt/topos/mapping/base_mapper_object.h +++ b/src/vt/topos/mapping/base_mapper_object.h @@ -57,7 +57,7 @@ struct BaseMapper { using BaseIndexType = IdxT; virtual ~BaseMapper() = default; - virtual NodeType map(IdxT* idx, int ndim, NodeType num_nodes) = 0; + virtual NodeT map(IdxT* idx, int ndim, NodeT num_nodes) = 0; }; }} /* end namespace vt::mapping */ diff --git a/src/vt/topos/mapping/dense/dense.h b/src/vt/topos/mapping/dense/dense.h index 355065aa82..5981591e69 100644 --- a/src/vt/topos/mapping/dense/dense.h +++ b/src/vt/topos/mapping/dense/dense.h @@ -54,7 +54,7 @@ namespace vt { namespace mapping { template -NodeType blockMapDenseFlatIndex( +NodeT blockMapDenseFlatIndex( IndexElmType* flat_idx, IndexElmType* num_elems, PhysicalType num_resources ); @@ -77,34 +77,34 @@ template using Idx3DPtr = IdxType3D*; template using IdxNDPtr = IdxType*; template -NodeType denseBlockMap(IdxPtr idx, IdxPtr max_idx, NodeType nnodes); +NodeT denseBlockMap(IdxPtr idx, IdxPtr max_idx, NodeT nnodes); template -NodeType defaultDenseIndex1DMap(Idx1DPtr idx, Idx1DPtr max, NodeType n); +NodeT defaultDenseIndex1DMap(Idx1DPtr idx, Idx1DPtr max, NodeT n); template -NodeType defaultDenseIndex2DMap(Idx2DPtr idx, Idx2DPtr max, NodeType n); +NodeT defaultDenseIndex2DMap(Idx2DPtr idx, Idx2DPtr max, NodeT n); template -NodeType defaultDenseIndex3DMap(Idx3DPtr idx, Idx3DPtr max, NodeType n); +NodeT defaultDenseIndex3DMap(Idx3DPtr idx, Idx3DPtr max, NodeT n); template -NodeType defaultDenseIndexNDMap(IdxNDPtr idx, IdxNDPtr max, NodeType n); +NodeT defaultDenseIndexNDMap(IdxNDPtr idx, IdxNDPtr max, NodeT n); template -NodeType dense1DRoundRobinMap( Idx1DPtr idx, Idx1DPtr max, NodeType n); +NodeT dense1DRoundRobinMap( Idx1DPtr idx, Idx1DPtr max, NodeT n); template -NodeType dense2DRoundRobinMap( Idx2DPtr idx, Idx2DPtr max, NodeType n); +NodeT dense2DRoundRobinMap( Idx2DPtr idx, Idx2DPtr max, NodeT n); template -NodeType dense3DRoundRobinMap( Idx3DPtr idx, Idx3DPtr max, NodeType n); +NodeT dense3DRoundRobinMap( Idx3DPtr idx, Idx3DPtr max, NodeT n); template -NodeType denseNDRoundRobinMap( IdxNDPtr idx, IdxNDPtr max, NodeType n); +NodeT denseNDRoundRobinMap( IdxNDPtr idx, IdxNDPtr max, NodeT n); template -NodeType dense1DBlockMap( Idx1DPtr idx, Idx1DPtr max, NodeType n); +NodeT dense1DBlockMap( Idx1DPtr idx, Idx1DPtr max, NodeT n); template -NodeType dense2DBlockMap( Idx2DPtr idx, Idx2DPtr max, NodeType n); +NodeT dense2DBlockMap( Idx2DPtr idx, Idx2DPtr max, NodeT n); template -NodeType dense3DBlockMap( Idx3DPtr idx, Idx3DPtr max, NodeType n); +NodeT dense3DBlockMap( Idx3DPtr idx, Idx3DPtr max, NodeT n); template -NodeType denseNDBlockMap( IdxNDPtr idx, IdxNDPtr max, NodeType n); +NodeT denseNDBlockMap( IdxNDPtr idx, IdxNDPtr max, NodeT n); template using i1D = IdxType1D; template using i2D = IdxType2D; diff --git a/src/vt/topos/mapping/dense/dense.impl.h b/src/vt/topos/mapping/dense/dense.impl.h index 3b8b43ee87..38fffed4b8 100644 --- a/src/vt/topos/mapping/dense/dense.impl.h +++ b/src/vt/topos/mapping/dense/dense.impl.h @@ -54,75 +54,75 @@ namespace vt { namespace mapping { template -NodeType defaultDenseIndex1DMap(Idx1DPtr idx, Idx1DPtr max, NodeType nx) { +NodeT defaultDenseIndex1DMap(Idx1DPtr idx, Idx1DPtr max, NodeT nx) { return dense1DBlockMap(idx, max, nx); } template -NodeType defaultDenseIndex2DMap(Idx2DPtr idx, Idx2DPtr max, NodeType nx) { +NodeT defaultDenseIndex2DMap(Idx2DPtr idx, Idx2DPtr max, NodeT nx) { return dense2DBlockMap(idx, max, nx); } template -NodeType defaultDenseIndex3DMap(Idx3DPtr idx, Idx3DPtr max, NodeType nx) { +NodeT defaultDenseIndex3DMap(Idx3DPtr idx, Idx3DPtr max, NodeT nx) { return dense3DBlockMap(idx, max, nx); } template -NodeType defaultDenseIndexNDMap(IdxNDPtr idx, IdxNDPtr max, NodeType nx) { +NodeT defaultDenseIndexNDMap(IdxNDPtr idx, IdxNDPtr max, NodeT nx) { return denseNDBlockMap(idx, max, nx); } // Default round robin mappings template -NodeType dense1DRoundRobinMap(Idx1DPtr idx, Idx1DPtr max, NodeType nx) { - return idx->x() % nx; +NodeT dense1DRoundRobinMap(Idx1DPtr idx, Idx1DPtr max, NodeT nx) { + return NodeT{idx->x()} % nx; } template -NodeType dense2DRoundRobinMap(Idx2DPtr idx, Idx2DPtr max, NodeType nx) { +NodeT dense2DRoundRobinMap(Idx2DPtr idx, Idx2DPtr max, NodeT nx) { using IndexElmType = typename IdxType2D::DenseIndexType; auto const& lin_idx = linearizeDenseIndexColMajor(idx, max); - return lin_idx % nx; + return NodeT{lin_idx} % nx; } template -NodeType dense3DRoundRobinMap(Idx3DPtr idx, Idx3DPtr max, NodeType nx) { +NodeT dense3DRoundRobinMap(Idx3DPtr idx, Idx3DPtr max, NodeT nx) { using IndexElmType = typename IdxType3D::DenseIndexType; auto const& lin_idx = linearizeDenseIndexColMajor(idx, max); - return lin_idx % nx; + return NodeT{lin_idx} % nx; } template -NodeType denseNDRoundRobinMap(IdxNDPtr idx, IdxNDPtr max, NodeType nx) { +NodeT denseNDRoundRobinMap(IdxNDPtr idx, IdxNDPtr max, NodeT nx) { using IndexElmType = typename IdxType::DenseIndexType; auto const& lin_idx = linearizeDenseIndexColMajor(idx, max); - return lin_idx % nx; + return NodeT{lin_idx} % nx; } // Default block mappings template -NodeType dense1DBlockMap(Idx1DPtr idx, Idx1DPtr max, NodeType nx) { +NodeT dense1DBlockMap(Idx1DPtr idx, Idx1DPtr max, NodeT nx) { return denseBlockMap, 1>(idx, max, nx); } template -NodeType dense2DBlockMap(Idx2DPtr idx, Idx2DPtr max, NodeType nx) { +NodeT dense2DBlockMap(Idx2DPtr idx, Idx2DPtr max, NodeT nx) { return denseBlockMap, 2>(idx, max, nx); } template -NodeType dense3DBlockMap(Idx3DPtr idx, Idx3DPtr max, NodeType nx) { +NodeT dense3DBlockMap(Idx3DPtr idx, Idx3DPtr max, NodeT nx) { return denseBlockMap, 3>(idx, max, nx); } template -NodeType denseNDBlockMap(IdxNDPtr idx, IdxNDPtr max, NodeType nx) { +NodeT denseNDBlockMap(IdxNDPtr idx, IdxNDPtr max, NodeT nx) { return denseBlockMap, N>(idx, max, nx); } template -inline NodeType blockMapDenseFlatIndex( +inline NodeT blockMapDenseFlatIndex( IndexElmType* flat_idx_ptr, IndexElmType* num_elems_ptr, PhysicalType num_resources ) { @@ -137,11 +137,11 @@ inline NodeType blockMapDenseFlatIndex( IndexElmType const& num_first_set = rem_elms * (bin_size_floor + 1); if (flat_idx < num_first_set) { - return (flat_idx / (bin_size_floor + 1)); + return NodeT{(flat_idx / (bin_size_floor + 1))}; } else if (flat_idx < num_elems) { - return (rem_elms + (flat_idx - num_first_set) / bin_size_floor); + return NodeT{(rem_elms + (flat_idx - num_first_set) / bin_size_floor)}; } else { - return flat_idx % num_resources; + return NodeT{flat_idx % num_resources}; } } @@ -192,7 +192,7 @@ Idx linearizeDenseIndexRowMajor( } template -NodeType denseBlockMap(IdxPtr idx, IdxPtr max_idx, NodeType nnodes) { +NodeT denseBlockMap(IdxPtr idx, IdxPtr max_idx, NodeT nnodes) { using IndexElmType = typename Idx::DenseIndexType; IndexElmType total_elems = max_idx->getSize(); @@ -200,7 +200,7 @@ NodeType denseBlockMap(IdxPtr idx, IdxPtr max_idx, NodeType nnodes) { idx, max_idx ); - return blockMapDenseFlatIndex( + return blockMapDenseFlatIndex( &flat_idx, &total_elems, nnodes ); } diff --git a/src/vt/topos/mapping/dense/unbounded_default.h b/src/vt/topos/mapping/dense/unbounded_default.h index 1c7c191138..8c0c0c183c 100644 --- a/src/vt/topos/mapping/dense/unbounded_default.h +++ b/src/vt/topos/mapping/dense/unbounded_default.h @@ -57,7 +57,7 @@ template struct UnboundedDefaultMap : BaseMapper { static ObjGroupProxyType construct(); - NodeType map(IdxT* idx, int ndim, NodeType num_nodes) override; + NodeT map(IdxT* idx, int ndim, NodeT num_nodes) override; }; }} /* end namespace vt::mapping */ diff --git a/src/vt/topos/mapping/dense/unbounded_default.impl.h b/src/vt/topos/mapping/dense/unbounded_default.impl.h index 6696842585..10f98c1e0d 100644 --- a/src/vt/topos/mapping/dense/unbounded_default.impl.h +++ b/src/vt/topos/mapping/dense/unbounded_default.impl.h @@ -49,12 +49,12 @@ namespace vt { namespace mapping { template -NodeType UnboundedDefaultMap::map(IdxT* idx, int ndim, NodeType num_nodes) { +NodeT UnboundedDefaultMap::map(IdxT* idx, int ndim, NodeT num_nodes) { typename IdxT::DenseIndexType val = 0; for (int i = 0; i < ndim; i++) { val ^= idx->get(i); } - return val % num_nodes; + return NodeT{val} % num_nodes; } template diff --git a/src/vt/topos/mapping/mapping_function.h b/src/vt/topos/mapping/mapping_function.h index b656fd7e26..8aeee3d8ff 100644 --- a/src/vt/topos/mapping/mapping_function.h +++ b/src/vt/topos/mapping/mapping_function.h @@ -50,12 +50,10 @@ namespace vt { namespace mapping { template -using ActiveMapTypedFnType = NodeType(IndexT*, IndexT*, NodeType); -using ActiveMapFnPtrType = NodeType(*)( - index::BaseIndex*, index::BaseIndex*, NodeType -); +using ActiveMapTypedFnType = NodeT(IndexT*, IndexT*, NodeT); +using ActiveMapFnPtrType = NodeT(*)(index::BaseIndex*, index::BaseIndex*, NodeT); -using ActiveSeedMapFnType = NodeType(SeedType, NodeType); +using ActiveSeedMapFnType = NodeT(SeedType, NodeT); using ActiveSeedMapFnPtrType = ActiveSeedMapFnType*; using CollectionMapFnType = ActiveMapFnPtrType; diff --git a/src/vt/topos/mapping/seed/seed.cc b/src/vt/topos/mapping/seed/seed.cc index a6ec24beeb..e6e6383ace 100644 --- a/src/vt/topos/mapping/seed/seed.cc +++ b/src/vt/topos/mapping/seed/seed.cc @@ -61,8 +61,8 @@ CoreType randomSeedMapCore(SeedType seed, CoreType ncores) { return randomSeedMap(seed, ncores); } -NodeType randomSeedMapNode(SeedType seed, NodeType nnodes) { - return randomSeedMap(seed, nnodes); +NodeT randomSeedMapNode(SeedType seed, NodeT nnodes) { + return NodeT{randomSeedMap(seed, nnodes)}; } }} /* end namespace vt::mapping */ diff --git a/src/vt/topos/mapping/seed/seed.h b/src/vt/topos/mapping/seed/seed.h index 7b48274304..87f9db37de 100644 --- a/src/vt/topos/mapping/seed/seed.h +++ b/src/vt/topos/mapping/seed/seed.h @@ -52,7 +52,7 @@ namespace vt { namespace mapping { CoreType randomSeedMapCore(SeedType seed, CoreType ncores); -NodeType randomSeedMapNode(SeedType seed, NodeType nnodes); +NodeT randomSeedMapNode(SeedType seed, NodeT nnodes); }} /* end namespace vt::mapping */ diff --git a/src/vt/trace/trace.cc b/src/vt/trace/trace.cc index 885fc450ca..826744e13a 100644 --- a/src/vt/trace/trace.cc +++ b/src/vt/trace/trace.cc @@ -230,7 +230,7 @@ void Trace::addUserEvent(UserEventIDType event) { auto const type = TraceConstantsType::UserEvent; auto const time = getCurrentTime(); - NodeType const node = theContext()->getNode(); + auto const node = theContext()->getNode(); logEvent( LogType{time, type, node, event, true} @@ -248,7 +248,7 @@ void Trace::addUserEventManual(UserSpecEventIDType event) { event ); - auto id = user_event_.createEvent(true, false, 0, event); + auto id = user_event_.createEvent(true, false, NodeT{0}, event); addUserEvent(id); } @@ -265,7 +265,7 @@ void Trace::addUserEventBracketedBegin(UserEventIDType event) { auto const type = TraceConstantsType::BeginUserEventPair; auto const time = getCurrentTime(); - NodeType const node = theContext()->getNode(); + auto const node = theContext()->getNode(); logEvent( LogType{time, type, node, event, true} @@ -285,7 +285,7 @@ void Trace::addUserEventBracketedEnd(UserEventIDType event) { auto const type = TraceConstantsType::EndUserEventPair; auto const time = getCurrentTime(); - NodeType const node = theContext()->getNode(); + auto const node = theContext()->getNode(); logEvent( LogType{time, type, node, event, true} @@ -297,7 +297,7 @@ void Trace::addUserEventBracketedManualBegin(UserSpecEventIDType event) { return; } - auto id = user_event_.createEvent(true, false, 0, event); + auto id = user_event_.createEvent(true, false, NodeT{0}, event); addUserEventBracketedBegin(id); } @@ -306,7 +306,7 @@ void Trace::addUserEventBracketedManualEnd(UserSpecEventIDType event) { return; } - auto id = user_event_.createEvent(true, false, 0, event); + auto id = user_event_.createEvent(true, false, NodeT{0}, event); addUserEventBracketedEnd(id); } @@ -323,7 +323,7 @@ void Trace::addUserEventBracketedManual( event, begin, end ); - auto id = user_event_.createEvent(true, false, 0, event); + auto id = user_event_.createEvent(true, false, NodeT{0}, event); addUserEventBracketed(id, begin, end); } @@ -334,7 +334,7 @@ void Trace::addMemoryEvent(std::size_t memory, double time) { TraceProcessingTag Trace::beginProcessing( TraceEntryIDType const ep, TraceMsgLenType const len, - TraceEventIDType const event, NodeType const from_node, + TraceEventIDType const event, NodeT const from_node, TimeType const time, uint64_t const idx1, uint64_t const idx2, uint64_t const idx3, uint64_t const idx4 @@ -449,7 +449,7 @@ void Trace::endSchedulerLoop() { // Start an event representing time outside of top-level scheduler. if (event_holds_.size() == 1) { between_sched_event_ = beginProcessing( - between_sched_event_type_, 0, trace::no_trace_event, 0, timing::getCurrentTime() + between_sched_event_type_, 0, trace::no_trace_event, NodeT{0}, timing::getCurrentTime() ); } } @@ -462,7 +462,7 @@ TraceEventIDType Trace::messageCreation( } auto const type = TraceConstantsType::Creation; - NodeType const node = theContext()->getNode(); + auto const node = theContext()->getNode(); return logEvent( LogType{time, ep, type, node, len} @@ -477,7 +477,7 @@ TraceEventIDType Trace::messageCreationBcast( } auto const type = TraceConstantsType::CreationBcast; - NodeType const node = theContext()->getNode(); + auto const node = theContext()->getNode(); return logEvent( LogType{time, ep, type, node, len} @@ -486,14 +486,14 @@ TraceEventIDType Trace::messageCreationBcast( TraceEventIDType Trace::messageRecv( TraceEntryIDType const ep, TraceMsgLenType const len, - NodeType const from_node, double const time + NodeT const from_node, double const time ) { if (not checkDynamicRuntimeEnabled()) { return no_trace_event; } auto const type = TraceConstantsType::MessageRecv; - NodeType const node = theContext()->getNode(); + auto const node = theContext()->getNode(); return logEvent( LogType{time, ep, type, node, len} diff --git a/src/vt/trace/trace.h b/src/vt/trace/trace.h index 31fe8b6c8b..85c745d89a 100644 --- a/src/vt/trace/trace.h +++ b/src/vt/trace/trace.h @@ -44,6 +44,7 @@ #if !defined INCLUDED_VT_TRACE_TRACE_H #define INCLUDED_VT_TRACE_TRACE_H +#include "vt/configs/types/types_node.h" #include "vt/trace/trace_common.h" #include "vt/trace/trace_containers.h" #include "vt/trace/trace_log.h" @@ -146,7 +147,7 @@ struct Trace : runtime::component::Component, TraceLite { */ TraceProcessingTag beginProcessing( TraceEntryIDType const ep, TraceMsgLenType const len, - TraceEventIDType const event, NodeType const from_node, + TraceEventIDType const event, ::vt::NodeT const from_node, TimeType const time, uint64_t const idx1 = 0, uint64_t const idx2 = 0, uint64_t const idx3 = 0, uint64_t const idx4 = 0 @@ -338,7 +339,7 @@ struct Trace : runtime::component::Component, TraceLite { */ TraceEventIDType messageRecv( TraceEntryIDType const ep, TraceMsgLenType const len, - NodeType const from_node, double const time = getCurrentTime() + ::vt::NodeT const from_node, double const time = getCurrentTime() ); /** diff --git a/src/vt/trace/trace_common.h b/src/vt/trace/trace_common.h index c681e15c45..83617abff8 100644 --- a/src/vt/trace/trace_common.h +++ b/src/vt/trace/trace_common.h @@ -45,6 +45,7 @@ #define INCLUDED_VT_TRACE_TRACE_COMMON_H #include "vt/configs/types/types_type.h" +#include "vt/configs/types/types_node.h" #include #include @@ -68,7 +69,7 @@ static constexpr TraceEventIDType const no_trace_event = 0; static constexpr BitCountType const trace_event_num_bits = 32; static constexpr UserEventIDType const no_user_event_id = 0; -static constexpr NodeType const designated_root_node = 0; +static constexpr NodeT const designated_root_node = NodeT{0}; }} //end namespace vt::trace diff --git a/src/vt/trace/trace_lite.cc b/src/vt/trace/trace_lite.cc index 3e134bf91c..3da698c9d8 100644 --- a/src/vt/trace/trace_lite.cc +++ b/src/vt/trace/trace_lite.cc @@ -259,7 +259,7 @@ void TraceLite::addUserEventBracketed( event, begin, end); auto const type = TraceConstantsType::UserEventPair; - NodeType const node = theContext()->getNode(); + NodeT const node = theContext()->getNode(); logEvent(LogType{begin, type, node, event, true}); logEvent(LogType{end, type, node, event, false}); @@ -363,7 +363,7 @@ void TraceLite::beginIdle(double const time) { ); auto const type = TraceConstantsType::BeginIdle; - NodeType const node = theContext()->getNode(); + NodeT const node = theContext()->getNode(); emitTraceForTopProcessingEvent(time, TraceConstantsType::EndProcessing); logEvent(LogType{time, type, node}); @@ -385,7 +385,7 @@ void TraceLite::endIdle(double const time) { ); auto const type = TraceConstantsType::EndIdle; - NodeType const node = theContext()->getNode(); + NodeT const node = theContext()->getNode(); idle_begun_ = false; // must set BEFORE logEvent logEvent(LogType{time, type, node}); @@ -399,14 +399,14 @@ void TraceLite::emitTraceForTopProcessingEvent( } } -/*static*/ bool TraceLite::traceWritingEnabled(NodeType node) { +/*static*/ bool TraceLite::traceWritingEnabled(::vt::NodeT node) { return ( theConfig()->vt_trace and (theConfig()->vt_trace_mod == 0 or (node % theConfig()->vt_trace_mod == 0))); } -/*static*/ bool TraceLite::isStsOutputNode(NodeType node) { +/*static*/ bool TraceLite::isStsOutputNode(::vt::NodeT node) { return (theConfig()->vt_trace and node == designated_root_node); } @@ -713,7 +713,7 @@ void TraceLite::outputControlFile(std::ofstream& file) { } /*static*/ void TraceLite::outputHeader( - vt_gzFile* file, NodeType const node, double const start) { + vt_gzFile* file, ::vt::NodeT const node, double const start) { gzFile gzfile = file->file_type; // Output header for projections file // '6' means COMPUTATION_BEGIN to Projections: this starts a trace @@ -722,7 +722,7 @@ void TraceLite::outputControlFile(std::ofstream& file) { } /*static*/ void TraceLite::outputFooter( - vt_gzFile* file, NodeType const node, double const start) { + vt_gzFile* file, ::vt::NodeT const node, double const start) { gzFile gzfile = file->file_type; // Output footer for projections file, // '7' means COMPUTATION_END to Projections diff --git a/src/vt/trace/trace_lite.h b/src/vt/trace/trace_lite.h index 7ed64ba559..3e5e8e9ba9 100644 --- a/src/vt/trace/trace_lite.h +++ b/src/vt/trace/trace_lite.h @@ -286,7 +286,7 @@ struct TraceLite { * \param[in] start the start time */ static void outputHeader( - vt_gzFile* file, NodeType const node, double const start + vt_gzFile* file, ::vt::NodeT const node, double const start ); /** @@ -297,7 +297,7 @@ struct TraceLite { * \param[in] start the start time */ static void outputFooter( - vt_gzFile* file, NodeType const node, double const start + vt_gzFile* file, ::vt::NodeT const node, double const start ); /** @@ -322,7 +322,7 @@ struct TraceLite { * * \return whether it is enabled */ - static bool traceWritingEnabled(NodeType node); + static bool traceWritingEnabled(::vt::NodeT node); /** * \brief Check if a node will output the sts file @@ -331,7 +331,7 @@ struct TraceLite { * * \return whether it will output */ - static bool isStsOutputNode(NodeType node); + static bool isStsOutputNode(::vt::NodeT node); /** * \brief Log an event, returning a trace event ID if accepted diff --git a/src/vt/trace/trace_log.h b/src/vt/trace/trace_log.h index c9973e7aeb..41beb1c8b3 100644 --- a/src/vt/trace/trace_log.h +++ b/src/vt/trace/trace_log.h @@ -267,7 +267,7 @@ struct Log final { // User event Log( double const in_time, TraceConstantsType const in_type, - NodeType in_node, + NodeT in_node, UserEventIDType in_user_event, bool in_user_start ) : time(in_time), type(in_type), node(in_node), @@ -278,7 +278,7 @@ struct Log final { // Used for idle Log( double const in_time, TraceConstantsType const in_type, - NodeType in_node + NodeT in_node ) : time(in_time), type(in_type), node(in_node), data(Data::SysData{0}) @@ -288,7 +288,7 @@ struct Log final { // Used for messages Log( double const in_time, TraceEntryIDType const in_ep, TraceConstantsType const in_type, - NodeType in_node, + NodeT in_node, TraceMsgLenType const in_msg_len ) : time(in_time), type(in_type), ep(in_ep), node(in_node), @@ -308,7 +308,7 @@ struct Log final { Log( double in_time, TraceEntryIDType in_ep, TraceConstantsType in_type, - TraceEventIDType in_event, TraceMsgLenType in_msg_len, NodeType in_node, + TraceEventIDType in_event, TraceMsgLenType in_msg_len, NodeT in_node, uint64_t in_idx1, uint64_t in_idx2, uint64_t in_idx3, uint64_t in_idx4 ) : time(in_time), type(in_type), ep(in_ep), event(in_event), node(in_node), @@ -359,7 +359,7 @@ struct Log final { TraceEntryIDType ep = no_trace_entry_id; TraceEventIDType event = no_trace_event; // If the event relates to a DIFFERENT node. - NodeType node = uninitialized_destination; + NodeT node = {}; private: diff --git a/src/vt/trace/trace_user_event.cc b/src/vt/trace/trace_user_event.cc index 483f0dec80..3870c2888c 100644 --- a/src/vt/trace/trace_user_event.cc +++ b/src/vt/trace/trace_user_event.cc @@ -55,11 +55,11 @@ namespace vt { namespace trace { UserEventIDType UserEventRegistry::createEvent( - bool user, bool rooted, NodeType in_node, UserSpecEventIDType id, + bool user, bool rooted, ::vt::NodeT in_node, UserSpecEventIDType id, bool hash ) { - constexpr NodeType const default_node = 0; - NodeType const node = rooted ? in_node : default_node; + constexpr NodeT const default_node = NodeT {0}; + NodeT const node = rooted ? in_node : default_node; UserEventIDType event = no_user_event_id; BitPackerType::boolSetField(event, user); BitPackerType::boolSetField(event, rooted); @@ -85,9 +85,9 @@ UserEventIDType UserEventRegistry::hash(std::string const& in_event_name) { auto inserted = std::get<1>(ret); if (inserted) { auto const node = theContext()->getNode(); - if (node != 0) { + if (node != NodeT{0}) { auto msg = makeMessage(false, id, in_event_name); - theMsg()->sendMsg(0, msg); + theMsg()->sendMsg(NodeT{0}, msg); } } return id; @@ -97,9 +97,9 @@ UserEventIDType UserEventRegistry::rooted(std::string const& in_event_name) { auto ret = newEventImpl(false, true, in_event_name, cur_root_event_++); auto id = std::get<0>(ret); auto const node = theContext()->getNode(); - if (node != 0) { + if (node != NodeT{0}) { auto msg = makeMessage(false, id, in_event_name); - theMsg()->sendMsg(0, msg); + theMsg()->sendMsg(NodeT{0}, msg); } return id; } @@ -110,9 +110,9 @@ UserEventIDType UserEventRegistry::user( auto ret = newEventImpl(true, false, in_event_name, seq); auto id = std::get<0>(ret); auto const node = theContext()->getNode(); - if (node != 0) { + if (node != NodeT{0}) { auto msg = makeMessage(true, id, in_event_name); - theMsg()->sendMsg(0, msg); + theMsg()->sendMsg(NodeT{0}, msg); } return id; } diff --git a/src/vt/trace/trace_user_event.h b/src/vt/trace/trace_user_event.h index 9c90c1dfca..ae3486ceb9 100644 --- a/src/vt/trace/trace_user_event.h +++ b/src/vt/trace/trace_user_event.h @@ -65,7 +65,7 @@ static constexpr BitCountType const user_bits = BitCounterType: static constexpr BitCountType const root_bits = 1; static constexpr BitCountType const manu_bits = 1; static constexpr BitCountType const hash_bits = 1; -static constexpr BitCountType const node_bits = BitCounterType::value; +static constexpr BitCountType const node_bits = BitCounterType ::value; static constexpr BitCountType const spec_bits = user_bits - (root_bits + node_bits); enum eUserEventLayoutBits { @@ -73,7 +73,7 @@ enum eUserEventLayoutBits { Root = eUserEventLayoutBits::Manu + manu_bits, Hash = eUserEventLayoutBits::Root + root_bits, Node = eUserEventLayoutBits::Hash + hash_bits, - ID = eUserEventLayoutBits::Node + node_bits + ID = eUserEventLayoutBits::Node + node_bits }; void insertNewUserEvent(UserEventIDType event, std::string const& name); @@ -104,7 +104,7 @@ struct UserEventRegistry { #endif UserEventIDType createEvent( - bool user, bool rooted, NodeType in_node, UserSpecEventIDType id, + bool user, bool rooted, ::vt::NodeT in_node, UserSpecEventIDType id, bool hash = false ); UserEventIDType collective(std::string const& in_event_name); diff --git a/src/vt/utils/file_spec/spec.h b/src/vt/utils/file_spec/spec.h index 2f5ce1ee01..13041e3649 100644 --- a/src/vt/utils/file_spec/spec.h +++ b/src/vt/utils/file_spec/spec.h @@ -232,7 +232,7 @@ struct FileSpec { vt_msg_serialize_required(); // for SpecMapType SpecMsg() = default; - SpecMsg(SpecMapType in_mod, SpecMapType in_exact, NodeType in_root) + SpecMsg(SpecMapType in_mod, SpecMapType in_exact, NodeT in_root) : spec_mod_(in_mod), spec_exact_(in_exact), root_(in_root) @@ -248,7 +248,7 @@ struct FileSpec { SpecMapType spec_mod_; SpecMapType spec_exact_; - NodeType root_ = uninitialized_destination; + NodeT root_ = {}; }; /** diff --git a/src/vt/utils/strong/strong_type.h b/src/vt/utils/strong/strong_type.h index 5088b5928e..42ed57df72 100644 --- a/src/vt/utils/strong/strong_type.h +++ b/src/vt/utils/strong/strong_type.h @@ -46,6 +46,7 @@ #include #include +#include namespace vt { namespace util { namespace strong { namespace detail { @@ -71,12 +72,30 @@ struct Strong { constexpr Strong() = default; /** - * \brief Construct with a explicit initial value + * \brief Construct with a explicit initial value for non-arithmetic types * * \param[in] v the value */ + template < + typename U = T, + typename std::enable_if_t::value, int> = 0> explicit constexpr Strong(T v) : v_(v) { } + /** + * \brief Construct with a explicit initial value for arithmetic types + * + * \param[in] v the value + */ + template < + typename Integral, + typename std::enable_if_t< + std::is_arithmetic::value && + std::is_convertible::value, + int + > = 0 + > + explicit constexpr Strong(Integral v) : v_(static_cast(v)) { } + /** * \brief Equal operator * @@ -131,6 +150,78 @@ struct Strong { return v_ >= in.v_; } + /** + * \brief Addition assignment operator + * + * \param[in] in the other value + */ + ThisType& operator+=(const ThisType& in) { + v_ += in.v_; + return *this; + } + + /** + * \brief Addition operator + * + * \param[in] in the other value + */ + ThisType operator+(const ThisType& in) const { + return ThisType{v_ + in.v_}; + } + + /** + * \brief Subtraction operator + * + * \param[in] in the other value + */ + ThisType operator-(const ThisType& in) const { + return ThisType{v_ - in.v_}; + } + + /** + * \brief Modulo operator + * + * \param[in] in the other value + */ + ThisType operator%(const ThisType& in) const { + return ThisType{v_ % in.v_}; + } + + /** + * \brief Multiplication operator + * + * \param[in] in the other value + */ + ThisType operator*(const ThisType& in) const { + return ThisType{v_ * in.v_}; + } + + /** + * \brief Division operator + * + * \param[in] in the other value + */ + ThisType operator/(const ThisType& in) const { + return ThisType{v_ / in.v_}; + } + + /** + * \brief Pre-increment operator + */ + ThisType& operator++() { + ++v_; + return *this; + } + + /** + * \brief Post-increment operator + */ + ThisType operator++(int) { + ThisType tmp{*this}; + ++v_; + return tmp; + } + /** * \brief Dereference the value as a reference * @@ -145,6 +236,7 @@ struct Strong { */ T const& operator*() const { return v_; } + operator T() const { return v_; } /** * \brief Get reference * diff --git a/src/vt/vrt/collection/balance/baselb/baselb.cc b/src/vt/vrt/collection/balance/baselb/baselb.cc index 0a38e01b84..d7d73445c3 100644 --- a/src/vt/vrt/collection/balance/baselb/baselb.cc +++ b/src/vt/vrt/collection/balance/baselb/baselb.cc @@ -135,7 +135,7 @@ std::shared_ptr BaseLB::normalizeReassignments() { proxy_.template reduce>(msg,cb); }); - std::map migrate_other; + std::map migrate_other; // Do local setup of reassignment data structure for (auto&& transfer : transfers_) { @@ -179,7 +179,7 @@ std::shared_ptr BaseLB::normalizeReassignments() { // Notify all potential recipients for this reassignment that they have an // arriving object using DepartMsgType = TransferMsg; - std::map depart_map; + std::map depart_map; for (auto&& departing : pending_reassignment_->depart_) { auto const obj_id = std::get<0>(departing); @@ -235,7 +235,7 @@ void BaseLB::notifyNewHostNodeOfObjectsArriving( } } -void BaseLB::migrateObjectTo(ObjIDType const obj_id, NodeType const to) { +void BaseLB::migrateObjectTo(ObjIDType const obj_id, NodeT const to) { if (obj_id.curr_node != to || theConfig()->vt_lb_self_migration) { transfers_.push_back(TransferDestType{obj_id, to}); } @@ -250,7 +250,7 @@ void BaseLB::finalize(CountMsg* msg) { pending_reassignment_->global_migration_count = global_count; auto const& this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { TimeTypeWrapper const total_time = timing::getCurrentTime() - start_time_; vt_debug_print( terse, lb, diff --git a/src/vt/vrt/collection/balance/baselb/baselb.h b/src/vt/vrt/collection/balance/baselb/baselb.h index c2fd19fa4c..6814938c53 100644 --- a/src/vt/vrt/collection/balance/baselb/baselb.h +++ b/src/vt/vrt/collection/balance/baselb/baselb.h @@ -70,9 +70,9 @@ struct BaseLB { using ObjIDType = balance::ElementIDStruct; using ElementLoadType = std::unordered_map; using ElementCommType = elm::CommMapType; - using TransferDestType = std::tuple; + using TransferDestType = std::tuple; using TransferVecType = std::vector; - using TransferType = std::map; + using TransferType = std::map; using LoadType = double; using MigrationCountCB = std::function; using QuantityType = std::map; @@ -81,7 +81,7 @@ struct BaseLB { using ObjLoadListType = std::vector< std::tuple >; - using ObjDestinationListType = std::vector>; + using ObjDestinationListType = std::vector>; explicit BaseLB(bool in_comm_aware = false) : comm_aware_(in_comm_aware), @@ -131,8 +131,8 @@ struct BaseLB { TransferVecType const& transfers, MigrationCountCB migration_count_callback ); void migrationDone(); - void migrateObjectTo(ObjIDType const obj_id, NodeType const node); - void transferSend(NodeType from, TransferVecType const& transfer); + void migrateObjectTo(ObjIDType const obj_id, NodeT const node); + void transferSend(NodeT from, TransferVecType const& transfer); void transferMigrations(TransferMsg* msg); void finalize(CountMsg* msg); diff --git a/src/vt/vrt/collection/balance/col_lb_data.impl.h b/src/vt/vrt/collection/balance/col_lb_data.impl.h index fe968618d7..bc3d64e27f 100644 --- a/src/vt/vrt/collection/balance/col_lb_data.impl.h +++ b/src/vt/vrt/collection/balance/col_lb_data.impl.h @@ -81,7 +81,7 @@ void CollectionLBData::syncNextPhase(ColT* col, CollectStatsMsg* msg) { idx.push_back(static_cast(col->getIndex()[i])); } - auto migrate = [col](NodeType node){ col->migrate(node); }; + auto migrate = [col](NodeT node){ col->migrate(node); }; theNodeLBData()->registerCollectionInfo(col->elm_id_, proxy, idx, migrate); } diff --git a/src/vt/vrt/collection/balance/greedylb/greedylb.cc b/src/vt/vrt/collection/balance/greedylb/greedylb.cc index 3b8d06f25b..52ad6bd508 100644 --- a/src/vt/vrt/collection/balance/greedylb/greedylb.cc +++ b/src/vt/vrt/collection/balance/greedylb/greedylb.cc @@ -168,7 +168,7 @@ void GreedyLB::loadStats() { this_threshold = std::min(std::max(1.0f - I, min_threshold), max_threshold); } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_debug_print( terse, lb, "loadStats: load={}, total={}, avg={}, I={:.2f}," @@ -220,7 +220,7 @@ void GreedyLB::reduceCollect() { TimeTypeWrapper(this_load_begin / 1000), load_over.size() ); using MsgType = GreedyCollectMsg; - auto cb = vt::theCB()->makeSend(proxy[0]); + auto cb = vt::theCB()->makeSend(proxy[NodeT{0}]); auto msg = makeMessage(load_over,this_load); proxy.template reduce>(msg.get(),cb); } @@ -248,7 +248,7 @@ void GreedyLB::runBalancer( } std::make_heap(recs.begin(), recs.end(), CompRecType()); auto nodes = std::vector{}; - for (NodeType n = 0; n < num_nodes; n++) { + for (NodeT n = NodeT{0}; n < num_nodes; n++) { auto iter = profile.find(n); vtAssert(iter != profile.end(), "Must have load profile"); nodes.emplace_back(GreedyProc{n,iter->second}); @@ -284,7 +284,7 @@ void GreedyLB::runBalancer( } GreedyLB::ObjIDType GreedyLB::objSetNode( - NodeType const& node, ObjIDType const& id + NodeT const& node, ObjIDType const& id ) { auto new_id = id; new_id.curr_node = node; @@ -364,7 +364,7 @@ void GreedyLB::transferObjs(std::vector&& in_load) { max_recs, max_bytes ); theCollective()->scatter( - max_bytes*load.size(),max_bytes,nullptr,[&](NodeType node, void* ptr){ + max_bytes*load.size(),max_bytes,nullptr,[&](NodeT node, void* ptr){ auto ptr_out = reinterpret_cast(ptr); auto const& proc = node_transfer[node]; auto const& rec_size = proc.size(); @@ -375,7 +375,7 @@ void GreedyLB::transferObjs(std::vector&& in_load) { } ); } else if (strat_ == DataDistStrategy::pt2pt) { - for (NodeType n = 0; n < theContext()->getNumNodes(); n++) { + for (NodeT n = NodeT{0}; n < theContext()->getNumNodes(); n++) { vtAssert( node_transfer.size() == static_cast(theContext()->getNumNodes()), "Must contain all nodes" diff --git a/src/vt/vrt/collection/balance/greedylb/greedylb.h b/src/vt/vrt/collection/balance/greedylb/greedylb.h index 1dccca5763..6b368a1c8c 100644 --- a/src/vt/vrt/collection/balance/greedylb/greedylb.h +++ b/src/vt/vrt/collection/balance/greedylb/greedylb.h @@ -73,9 +73,9 @@ enum struct DataDistStrategy : uint8_t { struct GreedyLB : LoadSamplerBaseLB { using ElementLoadType = std::unordered_map; - using TransferType = std::map>; + using TransferType = std::map>; using LoadType = double; - using LoadProfileType = std::unordered_map; + using LoadProfileType = std::unordered_map; GreedyLB() = default; virtual ~GreedyLB() {} @@ -98,7 +98,7 @@ struct GreedyLB : LoadSamplerBaseLB { void loadOverBin(ObjBinType bin, ObjBinListType& bin_list); void runBalancer(ObjSampleType&& objs, LoadProfileType&& profile); void transferObjs(std::vector&& load); - ObjIDType objSetNode(NodeType const& node, ObjIDType const& id); + ObjIDType objSetNode(NodeT const& node, ObjIDType const& id); void recvObjsDirect(std::size_t len, GreedyLBTypes::ObjIDType* objs); void recvObjs(GreedySendMsg* msg); void recvObjsBcast(GreedyBcastMsg* msg); diff --git a/src/vt/vrt/collection/balance/greedylb/greedylb_constants.h b/src/vt/vrt/collection/balance/greedylb/greedylb_constants.h index f19304cf3d..dc49209903 100644 --- a/src/vt/vrt/collection/balance/greedylb/greedylb_constants.h +++ b/src/vt/vrt/collection/balance/greedylb/greedylb_constants.h @@ -48,7 +48,7 @@ namespace vt { namespace vrt { namespace collection { namespace lb { -static constexpr NodeType const greedy_root = 0; +static constexpr NodeT const greedy_root = NodeT{0}; static constexpr int32_t const greedy_bin_size = 10; static constexpr bool const greedy_auto_threshold_p = true; static constexpr double const greedy_tolerance = 0.03f; diff --git a/src/vt/vrt/collection/balance/greedylb/greedylb_types.h b/src/vt/vrt/collection/balance/greedylb/greedylb_types.h index 3e3f034faf..aa899887d9 100644 --- a/src/vt/vrt/collection/balance/greedylb/greedylb_types.h +++ b/src/vt/vrt/collection/balance/greedylb/greedylb_types.h @@ -60,7 +60,7 @@ struct GreedyLBTypes { using ObjBinListType = std::list; using ObjSampleType = std::map; using LoadType = double; - using LoadProfileType = std::unordered_map; + using LoadProfileType = std::unordered_map; }; struct GreedyRecord { @@ -75,19 +75,19 @@ struct GreedyRecord { ObjType getObj() const { return obj_; } private: - GreedyLBTypes::ObjIDType obj_ = { elm::no_element_id, uninitialized_destination }; + GreedyLBTypes::ObjIDType obj_ = { elm::no_element_id, NodeT {} }; LoadType load_ = 0.0f; }; struct GreedyProc { GreedyProc() = default; GreedyProc( - NodeType const& in_node, GreedyLBTypes::LoadType const& in_load + NodeT const& in_node, GreedyLBTypes::LoadType const& in_load ) : node_(in_node), load_(in_load) {} GreedyLBTypes::LoadType getModeledLoad() const { return load_; } - NodeType node_ = uninitialized_destination; + NodeT node_ = {}; GreedyLBTypes::LoadType load_ = 0.0f; std::vector recs_; }; diff --git a/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc b/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc index 0d0fae47dc..2b99fe4be2 100644 --- a/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc +++ b/src/vt/vrt/collection/balance/hierarchicallb/hierlb.cc @@ -170,8 +170,8 @@ void HierarchicalLB::setupTree(TimeTypeWrapper const threshold) { threshold ); - for (NodeType node = 0; node < hierlb_nary; node++) { - NodeType const child = this_node * hierlb_nary + node + 1; + for (NodeT node = NodeT{0}; node < hierlb_nary; node++) { + NodeT const child = this_node * hierlb_nary + node + NodeT{1}; if (child < num_nodes) { auto child_iter = children.find(child); vtAssert(child_iter == children.end(), "Child must not exist"); @@ -194,12 +194,12 @@ void HierarchicalLB::setupTree(TimeTypeWrapper const threshold) { ); if (children.size() == 0) { - for (NodeType node = 0; node < hierlb_nary; node++) { - NodeType factor = num_nodes / hierlb_nary * hierlb_nary; + for (NodeT node = NodeT{0}; node < hierlb_nary; node++) { + NodeT factor = num_nodes / hierlb_nary * hierlb_nary; if (factor < num_nodes) { factor += hierlb_nary; } - NodeType const child = (this_node * hierlb_nary + node + 1) - factor - 1; + NodeT const child = (this_node * hierlb_nary + node + NodeT{1}) - factor - NodeT{1}; if (child < num_nodes && child >= 0) { children.emplace( std::piecewise_construct, @@ -217,14 +217,14 @@ void HierarchicalLB::setupTree(TimeTypeWrapper const threshold) { } } - parent = (this_node - 1) / hierlb_nary; + parent = (this_node - NodeT{1}) / hierlb_nary; - NodeType factor = num_nodes / hierlb_nary * hierlb_nary; + NodeT factor = num_nodes / hierlb_nary * hierlb_nary; if (factor < num_nodes) { factor += hierlb_nary; } - bottom_parent = ((this_node + 1 + factor) - 1) / hierlb_nary; + bottom_parent = ((this_node + NodeT{1} + factor) - NodeT{1}) / hierlb_nary; vt_debug_print( normal, hierlb, @@ -252,7 +252,7 @@ double HierarchicalLB::getSumLoad() const { } void HierarchicalLB::loadStats() { - auto const& this_node = theContext()->getNode(); + auto const this_node = theContext()->getNode(); auto avg_load = getAvgLoad(); auto total_load = getSumLoad(); auto I = getStats()->at(lb::Statistic::Rank_load_modeled).at( @@ -270,7 +270,7 @@ void HierarchicalLB::loadStats() { this_threshold = std::min(std::max(1.0f - I, min_threshold), max_threshold); } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_debug_print( terse, hierlb, "loadStats: load={}, total={}, avg={}, I={:.2f}," @@ -292,7 +292,7 @@ void HierarchicalLB::loadStats() { calcLoadOver(extract_strategy); lbTreeUpSend( - bottom_parent, this_load, this_node, load_over, 1 + bottom_parent, this_load, this_node, load_over, NodeT{1} ); if (children.size() == 0) { @@ -403,7 +403,7 @@ void HierarchicalLB::startMigrations() { } void HierarchicalLB::downTreeSend( - NodeType const node, NodeType const from, ObjSampleType const& excess, + NodeT const node, NodeT const from, ObjSampleType const& excess, bool const final_child, std::size_t const& approx_size ) { proxy[node].template send( @@ -412,7 +412,7 @@ void HierarchicalLB::downTreeSend( } void HierarchicalLB::downTree( - NodeType const from, ObjSampleType excess_load, bool const final_child + NodeT const from, ObjSampleType excess_load, bool const final_child ) { vt_debug_print( normal, hierlb, @@ -464,8 +464,8 @@ std::size_t HierarchicalLB::getSize(ObjSampleType const& sample) { } void HierarchicalLB::lbTreeUpSend( - NodeType const node, LoadType const child_load, NodeType const child, - ObjSampleType const& load, NodeType const child_size + NodeT const node, LoadType const child_load, NodeT const child, + ObjSampleType const& load, NodeT const child_size ) { proxy[node].template send( child_load, child, load, child_size @@ -473,8 +473,8 @@ void HierarchicalLB::lbTreeUpSend( } void HierarchicalLB::lbTreeUp( - LoadType const child_load, NodeType const child, ObjSampleType load, - NodeType const child_size + LoadType const child_load, NodeT const child, ObjSampleType load, + NodeT const child_size ) { auto const& this_node = theContext()->getNode(); @@ -748,7 +748,7 @@ void HierarchicalLB::distributeAmoungChildren() { } LoadType total_child_load = 0.0; - NodeType total_size = 0; + NodeT total_size = NodeT{0}; for (auto&& child : children) { auto const& node = child.second->node; auto const& node_size = child.second->node_size; @@ -762,7 +762,7 @@ void HierarchicalLB::distributeAmoungChildren() { ); if (is_live) { total_child_load += load; - total_size += node_size; + total_size += NodeT{node_size}; } } diff --git a/src/vt/vrt/collection/balance/hierarchicallb/hierlb.h b/src/vt/vrt/collection/balance/hierarchicallb/hierlb.h index e3f0dc82df..7f52e78760 100644 --- a/src/vt/vrt/collection/balance/hierarchicallb/hierlb.h +++ b/src/vt/vrt/collection/balance/hierarchicallb/hierlb.h @@ -64,9 +64,9 @@ namespace vt { namespace vrt { namespace collection { namespace lb { struct HierarchicalLB : LoadSamplerBaseLB { using ChildPtrType = std::unique_ptr; - using ChildMapType = std::unordered_map; + using ChildMapType = std::unordered_map; using ElementLoadType = std::unordered_map; - using TransferType = std::map>; + using TransferType = std::map>; using LoadType = double; HierarchicalLB() = default; @@ -93,19 +93,19 @@ struct HierarchicalLB : LoadSamplerBaseLB { void setupDone(SetupDoneMsg* msg); void downTreeSend( - NodeType const node, NodeType const from, ObjSampleType const& excess, + NodeT const node, NodeT const from, ObjSampleType const& excess, bool const final_child, std::size_t const& approx_size ); void lbTreeUpSend( - NodeType const node, LoadType const child_load, NodeType const child, - ObjSampleType const& load, NodeType const child_size + NodeT const node, LoadType const child_load, NodeT const child, + ObjSampleType const& load, NodeT const child_size ); void downTree( - NodeType const from, ObjSampleType excess, bool const final_child + NodeT const from, ObjSampleType excess, bool const final_child ); void lbTreeUp( - LoadType const child_load, NodeType const child, ObjSampleType load, - NodeType const child_size + LoadType const child_load, NodeT const child, ObjSampleType load, + NodeT const child_size ); void sendDownTree(); @@ -123,9 +123,9 @@ struct HierarchicalLB : LoadSamplerBaseLB { private: double this_threshold = 0.0f; bool tree_setup = false; - NodeType parent = uninitialized_destination; - NodeType bottom_parent = uninitialized_destination; - NodeType agg_node_size = 0, child_msgs = 0; + NodeT parent = {}; + NodeT bottom_parent = {}; + NodeT agg_node_size = NodeT{0}, child_msgs = NodeT{0}; ChildMapType children; LoadType this_load_begin = 0.0f; ObjSampleType load_over, given_objs, taken_objs; diff --git a/src/vt/vrt/collection/balance/hierarchicallb/hierlb_child.h b/src/vt/vrt/collection/balance/hierarchicallb/hierlb_child.h index 74a2d26dcc..3526e08f02 100644 --- a/src/vt/vrt/collection/balance/hierarchicallb/hierlb_child.h +++ b/src/vt/vrt/collection/balance/hierarchicallb/hierlb_child.h @@ -57,7 +57,7 @@ struct HierLBChild : HierLBTypes { bool is_live = false; double cur_load = 0.0; int32_t node_size = 0; - NodeType node = uninitialized_destination; + NodeT node = {}; bool final_child = false; std::size_t recs_size = 0; ObjSampleType recs; diff --git a/src/vt/vrt/collection/balance/hierarchicallb/hierlb_constants.h b/src/vt/vrt/collection/balance/hierarchicallb/hierlb_constants.h index 931d5fabb4..4f720df07d 100644 --- a/src/vt/vrt/collection/balance/hierarchicallb/hierlb_constants.h +++ b/src/vt/vrt/collection/balance/hierarchicallb/hierlb_constants.h @@ -50,8 +50,8 @@ namespace vt { namespace vrt { namespace collection { namespace lb { static constexpr double const hierlb_threshold_p = 0.8f; static constexpr double const hierlb_max_threshold_p = 1.004f; -static constexpr NodeType const hierlb_nary = 2; -static constexpr NodeType const hierlb_root = 0; +static constexpr NodeT const hierlb_nary = NodeT{2}; +static constexpr NodeT const hierlb_root = NodeT{0}; static constexpr int32_t const hierlb_bin_size = 10; static constexpr double const hierlb_no_load_sentinel = -1.0f; static constexpr double const hierlb_tolerance = 0.03f; diff --git a/src/vt/vrt/collection/balance/hierarchicallb/hierlb_msgs.h b/src/vt/vrt/collection/balance/hierarchicallb/hierlb_msgs.h index 44ea281813..54d2856e04 100644 --- a/src/vt/vrt/collection/balance/hierarchicallb/hierlb_msgs.h +++ b/src/vt/vrt/collection/balance/hierarchicallb/hierlb_msgs.h @@ -60,8 +60,8 @@ struct LBTreeUpMsg : HierLBTypes, ::vt::Message { LBTreeUpMsg() = default; LBTreeUpMsg( - LoadType const in_child_load, NodeType const in_child, - ObjSampleType in_load, NodeType const in_child_size + LoadType const in_child_load, NodeT const in_child, + ObjSampleType in_load, NodeT const in_child_size ) : child_load_(in_child_load), child_(in_child), load_(in_load), child_size_(in_child_size) { } @@ -73,16 +73,16 @@ struct LBTreeUpMsg : HierLBTypes, ::vt::Message { } LoadType getChildLoad() const { return child_load_; } - NodeType getChild() const { return child_; } + NodeT getChild() const { return child_; } ObjSampleType const& getModeledLoad() const { return load_; } ObjSampleType&& getLoadMove() { return std::move(load_); } - NodeType getChildSize() const { return child_size_; } + NodeT getChildSize() const { return child_size_; } private: LoadType child_load_ = 0.0f; - NodeType child_ = uninitialized_destination; + NodeT child_ = {}; ObjSampleType load_; - NodeType child_size_ = 0; + NodeT child_size_ = NodeT{0}; }; struct LBTreeDownMsg : HierLBTypes, ::vt::Message { @@ -93,7 +93,7 @@ struct LBTreeDownMsg : HierLBTypes, ::vt::Message { LBTreeDownMsg() = default; LBTreeDownMsg( - NodeType const in_from, ObjSampleType in_excess, bool const in_final_child + NodeT const in_from, ObjSampleType in_excess, bool const in_final_child ) : from_(in_from), excess_(in_excess), final_child_(in_final_child) { } @@ -103,13 +103,13 @@ struct LBTreeDownMsg : HierLBTypes, ::vt::Message { s | from_ | excess_ | final_child_; } - NodeType getFrom() const { return from_; } + NodeT getFrom() const { return from_; } ObjSampleType const& getExcess() const { return excess_; } ObjSampleType&& getExcessMove() { return std::move(excess_); } bool getFinalChild() const { return final_child_; } private: - NodeType from_ = uninitialized_destination; + NodeT from_ = {}; ObjSampleType excess_; bool final_child_ = 0; }; diff --git a/src/vt/vrt/collection/balance/lb_common.h b/src/vt/vrt/collection/balance/lb_common.h index d0922fb9e5..cbc2d4b1ee 100644 --- a/src/vt/vrt/collection/balance/lb_common.h +++ b/src/vt/vrt/collection/balance/lb_common.h @@ -117,11 +117,11 @@ using SubphaseLoadMapType = std::unordered_map depart_; + std::unordered_map depart_; std::unordered_map< ElementIDStruct, std::tuple > arrive_; diff --git a/src/vt/vrt/collection/balance/lb_data_holder.cc b/src/vt/vrt/collection/balance/lb_data_holder.cc index 8706a15a5f..3705c2b731 100644 --- a/src/vt/vrt/collection/balance/lb_data_holder.cc +++ b/src/vt/vrt/collection/balance/lb_data_holder.cc @@ -51,7 +51,7 @@ namespace vt { namespace vrt { namespace collection { namespace balance { void LBDataHolder::outputEntity(nlohmann::json& j, ElementIDStruct const& id) const { j["type"] = "object"; j["id"] = id.id; - j["home"] = id.getHomeNode(); + j["home"] = id.getHomeNode().get(); j["migratable"] = id.isMigratable(); if (node_idx_.find(id) != node_idx_.end()) { auto const& proxy_id = std::get<0>(node_idx_.find(id)->second); @@ -80,7 +80,7 @@ std::unique_ptr LBDataHolder::toJson(PhaseType phase) const { ElementIDStruct id = elm.first; TimeType time = elm.second.whole_phase_load; j["tasks"][i]["resource"] = "cpu"; - j["tasks"][i]["node"] = id.getCurrNode(); + j["tasks"][i]["node"] = id.getCurrNode().get(); j["tasks"][i]["time"] = time; if (user_defined_json_.find(phase) != user_defined_json_.end()) { auto &user_def_this_phase = user_defined_json_.at(phase); @@ -126,12 +126,12 @@ std::unique_ptr LBDataHolder::toJson(PhaseType phase) const { outputEntity(j["communications"][i]["to"], key.toObj()); break; } - case elm::CommCategory::NodeToCollection: - case elm::CommCategory::NodeToCollectionBcast: { - if (key.cat_ == elm::CommCategory::NodeToCollection) { - j["communications"][i]["type"] = "NodeToCollection"; + case elm::CommCategory::NodeCollection: + case elm::CommCategory::NodeCollectionBcast: { + if (key.cat_ == elm::CommCategory::NodeCollection) { + j["communications"][i]["type"] = "NodeCollection"; } else { - j["communications"][i]["type"] = "NodeToCollectionBcast"; + j["communications"][i]["type"] = "NodeCollectionBcast"; } j["communications"][i]["from"]["type"] = "node"; @@ -188,7 +188,7 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j) { auto object = task["entity"]["id"]; vtAssertExpr(object.is_number()); - auto elm = ElementIDStruct{object, node}; + auto elm = ElementIDStruct{object, NodeT{node}}; this->node_data_[id][elm].whole_phase_load = time; if ( @@ -257,7 +257,7 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j) { CommVolume vol{bytes, messages}; this->node_comm_[id][key] = vol; } else if ( - type == "NodeToCollection" || type == "NodeToCollectionBcast" + type == "NodeCollection" || type == "NodeCollectionBcast" ) { vtAssertExpr(comm["from"]["type"] == "node"); vtAssertExpr(comm["to"]["type"] == "object"); @@ -271,8 +271,8 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j) { CommKey key( CommKey::NodeToCollectionTag{}, - static_cast(from_node), to_elm, - type == "NodeToCollectionBcast" + static_cast (from_node), to_elm, + type == "NodeCollectionBcast" ); CommVolume vol{bytes, messages}; this->node_comm_[id][key] = vol; @@ -291,7 +291,7 @@ LBDataHolder::LBDataHolder(nlohmann::json const& j) { CommKey key( CommKey::CollectionToNodeTag{}, - from_elm, static_cast(to_node), + from_elm, static_cast (to_node), type == "CollectionToNodeBcast" ); CommVolume vol{bytes, messages}; diff --git a/src/vt/vrt/collection/balance/lb_data_holder.h b/src/vt/vrt/collection/balance/lb_data_holder.h index ad9eeefc45..7f70c7b7b0 100644 --- a/src/vt/vrt/collection/balance/lb_data_holder.h +++ b/src/vt/vrt/collection/balance/lb_data_holder.h @@ -104,17 +104,17 @@ struct LBDataHolder { void outputEntity(nlohmann::json& j, ElementIDStruct const& elm_id) const; public: - /// Node timings for each local object + /// NodeT timings for each local object std::unordered_map node_data_; - /// Node communication graph for each local object + /// NodeT communication graph for each local object std::unordered_map node_comm_; - /// Node communication graph for each subphase + /// NodeT communication graph for each subphase std::unordered_map> node_subphase_comm_; /// User-defined data from each phase std::unordered_map >> user_defined_json_; - /// Node indices for each ID along with the proxy ID + /// NodeT indices for each ID along with the proxy ID std::unordered_map>> node_idx_; /// Map from id to objgroup proxy std::unordered_map node_objgroup_; diff --git a/src/vt/vrt/collection/balance/lb_data_restart_reader.h b/src/vt/vrt/collection/balance/lb_data_restart_reader.h index 54e297e718..8e0aa860be 100644 --- a/src/vt/vrt/collection/balance/lb_data_restart_reader.h +++ b/src/vt/vrt/collection/balance/lb_data_restart_reader.h @@ -173,37 +173,37 @@ struct LBDataRestartReader : runtime::component::Component std::unordered_map> history_; struct DepartMsg : vt::Message { - DepartMsg(NodeType in_depart_node, PhaseType in_phase, ElementIDStruct in_elm) + DepartMsg(NodeT in_depart_node, PhaseType in_phase, ElementIDStruct in_elm) : depart_node(in_depart_node), phase(in_phase), elm(in_elm) { } - NodeType depart_node = uninitialized_destination; + NodeT depart_node = {}; PhaseType phase = no_lb_phase; ElementIDStruct elm; }; struct ArriveMsg : vt::Message { - ArriveMsg(NodeType in_arrive_node, PhaseType in_phase, ElementIDStruct in_elm) + ArriveMsg(NodeT in_arrive_node, PhaseType in_phase, ElementIDStruct in_elm) : arrive_node(in_arrive_node), phase(in_phase), elm(in_elm) { } - NodeType arrive_node = uninitialized_destination; + NodeT arrive_node = {}; PhaseType phase = no_lb_phase; ElementIDStruct elm; }; struct UpdateMsg : vt::Message { - UpdateMsg(NodeType in_curr_node, PhaseType in_phase, ElementIDStruct in_elm) + UpdateMsg(NodeT in_curr_node, PhaseType in_phase, ElementIDStruct in_elm) : curr_node(in_curr_node), phase(in_phase), elm(in_elm) { } - NodeType curr_node = uninitialized_destination; + NodeT curr_node = {}; PhaseType phase = no_lb_phase; ElementIDStruct elm; }; diff --git a/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc b/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc index 22577b6dcf..64e21c3505 100644 --- a/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc +++ b/src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc @@ -285,7 +285,7 @@ void LBManager::startLB( auto const& this_node = theContext()->getNode(); - if (this_node == 0 and not theConfig()->vt_lb_quiet) { + if (this_node == vt::NodeT{0} and not theConfig()->vt_lb_quiet) { vt_debug_print( terse, lb, "LBManager::startLB: phase={}, balancer={}, name={}\n", @@ -729,7 +729,7 @@ bool LBManager::isCollectiveComm(elm::CommCategory cat) const { bool is_collective = cat == elm::CommCategory::Broadcast or cat == elm::CommCategory::CollectionToNodeBcast or - cat == elm::CommCategory::NodeToCollectionBcast; + cat == elm::CommCategory::NodeCollectionBcast; return is_collective; } @@ -744,7 +744,7 @@ void LBManager::createStatisticsFile() { ); auto const dir = theConfig()->vt_lb_statistics_dir; - // Node 0 creates the directory + // NodeT 0 creates the directory if ( theContext()->getNode() == 0 and not dir.empty() and not created_lbstats_dir_ @@ -774,10 +774,10 @@ void LBManager::closeStatisticsFile() { // Go through the comm graph and extract out paired SendRecv edges that are // not self-send and have a non-local edge -std::unordered_map +std::unordered_map getSharedEdges(elm::CommMapType const& comm_data) { auto const this_node = theContext()->getNode(); - std::unordered_map shared_edges; + std::unordered_map shared_edges; vt_debug_print( verbose, lb, "getSharedEdges: comm size={}\n", comm_data.size() diff --git a/src/vt/vrt/collection/balance/node_lb_data.cc b/src/vt/vrt/collection/balance/node_lb_data.cc index 6a5cd55182..aec2dd9348 100644 --- a/src/vt/vrt/collection/balance/node_lb_data.cc +++ b/src/vt/vrt/collection/balance/node_lb_data.cc @@ -80,7 +80,7 @@ bool NodeLBData::hasObjectToMigrate(ElementIDStruct obj_id) const { return iter != node_migrate_.end(); } -bool NodeLBData::migrateObjTo(ElementIDStruct obj_id, NodeType to_node) { +bool NodeLBData::migrateObjTo(ElementIDStruct obj_id, NodeT to_node) { auto iter = node_migrate_.find(obj_id); if (iter == node_migrate_.end()) { return false; @@ -173,7 +173,7 @@ void NodeLBData::createLBDataFile() { ); auto const dir = theConfig()->vt_lb_data_dir; - // Node 0 creates the directory + // NodeT 0 creates the directory if (not created_dir_ and theContext()->getNode() == 0) { int flag = mkdir(dir.c_str(), S_IRWXU); if (flag < 0 && errno != EEXIST) { @@ -204,7 +204,7 @@ void NodeLBData::createLBDataFile() { metadata["shared_node"] = node_metadata; } metadata["type"] = "LBDatafile"; - metadata["rank"] = theContext()->getNode(); + metadata["rank"] = theContext()->getNode().get(); lb_data_writer_ = std::make_unique( "phases", metadata, file_name, compress ); @@ -238,8 +238,8 @@ getRecvSendDirection(elm::CommKeyType const& comm) { case elm::CommCategory::Broadcast: return std::make_pair(comm.toObj().id, comm.fromObj().id); - case elm::CommCategory::NodeToCollection: - case elm::CommCategory::NodeToCollectionBcast: + case elm::CommCategory::NodeCollection: + case elm::CommCategory::NodeCollectionBcast: return std::make_pair(comm.toObj().id, comm.fromNode()); case elm::CommCategory::CollectionToNode: diff --git a/src/vt/vrt/collection/balance/node_lb_data.h b/src/vt/vrt/collection/balance/node_lb_data.h index 5de834e6d3..5732584092 100644 --- a/src/vt/vrt/collection/balance/node_lb_data.h +++ b/src/vt/vrt/collection/balance/node_lb_data.h @@ -79,7 +79,7 @@ namespace vt { namespace vrt { namespace collection { namespace balance { * \c * vt::vrt::collection::balance::LBManager */ struct NodeLBData : runtime::component::Component { - using MigrateFnType = std::function; + using MigrateFnType = std::function; using StorableType = vt::vrt::collection::storage::Storable; /** @@ -214,7 +214,7 @@ struct NodeLBData : runtime::component::Component { * * \return whether this node has the object */ - bool migrateObjTo(ElementIDStruct obj_id, NodeType to_node); + bool migrateObjTo(ElementIDStruct obj_id, NodeT to_node); /** * \internal \brief Get the collection proxy for a given element ID diff --git a/src/vt/vrt/collection/balance/randomlb/randomlb.cc b/src/vt/vrt/collection/balance/randomlb/randomlb.cc index 8607d2703d..da6c13911b 100644 --- a/src/vt/vrt/collection/balance/randomlb/randomlb.cc +++ b/src/vt/vrt/collection/balance/randomlb/randomlb.cc @@ -99,7 +99,7 @@ void RandomLB::runLB(TimeType) { auto const this_node = theContext()->getNode(); auto const num_nodes = static_cast(theContext()->getNumNodes()); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_debug_print( terse, lb, "RandomLB: runLB: randomize_seed={}, seed={}\n", randomize_seed_, seed_ @@ -128,7 +128,7 @@ void RandomLB::runLB(TimeType) { // we skip the first object to be certain we never end up with zero objects for (auto it = ++objs.begin(); it != objs.end(); ++it) { - auto const to_node = dist(gen); + auto const to_node = NodeT{dist(gen)}; if (to_node != this_node) { vt_debug_print( terse, lb, diff --git a/src/vt/vrt/collection/balance/rotatelb/rotatelb.cc b/src/vt/vrt/collection/balance/rotatelb/rotatelb.cc index ad96b90ca2..445cac0a11 100644 --- a/src/vt/vrt/collection/balance/rotatelb/rotatelb.cc +++ b/src/vt/vrt/collection/balance/rotatelb/rotatelb.cc @@ -62,11 +62,13 @@ RotateLB::getInputKeysWithHelp() { void RotateLB::inputParams(balance::ConfigEntry* config) { } void RotateLB::runLB(TimeType) { - auto const& this_node = theContext()->getNode(); - auto const& num_nodes = theContext()->getNumNodes(); - auto const next_node = this_node + 1 > num_nodes-1 ? 0 : this_node + 1; + NodeT const this_node = theContext()->getNode(); + auto const num_nodes = theContext()->getNumNodes(); + auto const next_node = this_node + NodeT{1} > num_nodes - NodeT{1} ? + NodeT{0} : + this_node + NodeT{1}; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_debug_print( terse, lb, "RotateLB: runLB: next_node={}\n", diff --git a/src/vt/vrt/collection/balance/temperedlb/tempered_msgs.h b/src/vt/vrt/collection/balance/temperedlb/tempered_msgs.h index 8fd165ac20..5466f0dfd4 100644 --- a/src/vt/vrt/collection/balance/temperedlb/tempered_msgs.h +++ b/src/vt/vrt/collection/balance/temperedlb/tempered_msgs.h @@ -55,10 +55,10 @@ struct LoadMsg : vt::Message { using MessageParentType = vt::Message; vt_msg_serialize_required(); // node_load_ - using NodeLoadType = std::unordered_map; + using NodeLoadType = std::unordered_map; LoadMsg() = default; - LoadMsg(NodeType in_from_node, NodeLoadType const& in_node_load) + LoadMsg(NodeT in_from_node, NodeLoadType const& in_node_load) : from_node_(in_from_node), node_load_(in_node_load) { } @@ -66,11 +66,11 @@ struct LoadMsg : vt::Message { return node_load_; } - void addNodeLoad(NodeType node, lb::BaseLB::LoadType load) { + void addNodeLoad(NodeT node, lb::BaseLB::LoadType load) { node_load_[node] = load; } - NodeType getFromNode() const { return from_node_; } + NodeT getFromNode() const { return from_node_; } template void serialize(SerializerT& s) { @@ -80,7 +80,7 @@ struct LoadMsg : vt::Message { } private: - NodeType from_node_ = uninitialized_destination; + NodeT from_node_ = {}; NodeLoadType node_load_ = {}; }; @@ -90,7 +90,7 @@ struct LoadMsgAsync : LoadMsg { LoadMsgAsync() = default; LoadMsgAsync( - NodeType in_from_node, NodeLoadType const& in_node_load, int round + NodeT in_from_node, NodeLoadType const& in_node_load, int round ) : LoadMsg(in_from_node, in_node_load), round_(round) { } @@ -120,7 +120,7 @@ struct LazyMigrationMsg : SerializeRequired< using ObjsType = std::unordered_map; LazyMigrationMsg() = default; - LazyMigrationMsg(NodeType in_to_node, ObjsType const& in_objs) + LazyMigrationMsg(NodeT in_to_node, ObjsType const& in_objs) : to_node_(in_to_node), objs_(in_objs) { } @@ -128,7 +128,7 @@ struct LazyMigrationMsg : SerializeRequired< return objs_; } - NodeType getToNode() const { return to_node_; } + NodeT getToNode() const { return to_node_; } template void serialize(SerializerT& s) { @@ -138,7 +138,7 @@ struct LazyMigrationMsg : SerializeRequired< } private: - NodeType to_node_ = uninitialized_destination; + NodeT to_node_ = {}; ObjsType objs_ = {}; }; diff --git a/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc b/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc index 32af5af035..7932749e73 100644 --- a/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc +++ b/src/vt/vrt/collection/balance/temperedlb/temperedlb.cc @@ -306,7 +306,7 @@ void TemperedLB::inputParams(balance::ConfigEntry* config) { "knowledge=UserDefined" ); - auto num_nodes = theContext()->getNumNodes(); + auto num_nodes = theContext()->getNumNodes().get(); if (knowledge_ == KnowledgeEnum::Log) { if (specified_fanout) { // set the rounds based on the chosen fanout: k=log_f(p) @@ -453,7 +453,7 @@ void TemperedLB::runLB(TimeType total_load) { should_lb = max > (run_temperedlb_tolerance + 1.0) * target_max_load_; } - if (theContext()->getNode() == 0) { + if (theContext()->getNode() == NodeT{0}) { vt_debug_print( terse, temperedlb, "TemperedLB::runLB: avg={}, max={}, pole={}, imb={}, load={}, should_lb={}\n", @@ -576,7 +576,7 @@ void TemperedLB::doLBStages(TimeType start_imb) { } } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_debug_print( terse, temperedlb, "TemperedLB::doLBStages: trial={} {} imb={:0.4f}\n", @@ -595,14 +595,14 @@ void TemperedLB::doLBStages(TimeType start_imb) { this_load = this_new_load_ = best_load; new_imbalance_ = best_imb; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_debug_print( terse, temperedlb, "TemperedLB::doLBStages: chose trial={} with imb={:0.4f}\n", best_trial, new_imbalance_ ); } - } else if (this_node == 0) { + } else if (this_node == vt::NodeT{0}) { vt_debug_print( terse, temperedlb, "TemperedLB::doLBStages: rejected all trials because they would increase imbalance\n" @@ -619,7 +619,7 @@ void TemperedLB::loadStatsHandler(StatsMsgType* msg) { new_imbalance_ = in.I(); auto this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_debug_print( terse, temperedlb, "TemperedLB::loadStatsHandler: trial={} iter={} max={} min={} " @@ -643,7 +643,7 @@ void TemperedLB::rejectionStatsHandler(RejectionMsgType* msg) { static_cast(n_rejected + n_transfers) * 100.0; auto this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_debug_print( terse, temperedlb, "TemperedLB::rejectionStatsHandler: n_transfers={} n_rejected={} " @@ -787,7 +787,7 @@ void TemperedLB::propagateRound(uint8_t k_cur, bool sync, EpochType epoch) { auto const this_node = theContext()->getNode(); auto const num_nodes = theContext()->getNumNodes(); - std::uniform_int_distribution dist(0, num_nodes - 1); + std::uniform_int_distribution dist(0, num_nodes.get() - 1); if (!deterministic_) { gen_propagate_.seed(seed_()); @@ -799,7 +799,7 @@ void TemperedLB::propagateRound(uint8_t k_cur, bool sync, EpochType epoch) { selected.insert(this_node); } - auto const fanout = std::min(f_, static_cast(num_nodes - 1)); + auto const fanout = std::min(f_, static_cast(num_nodes.get() - 1)); vt_debug_print( verbose, temperedlb, @@ -815,11 +815,11 @@ void TemperedLB::propagateRound(uint8_t k_cur, bool sync, EpochType epoch) { } // First, randomly select a node - NodeType random_node = uninitialized_destination; + NodeT random_node = {}; // Keep generating until we have a unique node for this round do { - random_node = dist(gen_propagate_); + random_node = NodeT{dist(gen_propagate_)}; } while ( selected.find(random_node) != selected.end() ); @@ -938,7 +938,7 @@ std::vector TemperedLB::createCMF(NodeSetType const& under) { double l_max = 0.0; for (auto&& pe : under) { auto iter = load_info_.find(pe); - vtAssert(iter != load_info_.end(), "Node must be in load_info_"); + vtAssert(iter != load_info_.end(), "NodeT must be in load_info_"); auto load = iter->second; if (load > l_max) { l_max = load; @@ -953,7 +953,7 @@ std::vector TemperedLB::createCMF(NodeSetType const& under) { for (auto&& pe : under) { auto iter = load_info_.find(pe); - vtAssert(iter != load_info_.end(), "Node must be in load_info_"); + vtAssert(iter != load_info_.end(), "NodeT must be in load_info_"); auto load = iter->second; sum_p += 1. - factor * load; @@ -970,7 +970,7 @@ std::vector TemperedLB::createCMF(NodeSetType const& under) { return cmf; } -NodeType TemperedLB::sampleFromCMF( +NodeT TemperedLB::sampleFromCMF( NodeSetType const& under, std::vector const& cmf ) { // Create the distribution @@ -980,7 +980,7 @@ NodeType TemperedLB::sampleFromCMF( gen_sample_.seed(seed_()); } - NodeType selected_node = uninitialized_destination; + NodeT selected_node = {}; // Pick from the CMF auto const u = dist(gen_sample_); @@ -996,8 +996,8 @@ NodeType TemperedLB::sampleFromCMF( return selected_node; } -std::vector TemperedLB::makeUnderloaded() const { - std::vector under = {}; +std::vector TemperedLB::makeUnderloaded() const { + std::vector under = {}; for (auto&& elm : load_info_) { if (isUnderloaded(elm.second)) { under.push_back(elm.first); @@ -1009,10 +1009,10 @@ std::vector TemperedLB::makeUnderloaded() const { return under; } -std::vector TemperedLB::makeSufficientlyUnderloaded( +std::vector TemperedLB::makeSufficientlyUnderloaded( TimeType load_to_accommodate ) const { - std::vector sufficiently_under = {}; + std::vector sufficiently_under = {}; for (auto&& elm : load_info_) { bool eval = Criterion(criterion_)( this_new_load_, elm.second, load_to_accommodate, target_max_load_ @@ -1204,8 +1204,8 @@ void TemperedLB::decide() { int n_transfers = 0, n_rejected = 0; if (is_overloaded_) { - std::vector under = makeUnderloaded(); - std::unordered_map migrate_objs; + std::vector under = makeUnderloaded(); + std::unordered_map migrate_objs; if (under.size() > 0) { std::vector ordered_obj_ids = orderObjects( @@ -1349,7 +1349,7 @@ void TemperedLB::inLazyMigrations(balance::LazyMigrationMsg* msg) { } void TemperedLB::lazyMigrateObjsTo( - EpochType epoch, NodeType node, ObjsType const& objs + EpochType epoch, NodeT node, ObjsType const& objs ) { using LazyMsg = balance::LazyMigrationMsg; auto msg = makeMessage(node, objs); diff --git a/src/vt/vrt/collection/balance/temperedlb/temperedlb.h b/src/vt/vrt/collection/balance/temperedlb/temperedlb.h index 6839ae6eb7..75c5ad2c03 100644 --- a/src/vt/vrt/collection/balance/temperedlb/temperedlb.h +++ b/src/vt/vrt/collection/balance/temperedlb/temperedlb.h @@ -62,7 +62,7 @@ namespace vt { namespace vrt { namespace collection { namespace lb { struct TemperedLB : BaseLB { using LoadMsgAsync = balance::LoadMsgAsync; using LoadMsgSync = balance::LoadMsg; - using NodeSetType = std::vector; + using NodeSetType = std::vector ; using ObjsType = std::unordered_map; using ReduceMsgType = vt::collective::ReduceNoneMsg; using RejectionMsgType = balance::RejectionStatsMsg; @@ -103,9 +103,9 @@ struct TemperedLB : BaseLB { bool isOverloaded(LoadType load) const; std::vector createCMF(NodeSetType const& under); - NodeType sampleFromCMF(NodeSetType const& under, std::vector const& cmf); - std::vector makeUnderloaded() const; - std::vector makeSufficientlyUnderloaded( + NodeT sampleFromCMF(NodeSetType const& under, std::vector const& cmf); + std::vector makeUnderloaded() const; + std::vector makeSufficientlyUnderloaded( LoadType load_to_accommodate ) const; ElementLoadType::iterator selectObject( @@ -113,7 +113,7 @@ struct TemperedLB : BaseLB { ); virtual TimeType getModeledValue(const elm::ElementIDStruct& obj); - void lazyMigrateObjsTo(EpochType epoch, NodeType node, ObjsType const& objs); + void lazyMigrateObjsTo(EpochType epoch, NodeT node, ObjsType const& objs); void inLazyMigrations(balance::LazyMigrationMsg* msg); void loadStatsHandler(StatsMsgType* msg); void rejectionStatsHandler(RejectionMsgType* msg); @@ -159,14 +159,14 @@ struct TemperedLB : BaseLB { */ bool target_pole_ = false; std::random_device seed_; - std::unordered_map load_info_ = {}; - std::unordered_map new_load_info_ = {}; + std::unordered_map load_info_ = {}; + std::unordered_map new_load_info_ = {}; objgroup::proxy::Proxy proxy_ = {}; bool is_overloaded_ = false; bool is_underloaded_ = false; - std::unordered_set selected_ = {}; - std::unordered_set underloaded_ = {}; - std::unordered_set new_underloaded_ = {}; + std::unordered_set selected_ = {}; + std::unordered_set underloaded_ = {}; + std::unordered_set new_underloaded_ = {}; std::unordered_map cur_objs_ = {}; LoadType this_new_load_ = 0.0; TimeType new_imbalance_ = 0.0; diff --git a/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc b/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc index 299c5d7321..277f8813a6 100644 --- a/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc +++ b/src/vt/vrt/collection/balance/zoltanlb/zoltanlb.cc @@ -133,7 +133,7 @@ void ZoltanLB::runLB(TimeType total_load) { auto const& this_node = theContext()->getNode(); this_load = loadMilli(total_load); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_debug_print(terse, lb, "ZoltanLB: runLB: edges={}\n", do_edges_); fflush(stdout); } @@ -200,11 +200,11 @@ void ZoltanLB::runLB(TimeType total_load) { auto const obj_id = export_global_ids[i]; auto iter = load_objs.find( - ObjIDType{obj_id, uninitialized_destination} + ObjIDType{obj_id, NodeT {}} ); vtAssert(iter != load_objs.end(), "Object must exist here"); - migrateObjectTo(*iter, static_cast(to_node)); + migrateObjectTo(*iter, static_cast (to_node)); } Zoltan_LB_Free_Part( @@ -222,7 +222,7 @@ void ZoltanLB::makeGraphSymmetric() { // Go through the comm graph and extract out paired SendRecv edges that are // not self-send and have a non-local edge - std::unordered_map shared_edges; + std::unordered_map shared_edges; for (auto&& elm : *comm_data) { if ( @@ -352,7 +352,7 @@ void ZoltanLB::reduceCount(ReduceMsg* msg) { } void ZoltanLB::allocateShareEdgeGIDs() { - std::unordered_map shared_edges; + std::unordered_map shared_edges; auto const this_node = theContext()->getNode(); for (auto&& elm : load_comm_symm) { diff --git a/src/vt/vrt/collection/collection_builder.impl.h b/src/vt/vrt/collection/collection_builder.impl.h index 28004bd2c7..4ae21d48eb 100644 --- a/src/vt/vrt/collection/collection_builder.impl.h +++ b/src/vt/vrt/collection/collection_builder.impl.h @@ -202,7 +202,7 @@ void CollectionManager::makeCollectionImpl(param::ConstructParams& po) { template void CollectionManager::makeCollectionElement( VirtualProxyType const proxy, typename ColT::IndexType idx, - NodeType const mapped_node, Callable&& cons_fn, bool zero_reduce_stamp + NodeT const mapped_node, Callable&& cons_fn, bool zero_reduce_stamp ) { using IndexType = typename ColT::IndexType; using IdxContextHolder = CollectionContextHolder; @@ -248,7 +248,7 @@ bool CollectionManager::elementMappedHere( } template -NodeType CollectionManager::getElementMapping( +NodeT CollectionManager::getElementMapping( HandlerType map_han, ObjGroupProxyType map_object, IdxT idx, IdxT bounds ) { if (map_han != uninitialized_handler) { @@ -272,7 +272,7 @@ NodeType CollectionManager::getElementMapping( } vtAbort("No valid map fn or object group specified for the collection"); - return uninitialized_destination; + return NodeT{}; } }}} /* end namespace vt::vrt::collection */ diff --git a/src/vt/vrt/collection/collection_info.h b/src/vt/vrt/collection/collection_info.h index 16d062e1e3..ff05c7ba79 100644 --- a/src/vt/vrt/collection/collection_info.h +++ b/src/vt/vrt/collection/collection_info.h @@ -56,7 +56,7 @@ struct CollectionInfo { CollectionInfo(CollectionInfo const&) = default; CollectionInfo( IndexT const& in_range, bool const in_immediate, - NodeType const& in_from_node, VirtualProxyType in_proxy + NodeT const& in_from_node, VirtualProxyType in_proxy ) : immediate_(in_immediate), proxy_(in_proxy), from_node_(in_from_node), range_(in_range) { } @@ -78,7 +78,7 @@ struct CollectionInfo { bool immediate_ = false; VirtualProxyType proxy_ = no_vrt_proxy; VirtualRequestIDType req_id_ = no_request_id; - NodeType from_node_ = uninitialized_destination; + NodeT from_node_ = {}; IndexT range_; EpochType insert_epoch_ = no_epoch; }; diff --git a/src/vt/vrt/collection/defaults/default_map.h b/src/vt/vrt/collection/defaults/default_map.h index af3091f4f2..0e936dfd36 100644 --- a/src/vt/vrt/collection/defaults/default_map.h +++ b/src/vt/vrt/collection/defaults/default_map.h @@ -58,7 +58,7 @@ struct DefaultMapBase { using IndexType = typename CollectionT::IndexType; using BaseType = typename IndexType::DenseIndexType; using IndexPtrType = IndexType*; - using MapParamPackType = std::tuple; + using MapParamPackType = std::tuple; }; template diff --git a/src/vt/vrt/collection/destroy/destroy_msg.h b/src/vt/vrt/collection/destroy/destroy_msg.h index c69d66b25d..9eb9d745ab 100644 --- a/src/vt/vrt/collection/destroy/destroy_msg.h +++ b/src/vt/vrt/collection/destroy/destroy_msg.h @@ -59,12 +59,12 @@ struct DestroyMsg final : ::vt::Message { DestroyMsg() = default; DestroyMsg( CollectionProxyType const& in_proxy, - NodeType const& in_from + NodeT const& in_from ) : proxy_(in_proxy), from_(in_from) { } CollectionProxyType getProxy() const { return proxy_; } - NodeType getFromNode() const { return from_; } + NodeT getFromNode() const { return from_; } template void serialize(Serializer& s) { @@ -73,7 +73,7 @@ struct DestroyMsg final : ::vt::Message { private: CollectionProxyType proxy_; - NodeType from_ = uninitialized_destination; + NodeT from_ = {}; }; }}} /* end namespace vt::vrt::collection */ diff --git a/src/vt/vrt/collection/holders/holder.h b/src/vt/vrt/collection/holders/holder.h index 573350041f..6764ee3ee9 100644 --- a/src/vt/vrt/collection/holders/holder.h +++ b/src/vt/vrt/collection/holders/holder.h @@ -216,14 +216,14 @@ struct Holder { * * \return the group root */ - NodeType groupRoot() const { return group_root_; } + NodeT groupRoot() const { return group_root_; } /** * \brief Set the root of the group * * \param[in] root the root */ - void setGroupRoot(NodeType const root) { group_root_ = root; } + void setGroupRoot(NodeT const root) { group_root_ = root; } /** * \brief Add element-specific listener @@ -249,7 +249,7 @@ struct Holder { * \param[in] home the home node for the element */ void applyListeners( - listener::ElementEventEnum event, IndexT const& idx, NodeType home_node + listener::ElementEventEnum event, IndexT const& idx, NodeT home_node ); friend struct CollectionManager; @@ -262,7 +262,7 @@ struct Holder { GroupType cur_group_ = no_group; bool use_group_ = false; bool group_ready_ = false; - NodeType group_root_ = 0; + NodeT group_root_ = NodeT{0}; CountType num_erased_not_removed_ = 0; std::vector> event_listeners_ = {}; }; diff --git a/src/vt/vrt/collection/holders/holder.impl.h b/src/vt/vrt/collection/holders/holder.impl.h index 9848ac7120..d9a585dd5f 100644 --- a/src/vt/vrt/collection/holders/holder.impl.h +++ b/src/vt/vrt/collection/holders/holder.impl.h @@ -204,7 +204,7 @@ void Holder::removeListener(int element) { template void Holder::applyListeners( - listener::ElementEventEnum event, IndexT const& idx, NodeType home_node + listener::ElementEventEnum event, IndexT const& idx, NodeT home_node ) { for (auto&& l : event_listeners_) { if (l) { diff --git a/src/vt/vrt/collection/insert/insertable.h b/src/vt/vrt/collection/insert/insertable.h index d015a0e5c5..72c02b301b 100644 --- a/src/vt/vrt/collection/insert/insertable.h +++ b/src/vt/vrt/collection/insert/insertable.h @@ -44,6 +44,7 @@ #if !defined INCLUDED_VT_VRT_COLLECTION_INSERT_INSERTABLE_H #define INCLUDED_VT_VRT_COLLECTION_INSERT_INSERTABLE_H +#include "vt/configs/types/types_node.h" #include "vt/config.h" #include "vt/vrt/collection/send/sendable.h" #include "vt/vrt/collection/insert/modify_token.h" @@ -80,7 +81,7 @@ struct ElmInsertable : BaseProxyT { * \param[in] token the modifier token * \param[in] node the node to insert on */ - void insertAt(ModifierToken& token, NodeType node) const; + void insertAt(ModifierToken& token, ::vt::NodeT node) const; /** * \brief Insert a new collection element, calling the constructor that takes @@ -104,7 +105,7 @@ struct ElmInsertable : BaseProxyT { */ template void insertAtMsg( - ModifierToken& token, NodeType node, messaging::MsgPtrThief msg + ModifierToken& token, ::vt::NodeT node, messaging::MsgPtrThief msg ) const; /** diff --git a/src/vt/vrt/collection/insert/insertable.impl.h b/src/vt/vrt/collection/insert/insertable.impl.h index 8ec4dc7b77..881b49da5e 100644 --- a/src/vt/vrt/collection/insert/insertable.impl.h +++ b/src/vt/vrt/collection/insert/insertable.impl.h @@ -69,13 +69,13 @@ void ElmInsertable::insert(ModifierToken& token) const { auto const elm_proxy = this->getElementProxy(); auto const idx = elm_proxy.getIndex(); theCollection()->insert( - col_proxy, idx, uninitialized_destination, token + col_proxy, idx, NodeT {}, token ); } template void ElmInsertable::insertAt( - ModifierToken& token, NodeType node + ModifierToken& token, NodeT node ) const { auto const col_proxy = this->getCollectionProxy(); auto const elm_proxy = this->getElementProxy(); @@ -86,7 +86,7 @@ void ElmInsertable::insertAt( template template void ElmInsertable::insertAtMsg( - ModifierToken& token, NodeType node, messaging::MsgPtrThief msg + ModifierToken& token, NodeT node, messaging::MsgPtrThief msg ) const { MsgSharedPtr msgptr = msg.msg_; auto const col_proxy = this->getCollectionProxy(); @@ -105,7 +105,7 @@ void ElmInsertable::insertMsg( auto const elm_proxy = this->getElementProxy(); auto const idx = elm_proxy.getIndex(); theCollection()->insert( - col_proxy, idx, uninitialized_destination, token, msgptr + col_proxy, idx, NodeT {}, token, msgptr ); } template diff --git a/src/vt/vrt/collection/listener/listen_events.h b/src/vt/vrt/collection/listener/listen_events.h index 1a949e5272..370645287a 100644 --- a/src/vt/vrt/collection/listener/listen_events.h +++ b/src/vt/vrt/collection/listener/listen_events.h @@ -65,7 +65,7 @@ enum struct ElementEventEnum : int8_t { */ template using ListenFnType = std::function< - void(listener::ElementEventEnum event, IndexT idx, NodeType home_node) + void(listener::ElementEventEnum event, IndexT idx, NodeT home_node) >; }}}} /* end namespace vt::vrt::collection::listener */ diff --git a/src/vt/vrt/collection/manager.h b/src/vt/vrt/collection/manager.h index 3dd95b156d..9e047ecede 100644 --- a/src/vt/vrt/collection/manager.h +++ b/src/vt/vrt/collection/manager.h @@ -761,7 +761,7 @@ struct CollectionManager messaging::PendingSend reduceMsg( CollectionProxyWrapType const& proxy, MsgT *const msg, ReduceStamp stamp = ReduceStamp{}, - NodeType root_node = uninitialized_destination + NodeT root_node = {} ); /** @@ -800,7 +800,7 @@ struct CollectionManager CollectionProxyWrapType const& proxy, MsgT *const msg, ReduceIdxFuncType expr_fn, ReduceStamp stamp = ReduceStamp{}, - NodeType root_node = uninitialized_destination + NodeT root_node = {} ); /** @@ -1124,7 +1124,7 @@ struct CollectionManager template static void collectionAutoMsgDeliver( MsgT* msg, Indexable* col, HandlerType han, - NodeType from, trace::TraceEventIDType event, bool immediate + NodeT from, trace::TraceEventIDType event, bool immediate ); /** @@ -1204,9 +1204,9 @@ struct CollectionManager template bool insertCollectionElement( VirtualPtrType vc, VirtualProxyType const proxy, - IndexT const& idx, NodeType const home_node, + IndexT const& idx, NodeT const home_node, bool const is_migrated_in = false, - NodeType const migrated_from = uninitialized_destination + NodeT const migrated_from = {} ); private: @@ -1323,7 +1323,7 @@ struct CollectionManager * \return the mapped node */ template - NodeType getMappedNode( + NodeT getMappedNode( CollectionProxyWrapType const& proxy, typename ColT::IndexType const& idx ); @@ -1337,7 +1337,7 @@ struct CollectionManager * \return the mapped node */ template - NodeType getMappedNode(VirtualProxyType proxy, IdxT const& idx); + NodeT getMappedNode(VirtualProxyType proxy, IdxT const& idx); /** * \brief Migrate element to a new node @@ -1351,7 +1351,7 @@ struct CollectionManager */ template MigrateStatus migrate( - VrtElmProxy proxy, NodeType const& dest + VrtElmProxy proxy, NodeT const& dest ); /** @@ -1418,7 +1418,7 @@ struct CollectionManager template void insert( CollectionProxyWrapType const& proxy, typename ColT::IndexType idx, - NodeType const node, ModifierToken& token, MsgSharedPtr msg = nullptr, + NodeT const node, ModifierToken& token, MsgSharedPtr msg = nullptr, bool pinged_home_already = false ); @@ -1493,7 +1493,7 @@ struct CollectionManager */ template MigrateStatus migrateOut( - VirtualProxyType const& proxy, IndexT const& idx, NodeType const& dest + VirtualProxyType const& proxy, IndexT const& idx, NodeT const& dest ); /** @@ -1508,7 +1508,7 @@ struct CollectionManager */ template MigrateStatus migrateIn( - VirtualProxyType const& proxy, IndexT const& idx, NodeType const& from, + VirtualProxyType const& proxy, IndexT const& idx, NodeT const& from, VirtualPtrType vrt_elm_ptr ); @@ -1630,7 +1630,7 @@ struct CollectionManager */ template static void migrateToRestoreLocation( - NodeType node, typename ColT::IndexType idx, + NodeT node, typename ColT::IndexType idx, CollectionProxyWrapType proxy ); @@ -1723,7 +1723,7 @@ struct CollectionManager template void makeCollectionElement( VirtualProxyType const proxy, typename ColT::IndexType idx, - NodeType const mapped_node, Callable&& cons_fn, + NodeT const mapped_node, Callable&& cons_fn, bool zero_reduce_stamp = false ); @@ -1753,7 +1753,7 @@ struct CollectionManager * \return the node where it is mapped */ template - NodeType getElementMapping( + NodeT getElementMapping( HandlerType map_han, ObjGroupProxyType map_object, IdxT idx, IdxT bounds ); diff --git a/src/vt/vrt/collection/manager.impl.h b/src/vt/vrt/collection/manager.impl.h index 3a1a965fc6..c9c171a9be 100644 --- a/src/vt/vrt/collection/manager.impl.h +++ b/src/vt/vrt/collection/manager.impl.h @@ -205,7 +205,7 @@ GroupType CollectionManager::createGroupCollection( template /*static*/ void CollectionManager::collectionAutoMsgDeliver( - MsgT* msg, Indexable* base, HandlerType han, NodeType from, + MsgT* msg, Indexable* base, HandlerType han, NodeT from, trace::TraceEventIDType event, bool immediate ) { // Expand out the index for tracing purposes; Projections takes up to @@ -359,10 +359,10 @@ template bool bcast = cat == elm::CommCategory::SendRecv ? false : true; lb_data.recvObjData(pto, pfrom, msg_size, bcast); } else if ( - cat == elm::CommCategory::NodeToCollection or - cat == elm::CommCategory::NodeToCollectionBcast + cat == elm::CommCategory::NodeCollection or + cat == elm::CommCategory::NodeCollectionBcast ) { - bool bcast = cat == elm::CommCategory::NodeToCollection ? false : true; + bool bcast = cat == elm::CommCategory::NodeCollection ? false : true; auto nfrom = msg->getFromNode(); lb_data.recvFromNode(pto, nfrom, msg_size, bcast); } @@ -868,7 +868,7 @@ template *f> messaging::PendingSend CollectionManager::reduceMsgExpr( CollectionProxyWrapType const& proxy, MsgT *const raw_msg, ReduceIdxFuncType expr_fn, - ReduceStamp stamp, NodeType root + ReduceStamp stamp, NodeT root ) { using IndexT = typename ColT::IndexType; @@ -904,7 +904,7 @@ messaging::PendingSend CollectionManager::reduceMsgExpr( } auto const root_node = - root == uninitialized_destination ? default_collection_reduce_root_node : + root == NodeT{} ? default_collection_reduce_root_node : root; auto const group_ready = elm_holder->groupReady(); @@ -941,7 +941,7 @@ messaging::PendingSend CollectionManager::reduceMsgExpr( template *f> messaging::PendingSend CollectionManager::reduceMsg( CollectionProxyWrapType const& proxy, - MsgT *const msg, ReduceStamp stamp, NodeType root + MsgT *const msg, ReduceStamp stamp, NodeT root ) { return reduceMsgExpr(proxy,msg,nullptr,stamp,root); } @@ -1143,8 +1143,8 @@ messaging::PendingSend CollectionManager::sendMsgUntypedHandler( template bool CollectionManager::insertCollectionElement( VirtualPtrType vc, VirtualProxyType const proxy, - IndexT const& idx, NodeType const home_node, bool const is_migrated_in, - NodeType const migrated_from + IndexT const& idx, NodeT const home_node, bool const is_migrated_in, + NodeT const migrated_from ) { auto holder = findColHolder(proxy); @@ -1452,7 +1452,7 @@ template } template -NodeType CollectionManager::getMappedNode( +NodeT CollectionManager::getMappedNode( VirtualProxyType proxy, IdxT const& idx ) { auto col_holder = findColHolder(proxy); @@ -1463,7 +1463,7 @@ NodeType CollectionManager::getMappedNode( } template -NodeType CollectionManager::getMappedNode( +NodeT CollectionManager::getMappedNode( CollectionProxyWrapType const& proxy, typename ColT::IndexType const& idx ) { @@ -1550,7 +1550,7 @@ void CollectionManager::finishModification( using collective::reduce::makeStamp; using collective::reduce::StrongUserID; - NodeType collective_root = 0; + NodeT collective_root = NodeT{0}; auto stamp = makeStamp(untyped_proxy); auto msg = makeMessage(untyped_proxy, min_seq); auto cb = theCB()->makeBcast< @@ -1618,7 +1618,7 @@ struct InsertMsgDispatcher< template void CollectionManager::insert( CollectionProxyWrapType const& proxy, typename ColT::IndexType idx, - NodeType const node, ModifierToken& token, MsgSharedPtr insert_msg, + NodeT const node, ModifierToken& token, MsgSharedPtr insert_msg, bool pinged_home_already ) { using IndexType = typename ColT::IndexType; @@ -1636,7 +1636,7 @@ void CollectionManager::insert( theMsg()->pushEpoch(modify_epoch); auto const mapped_node = getMappedNode(proxy, idx); - auto const has_explicit_node = node != uninitialized_destination; + auto const has_explicit_node = node != NodeT{}; auto const insert_node = has_explicit_node ? node : mapped_node; auto const this_node = theContext()->getNode(); @@ -1757,7 +1757,7 @@ template template MigrateStatus CollectionManager::migrate( - VrtElmProxy proxy, NodeType const& dest + VrtElmProxy proxy, NodeT const& dest ) { using IndexT = typename ColT::IndexType; auto const col_proxy = proxy.getCollectionProxy(); @@ -1778,7 +1778,7 @@ MigrateStatus CollectionManager::migrate( template MigrateStatus CollectionManager::migrateOut( - VirtualProxyType const& col_proxy, IndexT const& idx, NodeType const& dest + VirtualProxyType const& col_proxy, IndexT const& idx, NodeT const& dest ) { auto const this_node = theContext()->getNode(); @@ -1894,7 +1894,7 @@ MigrateStatus CollectionManager::migrateOut( template MigrateStatus CollectionManager::migrateIn( - VirtualProxyType const& proxy, IndexT const& idx, NodeType const& from, + VirtualProxyType const& proxy, IndexT const& idx, NodeT const& from, VirtualPtrType vrt_elm_ptr ) { vt_debug_print( @@ -2167,7 +2167,7 @@ void CollectionManager::checkpointToFile( namespace detail { template inline void restoreOffHomeElement( - ColT*, NodeType node, typename ColT::IndexType idx, + ColT*, NodeT node, typename ColT::IndexType idx, CollectionProxy proxy ) { theCollection()->migrate(proxy(idx), node); @@ -2176,7 +2176,7 @@ inline void restoreOffHomeElement( template /*static*/ void CollectionManager::migrateToRestoreLocation( - NodeType node, typename ColT::IndexType idx, + NodeT node, typename ColT::IndexType idx, CollectionProxyWrapType proxy ) { if (proxy(idx).tryGetLocalPtr() != nullptr) { @@ -2220,12 +2220,12 @@ void CollectionManager::restoreFromFileInPlace( if (proxy(idx).tryGetLocalPtr() == nullptr) { auto mapped_node = getMappedNode(proxy, idx); - vtAssertExpr(mapped_node != uninitialized_destination); + vtAssertExpr(mapped_node != NodeT{}); auto this_node = theContext()->getNode(); if (mapped_node != this_node) { theMsg()->send>( - vt::Node{mapped_node}, this_node, idx, proxy + vt::NodeT {mapped_node}, this_node, idx, proxy ); } else { migrateToRestoreLocation(this_node, idx, proxy); diff --git a/src/vt/vrt/collection/mapped_node/mapped_node.h b/src/vt/vrt/collection/mapped_node/mapped_node.h index c56e1a7b69..d63edea1c2 100644 --- a/src/vt/vrt/collection/mapped_node/mapped_node.h +++ b/src/vt/vrt/collection/mapped_node/mapped_node.h @@ -54,7 +54,7 @@ namespace vt { namespace vrt { namespace collection { template struct MappedNode : BaseProxyT { - using FuncLocType = std::function; + using FuncLocType = std::function; MappedNode() = default; MappedNode( diff --git a/src/vt/vrt/collection/messages/system_create.h b/src/vt/vrt/collection/messages/system_create.h index 9136fb960d..36cf4447a8 100644 --- a/src/vt/vrt/collection/messages/system_create.h +++ b/src/vt/vrt/collection/messages/system_create.h @@ -99,8 +99,8 @@ struct InsertMsg : ::vt::Message { InsertMsg() = default; InsertMsg( - CollectionProxy in_proxy, IndexType in_idx, NodeType in_construct_node, - NodeType in_home_node, EpochType in_insert_epoch, + CollectionProxy in_proxy, IndexType in_idx, NodeT in_construct_node, + NodeT in_home_node, EpochType in_insert_epoch, MsgSharedPtr in_insert_msg = nullptr ) : proxy_(in_proxy), idx_(in_idx), @@ -132,8 +132,8 @@ struct InsertMsg : ::vt::Message { CollectionProxy proxy_ = {}; IndexType idx_ = {}; - NodeType construct_node_ = uninitialized_destination; - NodeType home_node_ = uninitialized_destination; + NodeT construct_node_ = {}; + NodeT home_node_ = {}; EpochType insert_epoch_ = no_epoch; bool pinged_ = false; MsgSharedPtr insert_msg_ = nullptr; diff --git a/src/vt/vrt/collection/messages/user.h b/src/vt/vrt/collection/messages/user.h index a3a7b9c3cf..63ea68515f 100644 --- a/src/vt/vrt/collection/messages/user.h +++ b/src/vt/vrt/collection/messages/user.h @@ -95,8 +95,8 @@ struct CollectionMessage : RoutedMessageType VirtualProxyType getBcastProxy() const; void setBcastProxy(VirtualProxyType const& in_proxy); - NodeType getFromNode() const; - void setFromNode(NodeType const& node); + NodeT getFromNode() const; + void setFromNode(NodeT const& node); bool getWrap() const; void setWrap(bool const& wrap); @@ -124,7 +124,7 @@ struct CollectionMessage : RoutedMessageType VirtualProxyType bcast_proxy_{}; VirtualElmProxyType to_proxy_{}; HandlerType vt_sub_handler_ = uninitialized_handler; - NodeType from_node_ = uninitialized_destination; + NodeT from_node_ = {}; bool is_wrap_ = false; #if vt_check_enabled(lblite) diff --git a/src/vt/vrt/collection/messages/user.impl.h b/src/vt/vrt/collection/messages/user.impl.h index 800d996b67..46723fafe9 100644 --- a/src/vt/vrt/collection/messages/user.impl.h +++ b/src/vt/vrt/collection/messages/user.impl.h @@ -92,12 +92,12 @@ void CollectionMessage::setBcastProxy( } template -NodeType CollectionMessage::getFromNode() const { +NodeT CollectionMessage::getFromNode() const { return from_node_; } template -void CollectionMessage::setFromNode(NodeType const& node) { +void CollectionMessage::setFromNode(NodeT const& node) { from_node_ = node; } diff --git a/src/vt/vrt/collection/migrate/manager_migrate_attorney.h b/src/vt/vrt/collection/migrate/manager_migrate_attorney.h index 6b94d3b49c..0a48d65d67 100644 --- a/src/vt/vrt/collection/migrate/manager_migrate_attorney.h +++ b/src/vt/vrt/collection/migrate/manager_migrate_attorney.h @@ -69,15 +69,15 @@ struct CollectionElmAttorney { private: static void migrate( - VrtElmProxy proxy, NodeType dest + VrtElmProxy proxy, NodeT dest ); static MigrateStatus migrateOut( - VirtualProxyType const& proxy, IndexT const& idx, NodeType const& dest + VirtualProxyType const& proxy, IndexT const& idx, NodeT const& dest ); static MigrateStatus migrateIn( - VirtualProxyType const& proxy, IndexT const& idx, NodeType const& from, + VirtualProxyType const& proxy, IndexT const& idx, NodeT const& from, VirtualPtrType vc_elm ); }; diff --git a/src/vt/vrt/collection/migrate/manager_migrate_attorney.impl.h b/src/vt/vrt/collection/migrate/manager_migrate_attorney.impl.h index d5adc1b647..922ff29981 100644 --- a/src/vt/vrt/collection/migrate/manager_migrate_attorney.impl.h +++ b/src/vt/vrt/collection/migrate/manager_migrate_attorney.impl.h @@ -57,7 +57,7 @@ namespace vt { namespace vrt { namespace collection { template /*static*/ MigrateStatus CollectionElmAttorney::migrateOut( - VirtualProxyType const& proxy, IndexT const& idx, NodeType const& dest + VirtualProxyType const& proxy, IndexT const& idx, NodeT const& dest ) { return theCollection()->migrateOut(proxy,idx,dest); } @@ -65,14 +65,14 @@ template template /*static*/ void CollectionElmAttorney::migrate( - VrtElmProxy proxy, NodeType dest + VrtElmProxy proxy, NodeT dest ) { theCollection()->migrate(proxy,dest); } template /*static*/ MigrateStatus CollectionElmAttorney::migrateIn( - VirtualProxyType const& proxy, IndexT const& idx, NodeType const& from, + VirtualProxyType const& proxy, IndexT const& idx, NodeT const& from, VirtualPtrType vc_elm ) { return theCollection()->migrateIn( diff --git a/src/vt/vrt/collection/migrate/migrate_msg.h b/src/vt/vrt/collection/migrate/migrate_msg.h index 1aea770d06..1e895194fd 100644 --- a/src/vt/vrt/collection/migrate/migrate_msg.h +++ b/src/vt/vrt/collection/migrate/migrate_msg.h @@ -58,14 +58,14 @@ struct MigrateMsg final : ::vt::Message { MigrateMsg() = default; MigrateMsg( - VrtElmProxy const& in_elm_proxy, NodeType const& in_from, - NodeType const& in_to, ColT* in_elm + VrtElmProxy const& in_elm_proxy, NodeT const& in_from, + NodeT const& in_to, ColT* in_elm ) : elm_proxy_(in_elm_proxy), from_(in_from), to_(in_to), elm_(in_elm) { } VrtElmProxy getElementProxy() const { return elm_proxy_; } - NodeType getFromNode() const { return from_; } - NodeType getToNode() const { return to_; } + NodeT getFromNode() const { return from_; } + NodeT getToNode() const { return to_; } template void serialize(Serializer& s) { @@ -78,8 +78,8 @@ struct MigrateMsg final : ::vt::Message { private: VrtElmProxy elm_proxy_; - NodeType from_ = uninitialized_destination; - NodeType to_ = uninitialized_destination; + NodeT from_ = {}; + NodeT to_ = {}; public: ColT* elm_ = nullptr; }; diff --git a/src/vt/vrt/collection/reducable/reducable.h b/src/vt/vrt/collection/reducable/reducable.h index 12eb76e225..50b0496720 100644 --- a/src/vt/vrt/collection/reducable/reducable.h +++ b/src/vt/vrt/collection/reducable/reducable.h @@ -117,13 +117,13 @@ struct Reducable : BaseProxyT { template *f> messaging::PendingSend reduce( MsgT *const msg, ReduceStamp stamp = ReduceStamp{}, - NodeType const& node = uninitialized_destination + ::vt::NodeT const& node = {} ) const; template *f> messaging::PendingSend reduceExpr( MsgT *const msg, ReduceIdxFuncType fn, ReduceStamp stamp = ReduceStamp{}, - NodeType const& node = uninitialized_destination + ::vt::NodeT const& node = {} ) const; template *f> diff --git a/src/vt/vrt/collection/reducable/reducable.impl.h b/src/vt/vrt/collection/reducable/reducable.impl.h index fd682635ff..9a5bd69370 100644 --- a/src/vt/vrt/collection/reducable/reducable.impl.h +++ b/src/vt/vrt/collection/reducable/reducable.impl.h @@ -69,7 +69,7 @@ messaging::PendingSend Reducable::reduce( "Reducable: valid={} {}, ptr={}\n", cb.valid(), msg->getCallback().valid(), print_ptr(msg) ); - auto const root_node = 0; + auto const root_node = NodeT{0}; return theCollection()->reduceMsg(proxy,msg,stamp,root_node); } @@ -79,14 +79,14 @@ messaging::PendingSend Reducable::reduce( MsgT *const msg, ReduceStamp stamp ) const { auto const proxy = this->getProxy(); - auto const root_node = 0; + auto const root_node = NodeT{0}; return theCollection()->reduceMsg(proxy,msg,stamp,root_node); } template template *f> messaging::PendingSend Reducable::reduce( - MsgT *const msg, ReduceStamp stamp, NodeType const& node + MsgT *const msg, ReduceStamp stamp, ::vt::NodeT const& node ) const { auto const proxy = this->getProxy(); return theCollection()->reduceMsg(proxy,msg,stamp,node); @@ -95,7 +95,7 @@ messaging::PendingSend Reducable::reduce( template template *f> messaging::PendingSend Reducable::reduceExpr( - MsgT *const msg, ReduceIdxFuncType fn, ReduceStamp stamp, NodeType const& node + MsgT *const msg, ReduceIdxFuncType fn, ReduceStamp stamp, ::vt::NodeT const& node ) const { auto const proxy = this->getProxy(); return theCollection()->reduceMsgExpr(proxy,msg,fn,stamp,node); diff --git a/src/vt/vrt/collection/types/base.h b/src/vt/vrt/collection/types/base.h index 263925cada..8e3d280e68 100644 --- a/src/vt/vrt/collection/types/base.h +++ b/src/vt/vrt/collection/types/base.h @@ -69,7 +69,7 @@ struct CollectionBase : Indexable { ProxyType getElementProxy(IndexT const& idx) const; CollectionProxyType getCollectionProxy() const; - virtual void migrate(NodeType const& node) override; + virtual void migrate(NodeT const& node) override; template void serialize(Serializer& s); diff --git a/src/vt/vrt/collection/types/base.impl.h b/src/vt/vrt/collection/types/base.impl.h index a2294f72a3..e66a0d607a 100644 --- a/src/vt/vrt/collection/types/base.impl.h +++ b/src/vt/vrt/collection/types/base.impl.h @@ -76,7 +76,7 @@ CollectionBase::getCollectionProxy() const { } template -/*virtual*/ void CollectionBase::migrate(NodeType const& node) { +/*virtual*/ void CollectionBase::migrate(NodeT const& node) { auto const proxy = this->getCollectionProxy(); auto const index = this->getIndex(); CollectionElmAttorney::migrate(proxy(index), node); diff --git a/src/vt/vrt/collection/types/has_migrate.h b/src/vt/vrt/collection/types/has_migrate.h index 32e73a7bf6..75894930b5 100644 --- a/src/vt/vrt/collection/types/has_migrate.h +++ b/src/vt/vrt/collection/types/has_migrate.h @@ -49,7 +49,7 @@ namespace vt { namespace vrt { namespace collection { struct HasMigrate { - virtual void migrate(NodeType const& to_node) = 0; + virtual void migrate(NodeT const& to_node) = 0; }; }}} /* end namespace vt::vrt::collection */ diff --git a/src/vt/vrt/collection/types/migratable.h b/src/vt/vrt/collection/types/migratable.h index 7691d2656c..4b11adf046 100644 --- a/src/vt/vrt/collection/types/migratable.h +++ b/src/vt/vrt/collection/types/migratable.h @@ -90,12 +90,12 @@ struct Migratable : MigrateHookBase, storage::Storable { /* @todo: migrate interface is through base class HasMigrate to insert lower in the hierarchy - virtual void migrate(NodeType const& node); + virtual void migrate(NodeT const& node); */ /* * The system invokes this when the destructor is about to be called on the - * VCC element due a migrate(NodeType const&) invocation + * VCC element due a migrate(NodeT const&) invocation */ virtual void destroy(); diff --git a/src/vt/vrt/context/context_vrt_internal_msgs.h b/src/vt/vrt/context/context_vrt_internal_msgs.h index 29c8718766..77e3c22afc 100644 --- a/src/vt/vrt/context/context_vrt_internal_msgs.h +++ b/src/vt/vrt/context/context_vrt_internal_msgs.h @@ -81,13 +81,13 @@ struct VirtualProxyRequestMsg : ShortMessage { using MessageParentType = ShortMessage; vt_msg_serialize_prohibited(); - NodeType request_node = uninitialized_destination; - NodeType construct_node = uninitialized_destination; + NodeT request_node = {}; + NodeT construct_node = {}; VirtualRequestIDType request_id = no_request_id; VirtualProxyType proxy = no_vrt_proxy; VirtualProxyRequestMsg( - NodeType const& in_node, NodeType const& in_req_node, + NodeT const& in_node, NodeT const& in_req_node, VirtualRequestIDType const& in_request_id, VirtualProxyType const& in_proxy = no_vrt_proxy ) diff --git a/src/vt/vrt/context/context_vrt_remoteinfo.h b/src/vt/vrt/context/context_vrt_remoteinfo.h index 8cfb9a8b2b..a2545a42a6 100644 --- a/src/vt/vrt/context/context_vrt_remoteinfo.h +++ b/src/vt/vrt/context/context_vrt_remoteinfo.h @@ -54,15 +54,15 @@ struct RemoteVrtInfo { bool isImmediate = false; VirtualProxyType proxy = no_vrt_proxy; VirtualRequestIDType req_id = no_request_id; - NodeType from_node = uninitialized_destination; + NodeT from_node = {}; RemoteVrtInfo() = default; - RemoteVrtInfo(NodeType const& node, VirtualRequestIDType const& in_req_id) + RemoteVrtInfo(NodeT const& node, VirtualRequestIDType const& in_req_id) : req_id(in_req_id), from_node(node) { } - RemoteVrtInfo(NodeType const& node, VirtualProxyType p) + RemoteVrtInfo(NodeT const& node, VirtualProxyType p) : isImmediate(true), proxy(p), from_node(node) { } diff --git a/src/vt/vrt/context/context_vrtinfo.cc b/src/vt/vrt/context/context_vrtinfo.cc index 38347a49b9..00a84d49b5 100644 --- a/src/vt/vrt/context/context_vrtinfo.cc +++ b/src/vt/vrt/context/context_vrtinfo.cc @@ -90,7 +90,7 @@ bool VirtualInfo::enqueueWorkUnit(VirtualMessage* raw_msg) { auto work_unit = [=]{ // @todo: fix the from node - auto const& from_node = 0; + auto const& from_node = NodeT{0}; auto m = promoteMsg(raw_msg); runnable::makeRunnable(m, false, sub_handler, from_node) .withTDEpochFromMsg() diff --git a/src/vt/vrt/context/context_vrtinfo.h b/src/vt/vrt/context/context_vrtinfo.h index 8dc9121cec..2bb9ef996b 100644 --- a/src/vt/vrt/context/context_vrtinfo.h +++ b/src/vt/vrt/context/context_vrtinfo.h @@ -79,7 +79,7 @@ struct VirtualInfo { VirtualContext *get() const; VirtualProxyType getProxy() const { return proxy_; } - NodeType getNode() const { return default_node_; } + NodeT getNode() const { return default_node_; } void setNodeMap(HandlerType const han) { node_map_handle_ = han; } bool hasNodeMap() const { return node_map_handle_ != uninitialized_handler; } @@ -98,7 +98,7 @@ struct VirtualInfo { private: HandlerType node_map_handle_ = uninitialized_handler; - NodeType default_node_ = uninitialized_destination; + NodeT default_node_ = {}; VirtualProxyType proxy_ = no_vrt_proxy; VirtualPtrType vrt_ptr_ = nullptr; bool needs_lock_ = false; diff --git a/src/vt/vrt/context/context_vrtmanager.cc b/src/vt/vrt/context/context_vrtmanager.cc index c09e901d33..febd603ce5 100644 --- a/src/vt/vrt/context/context_vrtmanager.cc +++ b/src/vt/vrt/context/context_vrtmanager.cc @@ -105,7 +105,7 @@ VirtualProxyType VirtualContextManager::generateNewProxy() { } VirtualRemoteIDType VirtualContextManager::generateNewRemoteID( - NodeType const& node + NodeT const& node ) { auto iter = curRemoteID_.find(node); if (iter == curRemoteID_.end()) { @@ -226,7 +226,7 @@ void VirtualContextManager::destoryVirtualByProxy( } } -NodeType VirtualContextManager::getNode() const { +NodeT VirtualContextManager::getNode() const { return myNode_; } diff --git a/src/vt/vrt/context/context_vrtmanager.h b/src/vt/vrt/context/context_vrtmanager.h index 77579fd9a8..c0974e5fd3 100644 --- a/src/vt/vrt/context/context_vrtmanager.h +++ b/src/vt/vrt/context/context_vrtmanager.h @@ -102,7 +102,7 @@ struct VirtualContextManager VirtualProxyType makeVirtual(Args&& ... args); template - VirtualProxyType makeVirtualNode(NodeType const& node, Args&& ... args); + VirtualProxyType makeVirtualNode(NodeT const& node, Args&& ... args); template VirtualProxyType makeVirtualMap(Args ... args); @@ -150,14 +150,14 @@ struct VirtualContextManager template VirtualProxyType makeVirtualRemote( - NodeType const& node, bool isImmediate, ActionProxyType action, + NodeT const& node, bool isImmediate, ActionProxyType action, Args&&... args ); void insertVirtualContext(VirtualPtrType new_vc, VirtualProxyType proxy); VirtualProxyType generateNewProxy(); - VirtualRemoteIDType generateNewRemoteID(NodeType const& node); + VirtualRemoteIDType generateNewRemoteID(NodeT const& node); // All messages directed to a virtual context are routed through this handler // so the user's handler can be invoked with the pointer to the virtual @@ -184,7 +184,7 @@ struct VirtualContextManager ); void destroyVirtualByID(VirtualIDType const& lookupID, bool const is_remote); VirtualIDType getCurrentID() const; - NodeType getNode() const; + NodeT getNode() const; private: // Holder for local virtual contexts that are mapped to this node; VirtualInfo @@ -198,10 +198,10 @@ struct VirtualContextManager VirtualIDType curIdent_; // The current identifier (for remote nodes) for this manager - std::unordered_map curRemoteID_; + std::unordered_map curRemoteID_; // Cache of the node for the virtual context manager - NodeType myNode_; + NodeT myNode_; // The current request identifier, used to track remote transactions VirtualRequestIDType cur_request_id = 0; diff --git a/src/vt/vrt/context/context_vrtmanager.impl.h b/src/vt/vrt/context/context_vrtmanager.impl.h index 39d3bad273..6511ab12bb 100644 --- a/src/vt/vrt/context/context_vrtmanager.impl.h +++ b/src/vt/vrt/context/context_vrtmanager.impl.h @@ -115,7 +115,7 @@ template template VirtualProxyType VirtualContextManager::makeVirtualNode( - NodeType const& node, Args&& ... args + NodeT const& node, Args&& ... args ) { auto const& this_node = theContext()->getNode(); if (node != this_node) { @@ -138,7 +138,7 @@ messaging::PendingSend VirtualContextManager::sendSerialMsg( ) { auto base_msg = promoteMsg(msg).template to(); - NodeType const& home_node = VirtualProxyBuilder::getVirtualNode(toProxy); + NodeT const& home_node = VirtualProxyBuilder::getVirtualNode(toProxy); // register the user's handler HandlerType const han = auto_registry::makeAutoHandlerVC(); // save the user's handler in the message @@ -172,7 +172,7 @@ messaging::PendingSend VirtualContextManager::sendSerialMsg( }, // custom data transfer lambda if above the eager threshold [=](ActionNodeSendType action) -> messaging::PendingSend { - auto captured_action = [=](NodeType node){ action(node); }; + auto captured_action = [=](NodeT node){ action(node); }; theLocMan()->vrtContextLoc->routeNonEagerAction( toProxy, home_node, captured_action ); @@ -186,7 +186,7 @@ messaging::PendingSend VirtualContextManager::sendSerialMsg( template VirtualProxyType VirtualContextManager::makeVirtualRemote( - NodeType const& dest, bool isImmediate, ActionProxyType action, Args&&... args + NodeT const& dest, bool isImmediate, ActionProxyType action, Args&&... args ) { using ArgsTupleType = std::tuple::type...>; using MsgType = VrtConstructMsg; diff --git a/src/vt/vrt/proxy/proxy_bits.cc b/src/vt/vrt/proxy/proxy_bits.cc index d0ead05d54..b052430d3e 100644 --- a/src/vt/vrt/proxy/proxy_bits.cc +++ b/src/vt/vrt/proxy/proxy_bits.cc @@ -47,12 +47,12 @@ namespace vt {namespace vrt { /*static*/ VirtualProxyType VirtualProxyBuilder::createProxy( - VirtualIDType const& id, NodeType const& node, bool const& is_coll, + VirtualIDType const& id, ::vt::NodeT const& node, bool const& is_coll, bool const& is_migratable, bool const& is_distributed ) { - constexpr NodeType const default_remote_node = 0; + constexpr NodeT const default_remote_node = NodeT{0}; VirtualProxyType new_proxy = 0; - NodeType remote_node = is_distributed ? default_remote_node : node; + NodeT remote_node = is_distributed ? default_remote_node : node; setIsCollection(new_proxy, is_coll); setIsMigratable(new_proxy, is_migratable); @@ -64,8 +64,8 @@ namespace vt {namespace vrt { } /*static*/ VirtualProxyType VirtualProxyBuilder::createRemoteProxy( - VirtualRemoteIDType const& id, NodeType const& this_node, - NodeType const& target_node, bool const& is_coll, bool const& is_migratable + VirtualRemoteIDType const& id, ::vt::NodeT const& this_node, + ::vt::NodeT const& target_node, bool const& is_coll, bool const& is_migratable ) { VirtualProxyType new_proxy = 0; @@ -98,7 +98,7 @@ namespace vt {namespace vrt { } /*static*/ void VirtualProxyBuilder::setVirtualNode( - VirtualProxyType& proxy, NodeType const& node + VirtualProxyType& proxy, ::vt::NodeT const& node ) { BitPackerType::setField( proxy, node @@ -114,7 +114,7 @@ namespace vt {namespace vrt { } /*static*/ void VirtualProxyBuilder::setVirtualRemoteNode( - VirtualProxyType& proxy, NodeType const& node + VirtualProxyType& proxy, ::vt::NodeT const& node ) { BitPackerType::setField< eVirtualProxyRemoteBits::RemoteNode, virtual_node_num_bits @@ -147,11 +147,11 @@ namespace vt {namespace vrt { return BitPackerType::boolGetField(proxy); } -/*static*/ NodeType VirtualProxyBuilder::getVirtualNode( +/*static*/ ::vt::NodeT VirtualProxyBuilder::getVirtualNode( VirtualProxyType const& proxy ) { return BitPackerType::getField< - eVirtualProxyBits::Node, virtual_node_num_bits, NodeType + eVirtualProxyBits::Node, virtual_node_num_bits, ::vt::NodeT >(proxy); } diff --git a/src/vt/vrt/proxy/proxy_bits.h b/src/vt/vrt/proxy/proxy_bits.h index dd946873e4..bfa7143365 100644 --- a/src/vt/vrt/proxy/proxy_bits.h +++ b/src/vt/vrt/proxy/proxy_bits.h @@ -54,7 +54,7 @@ static constexpr BitCountType const virtual_is_collection_num_bits = 1; static constexpr BitCountType const virtual_is_migratable_num_bits = 1; static constexpr BitCountType const virtual_is_remote_num_bits = 1; static constexpr BitCountType const virtual_node_num_bits = - BitCounterType::value; + BitCounterType ::value; static constexpr BitCountType const virtual_id_num_bits = BitCounterType::value; static constexpr BitCountType const virtual_remote_id_num_bits = @@ -78,15 +78,15 @@ enum eVirtualProxyRemoteBits { struct VirtualProxyBuilder { static VirtualProxyType createProxy( VirtualIDType const& id, - NodeType const& node, + ::vt::NodeT const& node, bool const& is_coll = false, bool const& is_migratable = false, bool const& is_distributed = false ); static VirtualProxyType createRemoteProxy( VirtualRemoteIDType const& id, - NodeType const& this_node, - NodeType const& target_node, + ::vt::NodeT const& this_node, + ::vt::NodeT const& target_node, bool const& is_coll, bool const& is_migratable ); @@ -94,14 +94,14 @@ struct VirtualProxyBuilder { static void setIsCollection(VirtualProxyType& proxy, bool const& is_coll); static void setIsMigratable(VirtualProxyType& proxy, bool const& is_migratable); static void setIsRemote(VirtualProxyType& proxy, bool const& is_remote); - static void setVirtualNode(VirtualProxyType& proxy, NodeType const& node); + static void setVirtualNode(VirtualProxyType& proxy, ::vt::NodeT const& node); static void setVirtualID(VirtualProxyType& proxy, VirtualIDType const& id); - static void setVirtualRemoteNode(VirtualProxyType& proxy, NodeType const& node); + static void setVirtualRemoteNode(VirtualProxyType& proxy, ::vt::NodeT const& node); static void setVirtualRemoteID(VirtualProxyType& proxy, VirtualRemoteIDType const& id); static bool isCollection(VirtualProxyType const& proxy); static bool isMigratable(VirtualProxyType const& proxy); static bool isRemote(VirtualProxyType const& proxy); - static NodeType getVirtualNode(VirtualProxyType const& proxy); + static ::vt::NodeT getVirtualNode(VirtualProxyType const& proxy); static VirtualIDType getVirtualID(VirtualProxyType const& proxy); }; diff --git a/src/vt/vrt/vrt_common.h b/src/vt/vrt/vrt_common.h index add9cc019d..455a40c921 100644 --- a/src/vt/vrt/vrt_common.h +++ b/src/vt/vrt/vrt_common.h @@ -48,7 +48,7 @@ namespace vt { namespace vrt { -static constexpr NodeType const default_collection_reduce_root_node = 0; +static constexpr ::vt::NodeT const default_collection_reduce_root_node = ::vt::NodeT {0}; }} /* end namespace vt::vrt */ diff --git a/tests/perf/comm_cost_curve.cc b/tests/perf/comm_cost_curve.cc index c5366e4478..c38109429d 100644 --- a/tests/perf/comm_cost_curve.cc +++ b/tests/perf/comm_cost_curve.cc @@ -78,7 +78,7 @@ static void handler(PingMsg*) { count++; if (count == pings) { auto msg = vt::makeMessage(1); - vt::theMsg()->sendMsg(0, msg); + vt::theMsg()->sendMsg(vt::NodeT{0}, msg); count = 0; } } @@ -88,7 +88,7 @@ void sender() { auto start = vt::timing::getCurrentTime(); for (int i = 0; i < pings; i++) { auto msg = vt::makeMessage(bytes); - vt::theMsg()->sendMsg(1, msg); + vt::theMsg()->sendMsg(vt::NodeT{1}, msg); } vt::theSched()->runSchedulerWhile([]{return !is_done; }); @@ -121,7 +121,7 @@ int main(int argc, char** argv) { pings = 10; } - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { fmt::print( "{:<8} {:<16} 0x{:<10} {:<22} {:<22}\n", "Pings", "Bytes", "Bytes", "Mb", "Time per" diff --git a/tests/perf/common/test_harness.cc b/tests/perf/common/test_harness.cc index 7fd028c779..f00170b9c0 100644 --- a/tests/perf/common/test_harness.cc +++ b/tests/perf/common/test_harness.cc @@ -135,14 +135,14 @@ struct TestMsg : Message { TestMsg( PerfTestHarness::TestResults const& results, - PerfTestHarness::MemoryUsage const& memory, NodeType const from_node) + PerfTestHarness::MemoryUsage const& memory, NodeT const from_node) : results_(results), memory_load_(memory), from_node_(from_node) { } PerfTestHarness::TestResults results_ = {}; PerfTestHarness::MemoryUsage memory_load_ = {}; - NodeType from_node_ = {}; + NodeT from_node_ = {}; template void serialize(SerializerT& s) { @@ -344,7 +344,7 @@ void PerfTestHarness::SyncResults() { // Root node will be responsible for generating the final output // so every other node sends its results to it (at the end of test runs) runInEpochCollective([proxy, this] { - constexpr auto root_node = 0; + constexpr auto root_node = NodeT{0}; if (my_node_ != root_node) { proxy[root_node].send( @@ -358,7 +358,7 @@ void PerfTestHarness::SyncResults() { void PerfTestHarness::CopyTestData( PerfTestHarness::TestResults const& source_time, - PerfTestHarness::MemoryUsage const& source_memory, NodeType const node + PerfTestHarness::MemoryUsage const& source_memory, NodeT const node ) { auto time_use = ProcessInput( diff --git a/tests/perf/common/test_harness.h b/tests/perf/common/test_harness.h index 5309e1825c..a2cb2c9851 100644 --- a/tests/perf/common/test_harness.h +++ b/tests/perf/common/test_harness.h @@ -70,13 +70,13 @@ struct PerfTestHarness { using FinalTestResult = std::pair>; using TestResults = std::vector>; using PerNodeResults = - std::unordered_map>; + std::unordered_map>; using CombinedResults = std::vector>; // Memory use at the end of test iteration (i.e. phase) using MemoryUsage = std::vector>; using CombinedMemoryUse = - std::unordered_map>>; + std::unordered_map>>; virtual ~PerfTestHarness() = default; @@ -154,7 +154,7 @@ struct PerfTestHarness { */ void CopyTestData( PerfTestHarness::TestResults const& timers, - PerfTestHarness::MemoryUsage const& memory_usage, NodeType const from_node + PerfTestHarness::MemoryUsage const& memory_usage, NodeT const from_node ); /** @@ -179,8 +179,8 @@ struct PerfTestHarness { uint32_t current_run_ = 0; std::vector custom_args_ = {}; - NodeType my_node_ = uninitialized_destination; - NodeType num_nodes_ = uninitialized_destination; + NodeT my_node_ = NodeT{}; + NodeT num_nodes_ = NodeT{}; std::string name_ = {}; // Memory usage (in bytes) per iteration diff --git a/tests/perf/common/test_harness_macros.h b/tests/perf/common/test_harness_macros.h index 728073f5f9..b9e955bde0 100644 --- a/tests/perf/common/test_harness_macros.h +++ b/tests/perf/common/test_harness_macros.h @@ -58,7 +58,7 @@ namespace vt { namespace tests { namespace perf { namespace common { * VT_PERF_TEST(MyTest, my_test_name) { * if (my_node_ == 0) { * auto m = makeMessage(); - * theMsg()->sendMsg(1, m); + * theMsg()->sendMsg(vt::NodeT{1}, m); * } * } * diff --git a/tests/perf/make_runnable_micro.cc b/tests/perf/make_runnable_micro.cc index 9991d630e9..dcf5c342ca 100644 --- a/tests/perf/make_runnable_micro.cc +++ b/tests/perf/make_runnable_micro.cc @@ -87,7 +87,7 @@ struct NodeObj { void perfRunBenchmark() { for (int i = 0; i < num_iters; i++) { - auto r = runnable::makeRunnable(msgs[i], false, han, 0) + auto r = runnable::makeRunnable(msgs[i], false, han, NodeT{0}) .withContinuation(nullptr) .withTDEpochFromMsg(false); r.enqueue(); diff --git a/tests/perf/memory_checker.cc b/tests/perf/memory_checker.cc index b9a15d3b2b..f82e5c2498 100644 --- a/tests/perf/memory_checker.cc +++ b/tests/perf/memory_checker.cc @@ -68,7 +68,7 @@ int main(int argc, char** argv) { auto this_node = vt::theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto usage = vt::theMemUsage(); fmt::print("Initial: {}\n", usage->getUsageAll()); diff --git a/tests/perf/objgroup_local_send.cc b/tests/perf/objgroup_local_send.cc index 5cf25ac728..aecf2cfdaf 100644 --- a/tests/perf/objgroup_local_send.cc +++ b/tests/perf/objgroup_local_send.cc @@ -92,7 +92,7 @@ struct NodeObj { void perfRunBenchmark() { for (int i = 0; i < num_iters; i++) { auto m = msgs[i]; - obj_proxy[0].template sendMsg(m); + obj_proxy[NodeT{0}].template sendMsg(m); vt::theSched()->runSchedulerOnceImpl(); } } @@ -114,7 +114,7 @@ VT_PERF_TEST(MyTest, test_objgroup_local_send) { grp_proxy[my_node_].invoke<&NodeObj::initialize>(); - if (theContext()->getNode() == 0) { + if (theContext()->getNode() == NodeT{0}) { grp_proxy[my_node_].send(); } } diff --git a/tests/perf/ping_pong.cc b/tests/perf/ping_pong.cc index 8a2730b3b2..25b6685e7b 100644 --- a/tests/perf/ping_pong.cc +++ b/tests/perf/ping_pong.cc @@ -55,8 +55,8 @@ static constexpr int64_t const max_bytes = 16777216; static constexpr int64_t num_pings = 10; -static constexpr NodeType const ping_node = 0; -static constexpr NodeType const pong_node = 1; +static constexpr NodeT const ping_node = NodeT{0}; +static constexpr NodeT const pong_node = NodeT{1}; vt::EpochType the_epoch = vt::no_epoch; @@ -115,12 +115,12 @@ struct NodeObj { // End of iteration for node 1 addPerfStats(num_bytes); - proxy_[0] + proxy_[NodeT{0}] .send< NodeObj::FinishedPingMsg, &NodeObj::finishedPing>(num_bytes); } else { - NodeType const next = + NodeT const next = theContext()->getNode() == ping_node ? pong_node : ping_node; auto msg = vt::makeMessage>(cnt + 1); @@ -148,13 +148,13 @@ VT_PERF_TEST(MyTest, test_ping_pong) { ); grp_proxy[my_node_].invoke<&NodeObj::initialize>(); - if (theContext()->getNode() == 0) { + if (my_node_ == NodeT{0}) { theTerm()->disableTD(); } StartTimer(fmt::format("{} Bytes", min_bytes)); - if (my_node_ == 0) { + if (my_node_ == NodeT{0}) { grp_proxy[pong_node] .send, &NodeObj::pingPong>(); } diff --git a/tests/perf/ping_pong_am.cc b/tests/perf/ping_pong_am.cc index cecb2445ab..3027df9e69 100644 --- a/tests/perf/ping_pong_am.cc +++ b/tests/perf/ping_pong_am.cc @@ -66,7 +66,7 @@ void handlerFinished(MyMsg* msg); void handler(MyMsg* in_msg) { auto msg = makeMessage(); - theMsg()->sendMsg<&handlerFinished>(0, msg); + theMsg()->sendMsg<&handlerFinished>(vt::NodeT{0}, msg); } struct NodeObj { @@ -80,7 +80,7 @@ struct NodeObj { void complete() { test_obj_->StopTimer(fmt::format("{} ping-pong", i)); - if (theContext()->getNode() == 0) { + if (theContext()->getNode() == NodeT{0}) { theTerm()->enableTD(); } } @@ -88,7 +88,7 @@ struct NodeObj { void perfPingPong(MyMsg* in_msg) { test_obj_->StartTimer(fmt::format("{} ping-pong", i)); auto msg = makeMessage(); - theMsg()->sendMsg<&handler>(1, msg); + theMsg()->sendMsg<&handler>(vt::NodeT{1}, msg); } private: @@ -100,11 +100,11 @@ struct NodeObj { void handlerFinished(MyMsg* msg) { if (i >= num_iters) { - global_proxy[0].invoke<&NodeObj::complete>(); + global_proxy[NodeT{0}].invoke<&NodeObj::complete>(); } else { i++; auto msg = makeMessage(); - theMsg()->sendMsg<&handler>(1, msg); + theMsg()->sendMsg<&handler>(vt::NodeT{1}, msg); } } @@ -113,13 +113,13 @@ VT_PERF_TEST(MyTest, test_ping_pong_am) { "test_ping_pong_am", this ); - if (theContext()->getNode() == 0) { + if (theContext()->getNode() == NodeT{0}) { theTerm()->disableTD(); } grp_proxy[my_node_].invoke<&NodeObj::initialize>(); - if (theContext()->getNode() == 0) { + if (theContext()->getNode() == NodeT{0}) { grp_proxy[my_node_].send(); } } diff --git a/tests/unit/active/test_active_bcast_put.cc b/tests/unit/active/test_active_bcast_put.cc index 046eb1f0cf..b2acb03b3f 100644 --- a/tests/unit/active/test_active_bcast_put.cc +++ b/tests/unit/active/test_active_bcast_put.cc @@ -109,7 +109,7 @@ TEST_P(TestActiveBroadcastPut, test_type_safe_active_fn_bcast2) { auto const& my_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - NodeType const& root = GetParam(); + NodeT const& root = GetParam(); #if DEBUG_TEST_HARNESS_PRINT fmt::print("test_type_safe_active_fn_bcast: node={}, root={}\n", my_node, root); @@ -141,7 +141,7 @@ TEST_P(TestActiveBroadcastPut, test_type_safe_active_fn_bcast2) { INSTANTIATE_TEST_SUITE_P( InstantiationName, TestActiveBroadcastPut, - ::testing::Range(static_cast(0), static_cast(16), 1) + ::testing::Range(static_cast(0), static_cast(16), 1) ); }}}} // end namespace vt::tests::unit::bcast_put diff --git a/tests/unit/active/test_active_broadcast.cc b/tests/unit/active/test_active_broadcast.cc index 274ba5846a..16839468d7 100644 --- a/tests/unit/active/test_active_broadcast.cc +++ b/tests/unit/active/test_active_broadcast.cc @@ -91,7 +91,7 @@ TEST_P(TestActiveBroadcast, test_type_safe_active_fn_bcast2) { auto const& my_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - NodeType const& root = GetParam(); + NodeT const& root = GetParam(); #if DEBUG_TEST_HARNESS_PRINT fmt::print("test_type_safe_active_fn_bcast: node={}, root={}\n", my_node, root); @@ -116,7 +116,7 @@ TEST_P(TestActiveBroadcast, test_type_safe_active_fn_bcast2) { INSTANTIATE_TEST_SUITE_P( InstantiationName, TestActiveBroadcast, - ::testing::Range(static_cast(0), static_cast(16), 1) + ::testing::Range(static_cast(0), static_cast(16), 1) ); }}}} // end namespace vt::tests::unit::bcast diff --git a/tests/unit/active/test_active_send.cc b/tests/unit/active/test_active_send.cc index 8313daf0fe..f02318554b 100644 --- a/tests/unit/active/test_active_send.cc +++ b/tests/unit/active/test_active_send.cc @@ -77,11 +77,11 @@ struct DataMsg : ::vt::Message { struct TestActiveSend : TestParallelHarness { using TestMsg = TestStaticBytesShortMsg<4>; - static NodeType from_node; - static NodeType to_node; + static inline NodeT from_node = {}; + static inline NodeT to_node = {}; - static int handler_count; - static int num_msg_sent; + static inline int handler_count = {}; + static inline int num_msg_sent = {}; virtual void SetUp() { TestParallelHarness::SetUp(); @@ -89,8 +89,8 @@ struct TestActiveSend : TestParallelHarness { handler_count = 0; num_msg_sent = 16; - from_node = 0; - to_node = 1; + from_node = NodeT{0}; + to_node = NodeT{1}; } static void test_handler_small_put(PutTestMessage* msg) { @@ -140,11 +140,6 @@ struct TestActiveSend : TestParallelHarness { static void msgSerialA(DataMsg*) { handler_count++; } }; -/*static*/ NodeType TestActiveSend::from_node; -/*static*/ NodeType TestActiveSend::to_node; -/*static*/ int TestActiveSend::handler_count; -/*static*/ int TestActiveSend::num_msg_sent; - TEST_F(TestActiveSend, test_type_safe_active_fn_send) { SET_MIN_NUM_NODES_CONSTRAINT(2); auto const& my_node = theContext()->getNode(); diff --git a/tests/unit/active/test_active_send_large.cc b/tests/unit/active/test_active_send_large.cc index 7833fd87a5..a357915939 100644 --- a/tests/unit/active/test_active_send_large.cc +++ b/tests/unit/active/test_active_send_large.cc @@ -127,14 +127,14 @@ TYPED_TEST_P(TestActiveSendLarge, test_large_bytes_msg) { using LargeMsgType = LargeMsg; - NodeType const this_node = theContext()->getNode(); - NodeType const num_nodes = theContext()->getNumNodes(); + NodeT const this_node = theContext()->getNode(); + NodeT const num_nodes = theContext()->getNumNodes(); int counter = 0; auto e = pipe::LifetimeEnum::Once; auto cb = theCB()->makeFunc(e, [&counter](RecvMsg*){ counter++; }); - NodeType next_node = (this_node + 1) % num_nodes; + NodeT next_node = (this_node + vt::NodeT{1}) % num_nodes; vt::runInEpochCollective([&]{ auto msg = makeMessage(); diff --git a/tests/unit/active/test_active_send_put.cc b/tests/unit/active/test_active_send_put.cc index ba2c52551f..f566564328 100644 --- a/tests/unit/active/test_active_send_put.cc +++ b/tests/unit/active/test_active_send_put.cc @@ -61,13 +61,13 @@ struct PutTestMessage : ::vt::PayloadMessage { }; struct TestActiveSendPut : TestParameterHarnessNode { - static NodeType from_node; - static NodeType to_node; + static inline NodeT from_node; + static inline NodeT to_node; virtual void SetUp() { TestParameterHarnessNode::SetUp(); - from_node = 0; - to_node = 1; + from_node = NodeT{0}; + to_node = NodeT{1}; } static void test_handler(PutTestMessage* msg) { @@ -86,8 +86,8 @@ struct TestActiveSendPut : TestParameterHarnessNode { } }; -/*static*/ NodeType TestActiveSendPut::from_node; -/*static*/ NodeType TestActiveSendPut::to_node; +// /*static*/ NodeT TestActiveSendPut::from_node; +// /*static*/ NodeT TestActiveSendPut::to_node; TEST_P(TestActiveSendPut, test_active_fn_send_put_param) { SET_MIN_NUM_NODES_CONSTRAINT(2); @@ -113,7 +113,7 @@ TEST_P(TestActiveSendPut, test_active_fn_send_put_param) { #if DEBUG_TEST_HARNESS_PRINT fmt::print("{}: sendMsg: (put) i={}\n", my_node, i); #endif - theMsg()->sendMsg(1, msg); + theMsg()->sendMsg(vt::NodeT{1}, msg); } // Spin here so test_vec does not go out of scope before the send completes @@ -122,7 +122,7 @@ TEST_P(TestActiveSendPut, test_active_fn_send_put_param) { INSTANTIATE_TEST_SUITE_P( InstantiationName, TestActiveSendPut, - ::testing::Range(static_cast(2), static_cast(512), 4) + ::testing::Range(static_cast(2), static_cast(512), 4) ); }}}} // end namespace vt::tests::unit::send_put diff --git a/tests/unit/active/test_async_op_mpi.cc b/tests/unit/active/test_async_op_mpi.cc index dff5e04e59..7a89c1727e 100644 --- a/tests/unit/active/test_async_op_mpi.cc +++ b/tests/unit/active/test_async_op_mpi.cc @@ -62,10 +62,10 @@ struct MyObjGroup { void handler(MyMsg* msg) { auto const this_node = theContext()->getNode(); auto const num_nodes = theContext()->getNumNodes(); - auto const to_node = (this_node + 1) % num_nodes; - from_node_ = this_node - 1; - if (from_node_ < 0) { - from_node_ = num_nodes - 1; + auto const to_node = (this_node + vt::NodeT{1}) % num_nodes; + from_node_ = this_node - vt::NodeT{1}; + if (from_node_ < vt::NodeT{0}) { + from_node_ = num_nodes - vt::NodeT{1}; } auto comm = theContext()->getComm(); @@ -103,7 +103,7 @@ struct MyObjGroup { int send_val_ = 0; int recv_val_ = -1000; bool done_ = false; - NodeType from_node_ = 0; + NodeT from_node_ = NodeT{0}; }; TEST_F(TestAsyncOp, test_async_op_1) { diff --git a/tests/unit/active/test_async_op_threads.cc b/tests/unit/active/test_async_op_threads.cc index 0faf97c982..29edeca398 100644 --- a/tests/unit/active/test_async_op_threads.cc +++ b/tests/unit/active/test_async_op_threads.cc @@ -65,10 +65,10 @@ struct MyCol : vt::Collection { void handler(MyMsg* msg) { auto const this_node = theContext()->getNode(); auto const num_nodes = theContext()->getNumNodes(); - auto const to_node = (this_node + 1) % num_nodes; - from_node_ = this_node - 1; - if (from_node_ < 0) { - from_node_ = num_nodes - 1; + auto const to_node = (this_node + vt::NodeT{1}) % num_nodes; + from_node_ = this_node - vt::NodeT{1}; + if (from_node_ < vt::NodeT{0}) { + from_node_ = num_nodes - vt::NodeT{1}; } // save a reference to the epoch stack @@ -133,10 +133,10 @@ struct MyCol : vt::Collection { void handlerInvoke(MyMsg* msg) { auto const this_node = theContext()->getNode(); auto const num_nodes = theContext()->getNumNodes(); - auto const to_node = (this_node + 1) % num_nodes; - from_node_ = this_node - 1; - if (from_node_ < 0) { - from_node_ = num_nodes - 1; + auto const to_node = (this_node + vt::NodeT{1}) % num_nodes; + from_node_ = this_node - vt::NodeT{1}; + if (from_node_ < vt::NodeT{0}) { + from_node_ = num_nodes - vt::NodeT{1}; } auto comm = theContext()->getComm(); @@ -191,7 +191,7 @@ struct MyCol : vt::Collection { int send_val_ = 0; int recv_val_ = -1000; bool done_ = false; - NodeType from_node_ = 0; + NodeT from_node_ = NodeT{0}; bool check_done_ = false; }; diff --git a/tests/unit/active/test_pending_send.cc b/tests/unit/active/test_pending_send.cc index 9f320ddd5c..57871bd1c2 100644 --- a/tests/unit/active/test_pending_send.cc +++ b/tests/unit/active/test_pending_send.cc @@ -56,14 +56,14 @@ using namespace vt::tests::unit; struct TestPendingSend : TestParallelHarness { struct TestMsg : vt::Message { TestMsg() = default; - explicit TestMsg(vt::NodeType in_sender) : sender(in_sender) { } - vt::NodeType sender = uninitialized_destination; + explicit TestMsg(vt::NodeT in_sender) : sender(in_sender) { } + vt::NodeT sender = vt::NodeT{}; }; static void handlerPong(TestMsg*) { delivered = true; } static void handlerPing(TestMsg* in_msg) { auto const this_node = theContext()->getNode(); auto const num_nodes = theContext()->getNumNodes(); - auto prev = this_node - 1 >= 0 ? this_node - 1 : num_nodes - 1; + auto prev = this_node - NodeT{1} >= 0 ? this_node - NodeT{1} : num_nodes - NodeT{1}; auto msg = vt::makeMessage(); theMsg()->sendMsg(prev, msg); } @@ -88,7 +88,7 @@ TEST_F(TestPendingSend, test_pending_send_hold) { auto ep = theTerm()->makeEpochCollective(); theMsg()->pushEpoch(ep); - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto next = this_node + vt::NodeT{1} < num_nodes ? this_node + vt::NodeT{1} : vt::NodeT{0}; auto msg = vt::makeMessage(); auto msg_hold = promoteMsg(msg.get()); diff --git a/tests/unit/collection/test_broadcast.h b/tests/unit/collection/test_broadcast.h index e2fccb8f67..1ee2c73396 100644 --- a/tests/unit/collection/test_broadcast.h +++ b/tests/unit/collection/test_broadcast.h @@ -124,7 +124,7 @@ void test_broadcast_1(std::string const& label) { using TestParamType = typename ColType::ParamType; auto const& this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const& col_size = 32; auto range = TestIndex(col_size); TestParamType args = ConstructTuple::construct(); diff --git a/tests/unit/collection/test_checkpoint.extended.cc b/tests/unit/collection/test_checkpoint.extended.cc index ff76861d5f..06dd9a93e4 100644 --- a/tests/unit/collection/test_checkpoint.extended.cc +++ b/tests/unit/collection/test_checkpoint.extended.cc @@ -160,7 +160,7 @@ struct TestCol : vt::Collection { int iter = 0; std::vector data1, data2; std::shared_ptr token; - NodeType final_node = uninitialized_destination; + NodeT final_node = NodeT{}; }; using TestCheckpoint = TestParallelHarness; @@ -181,14 +181,14 @@ TEST_F(TestCheckpoint, test_checkpoint_1) { ); vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); for (int i = 0; i < 5; i++) { vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.template broadcast(); } }); @@ -201,7 +201,7 @@ TEST_F(TestCheckpoint, test_checkpoint_1) { // Null the token to ensure we don't end up getting the same instance vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); @@ -210,7 +210,7 @@ TEST_F(TestCheckpoint, test_checkpoint_1) { // Destroy the collection vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.destroy(); } }); @@ -230,13 +230,13 @@ TEST_F(TestCheckpoint, test_checkpoint_1) { auto const got_label = vt::theCollection()->getLabel(proxy.getProxy()); EXPECT_EQ(got_label, expected_label); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.destroy(); } }); @@ -260,14 +260,14 @@ TEST_F(TestCheckpoint, test_checkpoint_in_place_2) { theConfig()->vt_lb_name = "TemperedLB"; vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); for (int i = 0; i < 5; i++) { vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.template broadcast(); } }); @@ -283,7 +283,7 @@ TEST_F(TestCheckpoint, test_checkpoint_in_place_2) { // Do more work after the checkpoint vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.template broadcast(); } }); @@ -303,13 +303,13 @@ TEST_F(TestCheckpoint, test_checkpoint_in_place_2) { vt::theCollective()->barrier(); runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.destroy(); } }); @@ -332,14 +332,14 @@ TEST_F(TestCheckpoint, test_checkpoint_in_place_3) { theConfig()->vt_lb_name = "TemperedLB"; vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); for (int i = 0; i < 5; i++) { vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.template broadcast(); } }); @@ -348,7 +348,7 @@ TEST_F(TestCheckpoint, test_checkpoint_in_place_3) { } vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); @@ -359,7 +359,7 @@ TEST_F(TestCheckpoint, test_checkpoint_in_place_3) { }); vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.destroy(); } }); @@ -389,8 +389,8 @@ TEST_F(TestCheckpoint, test_checkpoint_in_place_3) { // 2. Checkpoint the collection // 3. Restore the collection and validate it -vt::NodeType map(vt::Index3D* idx, vt::Index3D* max_idx, vt::NodeType num_nodes) { - return (idx->x() % (num_nodes-1))+1; +vt::NodeT map(vt::Index3D* idx, vt::Index3D* max_idx, vt::NodeT num_nodes) { + return vt::NodeT{(idx->x() % (num_nodes.get()-1))+1}; } TEST_F(TestCheckpoint, test_checkpoint_no_elements_on_root_rank) { @@ -410,20 +410,20 @@ TEST_F(TestCheckpoint, test_checkpoint_no_elements_on_root_rank) { .wait(); vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); //this number of iterations is expected in the verify member function for (int i = 0; i < 5; i++) { vt::runInEpochCollective([&]{ - if(this_node == 0) { + if(this_node == vt::NodeT{0}) { proxy.broadcast(); } }); } //verify that root node has no elements, by construction with map - if(this_node == 0) { + if(this_node == vt::NodeT{0}) { auto local_set = theCollection()->getLocalIndices(proxy); EXPECT_EQ(local_set.size(), 0); } @@ -436,7 +436,7 @@ TEST_F(TestCheckpoint, test_checkpoint_no_elements_on_root_rank) { // Destroy the collection vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.destroy(); } }); @@ -452,7 +452,7 @@ TEST_F(TestCheckpoint, test_checkpoint_no_elements_on_root_rank) { vt::theCollective()->barrier(); runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); diff --git a/tests/unit/collection/test_collection_construct_common.h b/tests/unit/collection/test_collection_construct_common.h index f239434bad..374285e840 100644 --- a/tests/unit/collection/test_collection_construct_common.h +++ b/tests/unit/collection/test_collection_construct_common.h @@ -121,7 +121,7 @@ void test_construct_1(std::string const& label) { using MsgType = typename ColType::MsgType; auto const& this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { // We don't want too many elements for 4 dimensions auto constexpr num_dims = ColType::IndexType::ndims(); auto constexpr col_size = 8 / num_dims; diff --git a/tests/unit/collection/test_collection_group.extended.cc b/tests/unit/collection/test_collection_group.extended.cc index 0d08a1e2c9..3b570179d6 100644 --- a/tests/unit/collection/test_collection_group.extended.cc +++ b/tests/unit/collection/test_collection_group.extended.cc @@ -64,9 +64,9 @@ struct MyReduceMsg : collective::ReduceTMsg { struct ColA : Collection { struct TestDataMsg : CollectionMessage { - TestDataMsg(int32_t value) : value_(value) {} + TestDataMsg(NodeT value) : value_(value) {} - int32_t value_ = -1; + NodeT value_ = NodeT{-1}; }; void finishedReduce(MyReduceMsg* m) { @@ -112,10 +112,10 @@ void runBcastTestHelper(f&& func) { struct TestCollectionGroup : TestParallelHarness { }; TEST_F(TestCollectionGroup, test_collection_group_1) { - auto const my_node = theContext()->getNode(); +auto const my_node = theContext()->getNode(); auto const num_nodes = theContext()->getNumNodes(); if (my_node == 0) { - auto const range = Index1D(std::max(num_nodes / 2, 1)); + auto const range = Index1D(std::max(num_nodes.get() / 2, 1)); auto const proxy = theCollection()->construct( range, "test_collection_group_1" ); @@ -208,7 +208,7 @@ struct TestCollectionMsg : CollectionMessage { using MessageParentType = CollectionMessage; vt_msg_serialize_required(); - explicit TestCollectionMsg(NodeType const node): node_{node} { + explicit TestCollectionMsg(NodeT const node): node_{node} { ::fmt::print("Creating TestCollectionMsg on node: {}\n", node_); } @@ -225,12 +225,12 @@ struct TestCollectionMsg : CollectionMessage { } } - NodeType fromNode() const { return node_; } + NodeT fromNode() const { return node_; } bool wasSerialized() const { return was_serialized_; } private: - NodeType node_{-1}; + NodeT node_{-1}; bool was_serialized_{false}; }; @@ -298,7 +298,7 @@ TEST_F(TestCollectionGroup, test_collection_group_dont_serialize_when_invoke) { runInEpochCollective([proxy] { auto const this_node = theContext()->getNode(); - proxy[this_node].invoke< + proxy[this_node.get()].invoke< TestCollectionMsg, &TestCollection::handleInvokeMsg >(this_node); }); diff --git a/tests/unit/collection/test_collection_group_recreate.cc b/tests/unit/collection/test_collection_group_recreate.cc index 63810be482..09450a6791 100644 --- a/tests/unit/collection/test_collection_group_recreate.cc +++ b/tests/unit/collection/test_collection_group_recreate.cc @@ -79,7 +79,7 @@ TEST_F(TestCollectionGroupRecreate, test_collection_group_recreate_1) { // Create a range that only hits half of the node---this requires a group for // the reduction to finish properly - auto const range = Index1D(std::max(num_nodes / 2, 1)); + auto const range = Index1D(std::max(num_nodes.get() / 2, 1)); auto const proxy = theCollection()->constructCollective( range, [](vt::Index1D) { return std::make_unique(); }, "test_collection_group_recreate_1" @@ -89,7 +89,7 @@ TEST_F(TestCollectionGroupRecreate, test_collection_group_recreate_1) { /// Broadcast to do a reduction over the current group vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto cb = vt::theCB()->makeFunc( vt::pipe::LifetimeEnum::Once, [&cb_counter](MyReduceMsg* m) { cb_counter++; @@ -100,7 +100,7 @@ TEST_F(TestCollectionGroupRecreate, test_collection_group_recreate_1) { } }); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { EXPECT_EQ(cb_counter, 1); } @@ -117,7 +117,7 @@ TEST_F(TestCollectionGroupRecreate, test_collection_group_recreate_1) { // Try to do another reduction; should fail if group is not setup correctly vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto cb = vt::theCB()->makeFunc( vt::pipe::LifetimeEnum::Once, [&cb_counter](MyReduceMsg* m) { cb_counter++; @@ -128,7 +128,7 @@ TEST_F(TestCollectionGroupRecreate, test_collection_group_recreate_1) { } }); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { EXPECT_EQ(cb_counter, 2); } @@ -138,7 +138,7 @@ TEST_F(TestCollectionGroupRecreate, test_collection_group_recreate_1) { // Try to do another reduction; should fail if group is not setup correctly vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto cb = vt::theCB()->makeFunc( vt::pipe::LifetimeEnum::Once, [&cb_counter](MyReduceMsg* m) { cb_counter++; @@ -149,7 +149,7 @@ TEST_F(TestCollectionGroupRecreate, test_collection_group_recreate_1) { } }); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { EXPECT_EQ(cb_counter, 3); } diff --git a/tests/unit/collection/test_destroy.cc b/tests/unit/collection/test_destroy.cc index cc8a8d00f8..e85aab5ccc 100644 --- a/tests/unit/collection/test_destroy.cc +++ b/tests/unit/collection/test_destroy.cc @@ -110,7 +110,7 @@ TEST_F(TestDestroy, test_destroy_1) { auto const& num_nodes = theContext()->getNumNodes(); vt::runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const& range = Index1D(num_nodes * num_elms_per_node); auto proxy = theCollection()->construct( range, "test_destroy_1" diff --git a/tests/unit/collection/test_index_types.extended.cc b/tests/unit/collection/test_index_types.extended.cc index 38ac039f18..1b86f80814 100644 --- a/tests/unit/collection/test_index_types.extended.cc +++ b/tests/unit/collection/test_index_types.extended.cc @@ -101,7 +101,7 @@ TYPED_TEST_P(TestCollectionIndexTypes, test_collection_index_1) { auto const& this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const& col_size = 32; auto range = IndexType(static_cast(col_size)); auto proxy = theCollection()->construct( diff --git a/tests/unit/collection/test_insert.extended.cc b/tests/unit/collection/test_insert.extended.cc index 7c104b38cb..a2ba2fac25 100644 --- a/tests/unit/collection/test_insert.extended.cc +++ b/tests/unit/collection/test_insert.extended.cc @@ -103,7 +103,7 @@ TEST_F(TestInsert, test_insert_dense_1) { { auto token = proxy.beginModification(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < range.x(); i++) { proxy[i].insert(token); } @@ -116,7 +116,7 @@ TEST_F(TestInsert, test_insert_dense_1) { { auto token = proxy.beginModification(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < range.x(); i++/*=2*/) { proxy[i].destroy(token); } @@ -143,7 +143,7 @@ TEST_F(TestInsert, test_insert_sparse_1) { .wait(); auto token = proxy.beginModification(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < range.x(); i+=16) { proxy[i].insert(token); } @@ -168,7 +168,7 @@ TEST_F(TestInsert, test_insert_dense_node_1) { .wait(); auto token = proxy.beginModification(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < range.x(); i++) { proxy[i].insertAt(token, this_node); } @@ -177,7 +177,7 @@ TEST_F(TestInsert, test_insert_dense_node_1) { /// ::fmt::print("num inserted={}\n", num_inserted); // Relies on default mapping equally distributing - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { EXPECT_EQ(num_inserted, num_elms_per_node * num_nodes); } num_inserted = 0; @@ -195,7 +195,7 @@ TEST_F(TestInsert, test_insert_sparse_node_1) { .wait(); auto token = proxy.beginModification(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < range.x(); i+=16) { proxy[i].insertAt(token, this_node); } @@ -204,7 +204,7 @@ TEST_F(TestInsert, test_insert_sparse_node_1) { /// ::fmt::print("num inserted={}\n", num_inserted); // Relies on default mapping equally distributing - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { EXPECT_EQ(num_inserted, num_elms_per_node * num_nodes); } num_inserted = 0; @@ -222,16 +222,16 @@ TEST_F(TestInsert, test_insert_send_dense_node_1) { .wait(); auto token = proxy.beginModification(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < range.x(); i++) { - proxy[i].insertAt(token, (this_node + 1) % num_nodes); + proxy[i].insertAt(token, (this_node + vt::NodeT{1}) % num_nodes); // ::fmt::print("sending to {}\n", i); } } proxy.finishModification(std::move(token)); runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < range.x(); i++) { proxy[i].send(); } @@ -240,7 +240,7 @@ TEST_F(TestInsert, test_insert_send_dense_node_1) { /// ::fmt::print("num inserted={}\n", num_inserted); // Relies on default mapping equally distributing - if (this_node == 1 || (this_node == 0 && num_nodes == 1)) { + if (this_node == vt::NodeT{1} || (this_node == vt::NodeT{0} && num_nodes == vt::NodeT{1})) { EXPECT_EQ(num_inserted, num_elms_per_node * num_nodes); EXPECT_EQ(num_work, num_elms_per_node * num_nodes); } @@ -260,15 +260,15 @@ TEST_F(TestInsert, test_insert_send_sparse_node_1) { .wait(); auto token = proxy.beginModification(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < range.x(); i+=16) { - proxy[i].insertAt(token, (this_node + 1) % num_nodes); + proxy[i].insertAt(token, (this_node + vt::NodeT{1}) % num_nodes); } } proxy.finishModification(std::move(token)); runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < range.x(); i+=16) { proxy[i].send(); } @@ -277,7 +277,7 @@ TEST_F(TestInsert, test_insert_send_sparse_node_1) { /// ::fmt::print("num inserted={}\n", num_inserted); // Relies on default mapping equally distributing - if (this_node == 1 || (this_node == 0 && num_nodes == 1)) { + if (this_node == vt::NodeT{1} || (this_node == vt::NodeT{0} && num_nodes == vt::NodeT{1})) { EXPECT_EQ(num_inserted, num_elms_per_node * num_nodes); EXPECT_EQ(num_work, num_elms_per_node * num_nodes); } diff --git a/tests/unit/collection/test_lb.extended.cc b/tests/unit/collection/test_lb.extended.cc index bb92395840..8fbb665c6e 100644 --- a/tests/unit/collection/test_lb.extended.cc +++ b/tests/unit/collection/test_lb.extended.cc @@ -163,7 +163,7 @@ TEST_F(TestLoadBalancerOther, test_make_graph_symmetric) { // setup auto const this_node = theContext()->getNode(); auto const num_nodes = theContext()->getNumNodes(); - auto const next_node = (this_node + 1) % num_nodes; + auto const next_node = (this_node + vt::NodeT{1}) % num_nodes; auto id_from = elm::ElmIDBits::createCollectionImpl(true, 1, this_node, this_node); @@ -189,13 +189,13 @@ TEST_F(TestLoadBalancerOther, test_make_graph_symmetric) { vt::theLBManager()->destroyLB(); // assert - if (num_nodes == 1) { + if (num_nodes == vt::NodeT{1}) { ASSERT_EQ(comm_data->size(), 1); return; } ASSERT_EQ(comm_data->size(), 2); - auto const prev_node = (this_node + num_nodes - 1) % num_nodes; + auto const prev_node = (this_node + num_nodes - NodeT{1}) % num_nodes; bool this_to_next = false, prev_to_this = false; for (auto&& elm : *comm_data) { diff --git a/tests/unit/collection/test_lb_lite.extended.cc b/tests/unit/collection/test_lb_lite.extended.cc index 6fdad450cc..16dcd03cce 100644 --- a/tests/unit/collection/test_lb_lite.extended.cc +++ b/tests/unit/collection/test_lb_lite.extended.cc @@ -142,7 +142,7 @@ TEST_F(TestLB, test_lb_1) { }); auto total_time = vt::timing::getCurrentTime() - cur_time; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { fmt::print("iteration: iter={},time={}\n", i, total_time); } @@ -152,7 +152,7 @@ TEST_F(TestLB, test_lb_1) { // TEST_F(TestLB, test_lb_multi_1) { // auto const& this_node = theContext()->getNode(); -// if (this_node == 0) { +// if (this_node == vt::NodeT{0}) { // auto const& range = Index1D(64); // auto proxy_1 = theCollection()->construct(range); // auto proxy_2 = theCollection()->construct(range); @@ -164,7 +164,7 @@ TEST_F(TestLB, test_lb_1) { // TEST_F(TestLB, test_lb_multi_2) { // auto const& this_node = theContext()->getNode(); -// if (this_node == 0) { +// if (this_node == vt::NodeT{0}) { // auto const& range = Index1D(32); // auto proxy_1 = theCollection()->construct(range); // auto proxy_2 = theCollection()->construct(range); diff --git a/tests/unit/collection/test_list_insert.cc b/tests/unit/collection/test_list_insert.cc index 7dd0504940..263d169d5d 100644 --- a/tests/unit/collection/test_list_insert.cc +++ b/tests/unit/collection/test_list_insert.cc @@ -183,8 +183,8 @@ struct MyMapper : vt::mapping::BaseMapper { ).getProxy(); } - vt::NodeType map(IndexT* idx, int ndim, vt::NodeType num_nodes) override { - return idx->x() % num_nodes; + vt::NodeT map(IndexT* idx, int ndim, vt::NodeT num_nodes) override { + return NodeT{idx->x()} % num_nodes; } }; @@ -254,7 +254,7 @@ TEST_F(TestListInsert, test_bounded_list_insert_here_3) { std::vector>> elms; for (int i = 0; i < range.x(); i++) { - if (i % num_nodes == this_node) { + if (vt::NodeT{i} % num_nodes == this_node) { Index1D ix{i}; elms.emplace_back( std::make_tuple(ix, std::make_unique()) @@ -287,7 +287,7 @@ TEST_F(TestListInsert, test_bounded_list_insert_here_no_default_constructor) { std::vector>> elms; for (int i = 0; i < range.x(); i++) { - if (i % num_nodes == this_node) { + if (vt::NodeT{i} % num_nodes == this_node) { Index1D ix{i}; elms.emplace_back( std::make_tuple(ix, std::make_unique(0)) @@ -321,7 +321,7 @@ TEST_F(TestListInsert, test_unbounded_list_insert_here_4) { std::vector>> elms; for (int i = 0; i < range.x(); i++) { - if (i % num_nodes == this_node) { + if (vt::NodeT{i} % num_nodes == this_node) { Index1D ix{i}; elms.emplace_back( std::make_tuple(ix, std::make_unique()) @@ -354,7 +354,7 @@ TEST_F(TestListInsert, test_unbounded_list_insert_here_no_default_constructor) { std::vector>> elms; for (int i = 0; i < range.x(); i++) { - if (i % num_nodes == this_node) { + if (vt::NodeT{i} % num_nodes == this_node) { Index1D ix{i}; elms.emplace_back( std::make_tuple(ix, std::make_unique(0)) @@ -383,11 +383,11 @@ TEST_F(TestListInsert, test_unbounded_list_insert_here_no_default_constructor_em auto const num_nodes = theContext()->getNumNodes(); auto const this_node = theContext()->getNode(); - auto const range = Index1D((num_nodes - 1) * num_elms_per_node); + auto const range = Index1D((num_nodes.get() - 1) * num_elms_per_node); std::vector>> elms; for (int i = 0; i < range.x(); i++) { - if (i % (num_nodes - 1) == this_node) { + if (i % (num_nodes - NodeT{1}) == this_node) { Index1D ix{i}; elms.emplace_back( std::make_tuple(ix, std::make_unique(0)) @@ -403,7 +403,7 @@ TEST_F(TestListInsert, test_unbounded_list_insert_here_no_default_constructor_em .template mapperObjGroupConstruct>() .wait(); - if (this_node < num_nodes - 1) { + if (this_node < num_nodes - NodeT{1}) { EXPECT_EQ(num_inserted, num_elms_per_node); } else { EXPECT_EQ(num_inserted, 0); @@ -413,7 +413,7 @@ TEST_F(TestListInsert, test_unbounded_list_insert_here_no_default_constructor_em runInEpochCollective([&]{ proxy.broadcast(); }); - if (this_node < num_nodes - 1) { + if (this_node < num_nodes - NodeT{1}) { // all ranks broadcast to all other ranks EXPECT_EQ(num_work, num_elms_per_node * num_nodes); } else { @@ -461,7 +461,7 @@ TEST_F(TestListInsert, test_bounded_mix_list_insert_no_default_constructor) { std::vector>> elms; for (int i = range.x() / 2; i < range.x(); i++) { - if (i % num_nodes == this_node) { + if (vt::NodeT{i} % num_nodes == this_node) { Index1D ix{i}; elms.emplace_back( std::make_tuple(ix, std::make_unique(0)) diff --git a/tests/unit/collection/test_mapping.cc b/tests/unit/collection/test_mapping.cc index eeff58ccc1..07d6bdad5c 100644 --- a/tests/unit/collection/test_mapping.cc +++ b/tests/unit/collection/test_mapping.cc @@ -69,13 +69,13 @@ struct MyMapper : vt::mapping::BaseMapper { ).getProxy(); } - vt::NodeType map(IndexT* idx, int ndim, vt::NodeType num_nodes) override { + vt::NodeT map(IndexT* idx, int ndim, vt::NodeT num_nodes) override { uint64_t val = 0; for (int i = 0; i < ndim; i++) { auto dval = static_cast(idx->get(i)); val ^= dval << (i * 16); } - return val % num_nodes; + return NodeT{val} % num_nodes; } }; @@ -176,6 +176,8 @@ TYPED_TEST_P(TestMapping, test_custom_mapping_1) { auto my_proxy_raw = MapperType::construct(); objgroup::proxy::Proxy my_proxy{my_proxy_raw}; + fmt::print("We in here 1\n"); + int counter = 0; range.foreach([&](IndexType test_idx) { if (my_proxy.get()->map(&test_idx, ndims, num_nodes) == this_node) { @@ -183,11 +185,16 @@ TYPED_TEST_P(TestMapping, test_custom_mapping_1) { } }); + fmt::print("We in here 2\n"); + auto proxy = vt::makeCollection("test_custom_mapping_1") .bulkInsert(range) .mapperObjGroup(my_proxy) .wait(); + + fmt::print("We in here 3\n"); + vt::runInEpochCollective([&]{ proxy.template broadcastCollective>(); }); @@ -223,39 +230,39 @@ struct MyDistMapper : vt::mapping::BaseMapper { } MyDistMapper() - : my_state((theContext()->getNode() * 2993ull) << 5) + : my_state((theContext()->getNode().get() * 2993ull) << 5) { } struct GetMapMsg : vt::Message { GetMapMsg() = default; - GetMapMsg(IndexT in_idx, NodeType in_request_node) + GetMapMsg(IndexT in_idx, NodeT in_request_node) : idx_(in_idx), request_node_(in_request_node) { } IndexT idx_ = {}; - NodeType request_node_ = uninitialized_destination; + NodeT request_node_ = {}; }; struct AnswerMsg : vt::Message { AnswerMsg() = default; - explicit AnswerMsg(NodeType in_answer) + explicit AnswerMsg(NodeT in_answer) : answer_(in_answer) { } - IndexT idx_ = {}; - NodeType answer_ = uninitialized_destination; + + NodeT answer_ = {}; }; - vt::NodeType map(IndexT* idx, int ndim, vt::NodeType num_nodes) override { + vt::NodeT map(IndexT* idx, int ndim, vt::NodeT num_nodes) override { uint64_t val = 0; for (int i = 0; i < ndim; i++) { auto dval = static_cast(idx->get(i)); val ^= dval << (i * 16); } - auto const owner = static_cast(val % num_nodes); - //vt_print(gen, "map: idx={}, ndim={}, owner={}\n", *idx, ndim, owner); + auto const owner = NodeT{val % num_nodes.get()}; + vt_print(gen, "map: idx={}, ndim={}, owner={}\n", *idx, ndim, owner); if (owner == theContext()->getNode()) { /// get to decide the mapping - return (val ^ my_state) % num_nodes; + return NodeT{(val ^ my_state) % num_nodes.get()}; } else { auto ep = theTerm()->makeEpochRooted("mapTest", term::UseDS{true}); theMsg()->pushEpoch(ep); @@ -265,29 +272,28 @@ struct MyDistMapper : vt::mapping::BaseMapper { theMsg()->popEpoch(ep); theTerm()->finishedEpoch(ep); vt::runSchedulerThrough(ep); - vtAssertExpr(cur_answer != uninitialized_destination); + vtAssertExpr(cur_answer != NodeT{}); auto const ret = cur_answer; - cur_answer = uninitialized_destination; + cur_answer = NodeT{}; return ret; } } void getMap(GetMapMsg* msg) { - //vt_print(gen, "getMap: idx={}, request_node={}\n", msg->idx_, msg->request_node_); auto node = map(&msg->idx_, msg->idx_.ndims(), theContext()->getNumNodes()); auto r = msg->request_node_; proxy[r].template send::answer>(node); } void answer(AnswerMsg* msg) { - //vt_print(gen, "answer: answer={}\n", msg->answer_); - vtAssertExpr(cur_answer == uninitialized_destination); + vt_print(gen, "answer: answer={}\n", msg->answer_); + vtAssertExpr(cur_answer == NodeT{}); cur_answer = msg->answer_; } private: uint64_t my_state = 0; - NodeType cur_answer = uninitialized_destination; + NodeT cur_answer = {}; objgroup::proxy::Proxy> proxy; }; diff --git a/tests/unit/collection/test_model_comm_overhead.nompi.cc b/tests/unit/collection/test_model_comm_overhead.nompi.cc index f193a0db56..5b146b99b2 100644 --- a/tests/unit/collection/test_model_comm_overhead.nompi.cc +++ b/tests/unit/collection/test_model_comm_overhead.nompi.cc @@ -114,13 +114,13 @@ TEST_F(TestModelCommOverhead, test_model_comm_overhead_1) { // For simplicity's sake, the elements are on the home node // Element 1 (home node == 1) - ElementIDStruct const elem1 = {1, 1}; + ElementIDStruct const elem1 = {1, NodeT{1}}; // Element 2 (home node == 2) - ElementIDStruct const elem2 = {2, 2}; + ElementIDStruct const elem2 = {2, NodeT{2}}; // Element 3 (home node == 3) - ElementIDStruct const elem3 = {3, 3}; + ElementIDStruct const elem3 = {3, NodeT{3}}; ProcLoadMap proc_load = {{0, LoadMapType{{elem2, {TimeType{150}, {}}}}}}; diff --git a/tests/unit/collection/test_model_linear_model.nompi.cc b/tests/unit/collection/test_model_linear_model.nompi.cc index 79ce7752a4..0fb2397303 100644 --- a/tests/unit/collection/test_model_linear_model.nompi.cc +++ b/tests/unit/collection/test_model_linear_model.nompi.cc @@ -98,7 +98,7 @@ struct StubModel : LoadModel { TEST_F(TestLinearModel, test_model_linear_model_1) { constexpr int32_t num_test_interations = 6; - NodeType this_node = 0; + NodeT this_node = NodeT{0}; auto test_model = std::make_shared(std::make_shared(), 4); diff --git a/tests/unit/collection/test_model_multiple_phases.nompi.cc b/tests/unit/collection/test_model_multiple_phases.nompi.cc index b61c94851c..c289082b9e 100644 --- a/tests/unit/collection/test_model_multiple_phases.nompi.cc +++ b/tests/unit/collection/test_model_multiple_phases.nompi.cc @@ -97,7 +97,7 @@ struct StubModel : LoadModel { }; TEST_F(TestModelMultiplePhases, test_model_multiple_phases_1) { - NodeType this_node = 0; + NodeT this_node = NodeT{0}; std::unordered_map proc_loads = { {0, LoadMapType{ {ElementIDStruct{1,this_node}, {TimeType{10}, {}}}, diff --git a/tests/unit/collection/test_model_naive_persistence.nompi.cc b/tests/unit/collection/test_model_naive_persistence.nompi.cc index 6f8e678510..2e38cbf142 100644 --- a/tests/unit/collection/test_model_naive_persistence.nompi.cc +++ b/tests/unit/collection/test_model_naive_persistence.nompi.cc @@ -100,7 +100,7 @@ struct StubModel : LoadModel { }; TEST_F(TestModelNaivePersistence, test_model_naive_persistence_1) { - NodeType this_node = 0; + NodeT this_node = NodeT{0}; std::unordered_map proc_loads = { {0, LoadMapType{ {ElementIDStruct{1,this_node}, {TimeType{10}, {}}}, diff --git a/tests/unit/collection/test_model_norm.nompi.cc b/tests/unit/collection/test_model_norm.nompi.cc index 2765837a7b..5c325bdb9d 100644 --- a/tests/unit/collection/test_model_norm.nompi.cc +++ b/tests/unit/collection/test_model_norm.nompi.cc @@ -103,7 +103,7 @@ struct StubModel : LoadModel { }; TEST_F(TestModelNorm, test_model_norm_1) { - NodeType this_node = 0; + NodeT this_node = NodeT{0}; ProcLoadMap proc_load = { {0, LoadMapType{ @@ -134,7 +134,7 @@ TEST_F(TestModelNorm, test_model_norm_1) { } TEST_F(TestModelNorm, test_model_norm_2) { - NodeType this_node = 0; + NodeT this_node = NodeT{0}; ProcLoadMap proc_load = { {0, LoadMapType{ @@ -163,7 +163,7 @@ TEST_F(TestModelNorm, test_model_norm_2) { } TEST_F(TestModelNorm, test_model_norm_3) { - NodeType this_node = 0; + NodeT this_node = NodeT{0}; ProcLoadMap proc_load = { {0, LoadMapType{ diff --git a/tests/unit/collection/test_model_persistence_median_last_n.nompi.cc b/tests/unit/collection/test_model_persistence_median_last_n.nompi.cc index f7a91ea145..50e2fc3648 100644 --- a/tests/unit/collection/test_model_persistence_median_last_n.nompi.cc +++ b/tests/unit/collection/test_model_persistence_median_last_n.nompi.cc @@ -98,7 +98,7 @@ struct StubModel : LoadModel { TEST_F(TestModelPersistenceMedianLastN, test_model_persistence_median_last_n_1) { constexpr int32_t num_total_phases = 7; - NodeType this_node = 0; + NodeT this_node = NodeT{0}; auto test_model = std::make_shared(std::make_shared(), 4); diff --git a/tests/unit/collection/test_model_raw_data.nompi.cc b/tests/unit/collection/test_model_raw_data.nompi.cc index 614e54e8b1..ecae81175f 100644 --- a/tests/unit/collection/test_model_raw_data.nompi.cc +++ b/tests/unit/collection/test_model_raw_data.nompi.cc @@ -64,7 +64,7 @@ using vt::vrt::collection::balance::PhaseOffset; using vt::vrt::collection::balance::SubphaseLoadMapType; TEST_F(TestRawData, test_model_raw_data_scalar) { - NodeType this_node = 0; + NodeT this_node = NodeT{0}; auto test_model = std::make_shared(); diff --git a/tests/unit/collection/test_model_select_subphases.nompi.cc b/tests/unit/collection/test_model_select_subphases.nompi.cc index dc97d55528..904e2b2df1 100644 --- a/tests/unit/collection/test_model_select_subphases.nompi.cc +++ b/tests/unit/collection/test_model_select_subphases.nompi.cc @@ -108,7 +108,7 @@ struct StubModel : LoadModel { }; TEST_F(TestModelSelectSubphases, test_model_select_subphases_1) { - NodeType this_node = 0; + NodeT this_node = NodeT{0}; ElementIDStruct id1{1,this_node}; ElementIDStruct id2{2,this_node}; @@ -155,7 +155,7 @@ TEST_F(TestModelSelectSubphases, test_model_select_subphases_1) { } TEST_F(TestModelSelectSubphases, test_model_select_subphases_2) { - NodeType this_node = 0; + NodeT this_node = NodeT{0}; ProcLoadMap proc_load = { {0, LoadMapType{ diff --git a/tests/unit/collection/test_model_weighted_communication_volume.nompi.cc b/tests/unit/collection/test_model_weighted_communication_volume.nompi.cc index 6271721956..3a0db3a6fa 100644 --- a/tests/unit/collection/test_model_weighted_communication_volume.nompi.cc +++ b/tests/unit/collection/test_model_weighted_communication_volume.nompi.cc @@ -116,13 +116,13 @@ struct StubModel : LoadModel { TEST_F(TestModelWeightedCommunicationVolume, test_model) { // For simplicity's sake, the elements are on the home node // Element 1 (home node == 1) - ElementIDStruct const elem1 = {1, 1}; + ElementIDStruct const elem1 = {1, NodeT{1}}; // Element 2 (home node == 2) - ElementIDStruct const elem2 = {2, 2}; + ElementIDStruct const elem2 = {2, NodeT{2}}; // Element 3 (home node == 3) - ElementIDStruct const elem3 = {3, 3}; + ElementIDStruct const elem3 = {3, NodeT{3}}; ProcLoadMap proc_load = {{0, LoadMapType{{elem2, {TimeType{150}, {}}}}}}; diff --git a/tests/unit/collection/test_model_weighted_messages.nompi.cc b/tests/unit/collection/test_model_weighted_messages.nompi.cc index 91cce389c4..f6f7571f8a 100644 --- a/tests/unit/collection/test_model_weighted_messages.nompi.cc +++ b/tests/unit/collection/test_model_weighted_messages.nompi.cc @@ -112,13 +112,13 @@ struct StubModel : LoadModel { TEST_F(TestModelWeightedMessages, test_model) { // For simplicity's sake, the elements are on the home node // Element 1 (home node == 1) - ElementIDStruct const elem1 = {1, 1}; + ElementIDStruct const elem1 = {1, NodeT{1}}; // Element 2 (home node == 2) - ElementIDStruct const elem2 = {2, 2}; + ElementIDStruct const elem2 = {2, NodeT{2}}; // Element 3 (home node == 3) - ElementIDStruct const elem3 = {3, 3}; + ElementIDStruct const elem3 = {3, NodeT{3}}; ProcLoadMap proc_load = {{0, LoadMapType{{elem2, {TimeType{150}, {}}}}}}; diff --git a/tests/unit/collection/test_promote.cc b/tests/unit/collection/test_promote.cc index 95d9ba0156..c299c927b0 100644 --- a/tests/unit/collection/test_promote.cc +++ b/tests/unit/collection/test_promote.cc @@ -83,7 +83,7 @@ TEST_F(TestCollectionPromoteMsg, test_collection_promote_1) { auto proxy = theCollection()->constructCollective( num_elems, "test_collection_promote_1" ); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast("hello there"); } } diff --git a/tests/unit/collection/test_query_context.cc b/tests/unit/collection/test_query_context.cc index 86470e0bde..ef12bcb060 100644 --- a/tests/unit/collection/test_query_context.cc +++ b/tests/unit/collection/test_query_context.cc @@ -75,7 +75,7 @@ static constexpr int32_t const num_elms_per_node = 8; TEST_F(TestQueryContext, test_query_context_broadcast_1) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const& range = Index1D(num_nodes * num_elms_per_node); auto proxy = theCollection()->construct( range, "test_query_context_broadcast_1" @@ -89,7 +89,7 @@ TEST_F(TestQueryContext, test_query_context_broadcast_1) { TEST_F(TestQueryContext, test_query_context_send_1) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const& range = Index1D(num_nodes * num_elms_per_node); auto proxy = theCollection()->construct( range, "test_query_context_send_1" diff --git a/tests/unit/collection/test_reduce_collection.cc b/tests/unit/collection/test_reduce_collection.cc index 231a0bd43e..84a950ceb6 100644 --- a/tests/unit/collection/test_reduce_collection.cc +++ b/tests/unit/collection/test_reduce_collection.cc @@ -51,7 +51,7 @@ TEST_P(TestReduceCollection, test_reduce_op) { using namespace reduce; auto const my_node = theContext()->getNode(); - auto const root = 0; + auto const root = NodeT{0}; if (my_node == root) { auto reduce_case = GetParam(); diff --git a/tests/unit/collection/test_reduce_collection_common.h b/tests/unit/collection/test_reduce_collection_common.h index dc650a9003..4394f7a3be 100644 --- a/tests/unit/collection/test_reduce_collection_common.h +++ b/tests/unit/collection/test_reduce_collection_common.h @@ -126,11 +126,11 @@ struct MyCol : Collection { }; struct ColMsg : CollectionMessage { - NodeType from_node; + NodeT from_node; ColMsg() = default; - explicit ColMsg(NodeType const& in_from_node) + explicit ColMsg(NodeT const& in_from_node) : from_node(in_from_node) {} }; diff --git a/tests/unit/collection/test_reduce_collection_handler.h b/tests/unit/collection/test_reduce_collection_handler.h index b5acedcded..e25bf465cc 100644 --- a/tests/unit/collection/test_reduce_collection_handler.h +++ b/tests/unit/collection/test_reduce_collection_handler.h @@ -125,7 +125,7 @@ void colHanVecProxyCB(MyCol* col) { "msg->vec.size={}\n", reduce_msg->getConstVal().vec.size() ); - auto cb = vt::theCB()->makeSend(0); + auto cb = vt::theCB()->makeSend(NodeT{0}); vtAssertExpr(cb.valid()); proxy.reduce>(reduce_msg.get(),cb); } @@ -140,7 +140,7 @@ void colHanNoneCB(MyCol* col) { auto rmsg = vt::makeMessage(); auto proxy = col->getCollectionProxy(); - auto cb = vt::theCB()->makeSend(0); + auto cb = vt::theCB()->makeSend(NodeT{0}); vtAssertExpr(cb.valid()); proxy.reduce(rmsg.get(),cb); } diff --git a/tests/unit/collection/test_reduce_collection_race.cc b/tests/unit/collection/test_reduce_collection_race.cc index 37459a7bc6..5bca3c437d 100644 --- a/tests/unit/collection/test_reduce_collection_race.cc +++ b/tests/unit/collection/test_reduce_collection_race.cc @@ -65,7 +65,7 @@ struct ReduceFunctor { static void handler(MyCol* col) { auto proxy = col->getCollectionProxy(); auto msg = vt::makeMessage(static_cast(col->getIndex().x())); - auto cb = vt::theCB()->makeSend(0); + auto cb = vt::theCB()->makeSend(NodeT{0}); proxy.reduce>(msg.get(), cb); } diff --git a/tests/unit/collection/test_send.h b/tests/unit/collection/test_send.h index d6b629e06c..75079bc29c 100644 --- a/tests/unit/collection/test_send.h +++ b/tests/unit/collection/test_send.h @@ -186,7 +186,7 @@ void test_collection_send_1(std::string const& label) { using TestParamType = typename ColType::ParamType; auto const& this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const& col_size = 32; auto range = TestIndex(col_size); TestParamType args = ConstructTuple::construct(); @@ -208,7 +208,7 @@ void test_collection_send_sz_1() { using TestParamType = typename ColType::ParamType; auto const& this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const& col_size = 32; auto range = TestIndex(col_size); TestParamType args = ConstructTuple::construct(); @@ -229,7 +229,7 @@ void test_collection_send_ptm_1(std::string const& label) { using TestParamType = typename ColType::ParamType; auto const& this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const& col_size = 32; auto range = TestIndex(col_size); TestParamType args = ConstructTuple::construct(); diff --git a/tests/unit/collectives/test_collectives_reduce.cc b/tests/unit/collectives/test_collectives_reduce.cc index 070c3e8695..8e0ce6e33e 100644 --- a/tests/unit/collectives/test_collectives_reduce.cc +++ b/tests/unit/collectives/test_collectives_reduce.cc @@ -54,7 +54,7 @@ namespace vt { namespace tests { namespace unit { TEST_F(TestReduce, test_reduce_op) { auto const my_node = theContext()->getNode(); - auto const root = 0; + auto const root = NodeT{0}; auto msg = makeMessage(my_node); vt_debug_print(normal, reduce, "msg->num={}\n", msg->num); @@ -90,14 +90,14 @@ struct Hello : vt::Collection { } }; -vt::NodeType map(vt::Index1D* idx, vt::Index1D* max_idx, vt::NodeType num_nodes) { - return (idx->x() % (num_nodes-1))+1; +vt::NodeT map(vt::Index1D* idx, vt::Index1D* max_idx, vt::NodeT num_nodes) { + return NodeT{(idx->x() % (num_nodes.get()-1))+1}; } TEST_F(TestReduce, test_reduce_with_no_elements_on_root_rank) { SET_MIN_NUM_NODES_CONSTRAINT(2); - vt::NodeType this_node = vt::theContext()->getNode(); + vt::NodeT this_node = vt::theContext()->getNode(); int32_t num_elms = 16; @@ -112,7 +112,7 @@ TEST_F(TestReduce, test_reduce_with_no_elements_on_root_rank) { .bulkInsert() .wait(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } } diff --git a/tests/unit/collectives/test_collectives_reduce.extended.cc b/tests/unit/collectives/test_collectives_reduce.extended.cc index e8964fbbf9..35d318592e 100644 --- a/tests/unit/collectives/test_collectives_reduce.extended.cc +++ b/tests/unit/collectives/test_collectives_reduce.extended.cc @@ -54,7 +54,7 @@ namespace vt { namespace tests { namespace unit { TEST_F(TestReduce, test_reduce_plus_default_op) { auto const my_node = theContext()->getNode(); - auto const root = 0; + auto const root = NodeT{0}; auto msg = makeMessage(my_node); vt_debug_print(normal, reduce, "msg->num={}\n", msg->getConstVal()); @@ -65,7 +65,7 @@ TEST_F(TestReduce, test_reduce_plus_default_op) { TEST_F(TestReduce, test_reduce_max_default_op) { auto const my_node = theContext()->getNode(); - auto const root = 0; + auto const root = NodeT{0}; auto msg = makeMessage(my_node); vt_debug_print(normal, reduce, "msg->num={}\n", msg->getConstVal()); @@ -76,7 +76,7 @@ TEST_F(TestReduce, test_reduce_max_default_op) { TEST_F(TestReduce, test_reduce_min_default_op) { auto const my_node = theContext()->getNode(); - auto const root = 0; + auto const root = NodeT{0}; auto msg = makeMessage(my_node); vt_debug_print(normal, reduce, "msg->num={}\n", msg->getConstVal()); @@ -91,7 +91,7 @@ TEST_F(TestReduce, test_reduce_vec_bool_msg) { vecOfBool.push_back(false); vecOfBool.push_back(true); - auto const root = 0; + auto const root = NodeT{0}; auto msg = makeMessage>(vecOfBool); theCollective()->global()->reduce< PlusOp>, Verify @@ -106,7 +106,7 @@ TEST_F(TestReduce, test_reduce_vec_int_msg) { vecOfInt.push_back(2); vecOfInt.push_back(3); - auto const root = 0; + auto const root = NodeT{0}; auto const default_proxy = theObjGroup()->getDefault(); default_proxy.reduce< PlusOp>, diff --git a/tests/unit/collectives/test_collectives_scatter.extended.cc b/tests/unit/collectives/test_collectives_scatter.extended.cc index 4350a7aa14..c09bc64ba3 100644 --- a/tests/unit/collectives/test_collectives_scatter.extended.cc +++ b/tests/unit/collectives/test_collectives_scatter.extended.cc @@ -83,11 +83,11 @@ TEST_F(TestScatter, test_scatter_1) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const& elm_size = sizeof(int) * num_elms; auto const& total_size = elm_size * num_nodes; theCollective()->scatter( - total_size,elm_size,nullptr,[](NodeType node, void* ptr){ + total_size,elm_size,nullptr,[](NodeT node, void* ptr){ auto ptr_out = reinterpret_cast(ptr); for (std::size_t i = 0; i < num_elms; i++) { *(ptr_out + i) = node * 10 + i; diff --git a/tests/unit/collectives/test_mpi_collective.cc b/tests/unit/collectives/test_mpi_collective.cc index f137195344..827e36a78d 100644 --- a/tests/unit/collectives/test_mpi_collective.cc +++ b/tests/unit/collectives/test_mpi_collective.cc @@ -255,7 +255,7 @@ TEST_F(TestMPICollective, test_mpi_collective_4) { EXPECT_EQ(reduce_val_out, num_nodes); // Broadcast out node 0's order to confirm with all other nodes - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto msg = makeMessage(run_order); theMsg()->broadcastMsg(msg); } diff --git a/tests/unit/diagnostics/test_diagnostic_value.cc b/tests/unit/diagnostics/test_diagnostic_value.cc index ae4bb71fdf..bcb5fec230 100644 --- a/tests/unit/diagnostics/test_diagnostic_value.cc +++ b/tests/unit/diagnostics/test_diagnostic_value.cc @@ -105,7 +105,7 @@ TEST_F(TestDiagnosticValue, test_diagnostic_value_1) { auto num_nodes = theContext()->getNumNodes(); auto this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { EXPECT_TRUE(out.min_.template is()); EXPECT_TRUE(out.max_.template is()); EXPECT_TRUE(out.sum_.template is()); @@ -140,7 +140,7 @@ TEST_F(TestDiagnosticValue, test_diagnostic_value_2) { return; } - double num_to_set = this_node == 0 ? 100 : 175; + double num_to_set = this_node == vt::NodeT{0} ? 100 : 175; DiagnosticValue val{ test_key, @@ -170,7 +170,7 @@ TEST_F(TestDiagnosticValue, test_diagnostic_value_2) { val.reduceOver(diag.get(), &out, snapshot); }); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { EXPECT_TRUE(out.min_.template is()); EXPECT_TRUE(out.max_.template is()); EXPECT_TRUE(out.sum_.template is()); diff --git a/tests/unit/epoch/test_epoch.nompi.cc b/tests/unit/epoch/test_epoch.nompi.cc index e7f7a2226f..5b06961cce 100644 --- a/tests/unit/epoch/test_epoch.nompi.cc +++ b/tests/unit/epoch/test_epoch.nompi.cc @@ -77,7 +77,7 @@ TEST_P(TestEpochParam, basic_test_epoch_collective_1) { } TEST_P(TestEpochParam, basic_test_epoch_rooted_1) { - auto const& n = 48; + auto const& n = NodeT{48}; auto const start_seq = GetParam(); auto epoch = epoch::EpochManip::generateEpoch( true, n @@ -95,7 +95,7 @@ TEST_P(TestEpochParam, basic_test_epoch_rooted_1) { TEST_P(TestEpochParam, basic_test_epoch_category_1) { auto const start_seq = GetParam(); auto epoch = epoch::EpochManip::generateEpoch( - false, uninitialized_destination, + false, NodeT{}, epoch::eEpochCategory::InsertEpoch ); epoch::EpochManip::setSeq(epoch, start_seq); @@ -109,7 +109,7 @@ TEST_P(TestEpochParam, basic_test_epoch_category_1) { } TEST_P(TestEpochParam, basic_test_epoch_all_1) { - auto const& n = 48; + auto const& n = NodeT{48}; auto const start_seq = GetParam(); auto epoch = epoch::EpochManip::generateEpoch( true, n, epoch::eEpochCategory::InsertEpoch diff --git a/tests/unit/group/test_group.cc b/tests/unit/group/test_group.cc index d3c425ae03..e6e4395f85 100644 --- a/tests/unit/group/test_group.cc +++ b/tests/unit/group/test_group.cc @@ -77,11 +77,11 @@ struct TestGroup : TestParallelHarness { TEST_F(TestGroup, test_group_range_construct_1) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - NodeType const lo = 0; - NodeType const hi = num_nodes / 2; + NodeT const lo = NodeT{0}; + NodeT const hi = num_nodes / NodeT{2}; runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto list = std::make_unique(lo,hi); theGroup()->newGroup( std::move(list), [](GroupType group){ @@ -105,13 +105,13 @@ TEST_F(TestGroup, test_group_range_construct_1) { TEST_F(TestGroup, test_group_range_construct_2) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - NodeType const lo = 1; - NodeType const max_val = 5; - NodeType const hi = std::min(num_nodes,max_val); + NodeT const lo = NodeT{1}; + NodeT const max_val = NodeT{5}; + NodeT const hi = std::min(num_nodes,max_val); runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto list = std::make_unique(lo,hi); theGroup()->newGroup( std::move(list), [](GroupType group){ diff --git a/tests/unit/group/test_group.extended.cc b/tests/unit/group/test_group.extended.cc index a222164da0..7ef71baaa9 100644 --- a/tests/unit/group/test_group.extended.cc +++ b/tests/unit/group/test_group.extended.cc @@ -60,11 +60,11 @@ static void msgHandlerGroup(MySimpleMsg* msg) { // demonstrate collective group creation and broadcast to that group static inline void activeMessageGroupCollective() { - NodeType const this_node = ::vt::theContext()->getNode(); + auto const this_node = ::vt::theContext()->getNode(); auto const is_even_node = this_node % 2 == 0; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { int val = 10; std::this_thread::sleep_for(std::chrono::seconds(2)); vt::theSched()->runSchedulerWhile( diff --git a/tests/unit/lb/test_lb_data_comm.cc b/tests/unit/lb/test_lb_data_comm.cc index 9fa555fadf..649ba7ed09 100644 --- a/tests/unit/lb/test_lb_data_comm.cc +++ b/tests/unit/lb/test_lb_data_comm.cc @@ -158,7 +158,7 @@ void MyObj::simulateObjGroupColTSends(ColProxyMsg* msg) { auto proxy = msg->proxy; auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; for (int i = 0; i < dim1; i++) { vt::Index1D idx{i}; auto node = vt::theCollection()->getMappedNode(proxy, idx); @@ -174,7 +174,7 @@ void MyObj::simulateObjGroupObjGroupSends(ProxyMsg* msg) { auto obj_proxy = msg->obj_proxy; auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; for (int i = 0; i < num_sends; i++) { obj_proxy[next].template send(); } @@ -193,7 +193,7 @@ void simulateColTObjGroupSends(MyCol* col, ProxyMsg* msg) { auto obj_proxy = msg->obj_proxy; auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; for (int i = 0; i < num_sends; i++) { obj_proxy[next].template send(); } @@ -204,7 +204,7 @@ void bareDummyHandler(MyObjMsg* msg) {} void simulateColTHandlerSends(MyCol* col) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; for (int i = 0; i < num_sends; i++) { auto msg2 = makeMessage(); vt::theMsg()->sendMsg(next, msg2); @@ -214,7 +214,7 @@ void simulateColTHandlerSends(MyCol* col) { void MyObj::simulateObjGroupHandlerSends(MyMsg* msg) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; for (int i = 0; i < num_sends; i++) { auto msg2 = makeMessage(); vt::theMsg()->sendMsg(next, msg2); @@ -225,7 +225,7 @@ void simulateHandlerColTSends(ColProxyMsg* msg) { auto proxy = msg->proxy; auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; for (int i = 0; i < dim1; i++) { vt::Index1D idx{i}; auto node = vt::theCollection()->getMappedNode(proxy, idx); @@ -241,7 +241,7 @@ void simulateHandlerObjGroupSends(ProxyMsg* msg) { auto obj_proxy = msg->obj_proxy; auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; for (int i = 0; i < num_sends; i++) { obj_proxy[next].template send(); } @@ -250,7 +250,7 @@ void simulateHandlerObjGroupSends(ProxyMsg* msg) { void simulateHandlerHandlerSends(MyMsg* msg) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; for (int i = 0; i < num_sends; i++) { auto msg2 = makeMessage(); vt::theMsg()->sendMsg(next, msg2); @@ -365,7 +365,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_col_to_objgroup_send) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; auto op = obj_proxy.getProxy(); // Check that communication exists on the send side as expected @@ -429,7 +429,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_objgroup_to_col_send) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto prev = this_node - 1 >= 0 ? this_node - 1 : num_nodes-1; + auto prev = NodeT{this_node.get() - 1 >= 0 ? this_node.get() - 1 : num_nodes.get()-1}; auto op = obj_proxy.getProxy(); // Check that communication exists on the receive side as expected @@ -483,7 +483,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_objgroup_to_objgroup_send) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; auto opa = obj_proxy_a.getProxy(); auto opb = obj_proxy_b.getProxy(); auto ida = vt::elm::ElmIDBits::createObjGroup(opa, this_node).id; @@ -520,7 +520,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_col_send) { vt::runInEpochCollective("simulateHandlerColTSends", [&]{ auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; auto msg = makeMessage(proxy); theMsg()->sendMsg(next, msg); }); @@ -541,7 +541,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_col_send) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto prev = this_node - 1 >= 0 ? this_node - 1 : num_nodes-1; + auto prev = NodeT{this_node.get() - 1 >= 0 ? this_node.get() - 1 : num_nodes.get() - 1}; // Check that communication exists on the receive side as expected for (int i = 0; i < dim1; i++) { @@ -601,7 +601,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_col_to_handler_send) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; // Check that communication exists on the send side as expected for (int i = 0; i < dim1; i++) { @@ -651,7 +651,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_objgroup_to_handler_send) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; auto opa = obj_proxy_a.getProxy(); auto ida = vt::elm::ElmIDBits::createObjGroup(opa, this_node).id; @@ -683,7 +683,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_objgroup_send) { vt::runInEpochCollective("simulateHandlerObjGroupSends", [&]{ auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; auto msg = makeMessage(obj_proxy_a); theMsg()->sendMsg(next, msg); }); @@ -696,7 +696,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_objgroup_send) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; auto opa = obj_proxy_a.getProxy(); auto ida = vt::elm::ElmIDBits::createObjGroup(opa, next).id; @@ -724,7 +724,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_handler_send) { vt::runInEpochCollective("simulateHandlerHandlerSends", [&]{ auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; auto msg = makeMessage(); theMsg()->sendMsg(next, msg); }); @@ -737,7 +737,7 @@ TEST_F(TestLBDataComm, test_lb_data_comm_handler_to_handler_send) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = (this_node + 1) % num_nodes; + auto next = (this_node + vt::NodeT{1}) % num_nodes; auto ida = vt::elm::ElmIDBits::createBareHandler(next).id; auto idb = vt::elm::ElmIDBits::createBareHandler(this_node).id; diff --git a/tests/unit/lb/test_offlinelb.cc b/tests/unit/lb/test_offlinelb.cc index 981e09d801..b7a3f60370 100644 --- a/tests/unit/lb/test_offlinelb.cc +++ b/tests/unit/lb/test_offlinelb.cc @@ -63,8 +63,8 @@ struct SimCol : vt::Collection { void handler(Msg* m) { auto const this_node = theContext()->getNode(); auto const num_nodes = theContext()->getNumNodes(); - auto const next_node = (this_node + 1) % num_nodes; - auto const prev_node = this_node - 1 >= 0 ? this_node - 1 : num_nodes - 1; + auto const next_node = (this_node + vt::NodeT{1}) % num_nodes; + auto const prev_node = this_node - NodeT{1} >= 0 ? this_node - NodeT{1} : num_nodes - NodeT{1}; vt_debug_print(terse, lb, "handler: idx={}: elm={}\n", getIndex(), getElmID()); if (m->iter == 0 or m->iter == 3 or m->iter == 6) { EXPECT_EQ(getIndex().x() / 2, this_node); @@ -84,8 +84,8 @@ TEST_F(TestOfflineLB, test_offlinelb_1) { auto const this_node = theContext()->getNode(); auto const num_nodes = theContext()->getNumNodes(); - auto const next_node = (this_node + 1) % num_nodes; - auto const prev_node = this_node - 1 >= 0 ? this_node - 1 : num_nodes - 1; + auto const next_node = (this_node + vt::NodeT{1}) % num_nodes; + auto const prev_node = this_node - NodeT{1} >= 0 ? this_node - NodeT{1} : num_nodes - NodeT{1}; std::unordered_map> ids; int len = 2; diff --git a/tests/unit/lb/test_temperedlb.nompi.cc b/tests/unit/lb/test_temperedlb.nompi.cc index e54fe99618..9003a2210d 100644 --- a/tests/unit/lb/test_temperedlb.nompi.cc +++ b/tests/unit/lb/test_temperedlb.nompi.cc @@ -59,12 +59,12 @@ TimeType setupProblem( std::unordered_map &cur_objs ) { // total load of 29 seconds - cur_objs.emplace(ElementIDStruct{3,0}, 4.0); - cur_objs.emplace(ElementIDStruct{5,0}, 5.0); - cur_objs.emplace(ElementIDStruct{2,0}, 9.0); - cur_objs.emplace(ElementIDStruct{0,0}, 2.0); - cur_objs.emplace(ElementIDStruct{1,0}, 6.0); - cur_objs.emplace(ElementIDStruct{4,0}, 3.0); + cur_objs.emplace(ElementIDStruct{3,NodeT{0}}, 4.0); + cur_objs.emplace(ElementIDStruct{5,NodeT{0}}, 5.0); + cur_objs.emplace(ElementIDStruct{2,NodeT{0}}, 9.0); + cur_objs.emplace(ElementIDStruct{0,NodeT{0}}, 2.0); + cur_objs.emplace(ElementIDStruct{1,NodeT{0}}, 6.0); + cur_objs.emplace(ElementIDStruct{4,NodeT{0}}, 3.0); // compute the load for this processor TimeType my_load = 0; diff --git a/tests/unit/location/test_hops.extended.cc b/tests/unit/location/test_hops.extended.cc index 532c5c576a..33e5dfb672 100644 --- a/tests/unit/location/test_hops.extended.cc +++ b/tests/unit/location/test_hops.extended.cc @@ -141,23 +141,23 @@ TEST_F(TestHops, test_hops_1) { ); for (int i = 0; i < 100; i++) { - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_print(gen, "Doing work stage 1 for iter={}\n", i); } runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(false); } }); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_print(gen, "Doing work stage 2 for iter={}\n", i); } runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(true); } }); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { vt_print(gen, "Running LB for iter={}\n", i); } diff --git a/tests/unit/location/test_location.cc b/tests/unit/location/test_location.cc index 190cd2e50d..eb8b8f2e7c 100644 --- a/tests/unit/location/test_location.cc +++ b/tests/unit/location/test_location.cc @@ -54,7 +54,7 @@ struct TestLocationRoute : TestLocation {}; TEST_F(TestLocation, test_register_and_get_entity) /* NOLINT */ { auto const my_node = vt::theContext()->getNode(); - auto const home = 0; + auto const home = NodeT{0}; auto const entity = location::default_entity; // Register the entity on the node 0 @@ -64,7 +64,7 @@ TEST_F(TestLocation, test_register_and_get_entity) /* NOLINT */ { bool success = false; vt::theLocMan()->virtual_loc->getLocation( - entity, home, [home,&success](vt::NodeType node) { + entity, home, [home,&success](vt::NodeT node) { EXPECT_EQ(home, node); success = true; } @@ -93,17 +93,17 @@ TEST_F(TestLocation, test_register_and_get_multiple_entities) /* NOLINT */ { int check_sum = 0; bool success; - for (auto i = 0; i < nb_nodes; ++i) { + for (auto i = 0; i < nb_nodes.get(); ++i) { success = false; // The entity can be located on the node where it has been registered vt::theLocMan()->virtual_loc->getLocation( - location::default_entity + i, i, - [i, &success, &check_sum, my_node](vt::NodeType node) { + location::default_entity + i, NodeT{i}, + [i, &success, &check_sum, my_node](vt::NodeT node) { auto const cur = vt::theContext()->getNode(); // let p: i == my_node and q: cur == node // we have: p implies q == not(p) or q - EXPECT_TRUE(i != my_node or cur == node); - EXPECT_EQ(i, node); + EXPECT_TRUE(NodeT{i} != my_node or cur == node); + EXPECT_EQ(NodeT{i}, node); success = true; check_sum++; } @@ -113,7 +113,7 @@ TEST_F(TestLocation, test_register_and_get_multiple_entities) /* NOLINT */ { vt::theCollective()->barrier(); - if (i == my_node) { + if (NodeT{i} == my_node) { EXPECT_TRUE(success); EXPECT_EQ(check_sum, i + 1); } @@ -132,10 +132,10 @@ TEST_F(TestLocation, test_unregister_multiple_entities) /* NOLINT */ { // Wait for every nodes to be registered and unregister vt::theCollective()->barrier(); - for (auto i = 0; i < nb_nodes; ++i) { + for (auto i = 0; i < nb_nodes.get(); ++i) { // The entity can be located on the node where it has been registered vt::theLocMan()->virtual_loc->getLocation( - location::default_entity + i, i, [](vt::NodeType node) { + location::default_entity + i, NodeT{i}, [](vt::NodeT node) { // This lambda should not be executed if the unregisterEntity works // correctly FAIL() << "entity should have been yet unregistered"; @@ -149,11 +149,11 @@ TEST_F(TestLocation, test_migrate_entity) /* NOLINT */ { auto const nb_nodes = vt::theContext()->getNumNodes(); // cannot perform entity migration if less than 3 nodes - if (nb_nodes > 2) { + if (nb_nodes.get() > 2) { auto const my_node = vt::theContext()->getNode(); auto const entity = location::default_entity; - auto const old_home = 0; - auto const new_home = 1; + auto const old_home = NodeT{0}; + auto const new_home = NodeT{1}; // Register the entity on the node 0 if (my_node == old_home) { @@ -162,7 +162,7 @@ TEST_F(TestLocation, test_migrate_entity) /* NOLINT */ { bool done = false; vt::theLocMan()->virtual_loc->getLocation( - entity, old_home, [old_home,&done](vt::NodeType node) { + entity, old_home, [old_home,&done](vt::NodeT node) { EXPECT_EQ(old_home, node); done = true; } @@ -182,9 +182,9 @@ TEST_F(TestLocation, test_migrate_entity) /* NOLINT */ { vt::theCollective()->barrier(); - if (my_node > 1) { + if (my_node > NodeT{1}) { vt::theLocMan()->virtual_loc->getLocation( - entity, old_home, [=](vt::NodeType node) { + entity, old_home, [=](vt::NodeT node) { // Edit: the expected node can be either 0 (initial) or 1 (migrated) // The protocol may actually eagerly update other nodes EXPECT_TRUE(node == old_home or node == new_home); @@ -199,11 +199,11 @@ TEST_F(TestLocation, test_migrate_entity_expire_cache) /* NOLINT */ { auto const nb_nodes = vt::theContext()->getNumNodes(); // cannot perform entity migration if less than 3 nodes - if (nb_nodes > 2) { + if (nb_nodes.get() > 2) { auto const my_node = vt::theContext()->getNode(); auto const entity = location::default_entity; - auto const home_node = 0; - auto const migrate_to_node = 1; + auto const home_node = NodeT{0}; + auto const migrate_to_node = NodeT{1}; // Register the entity on the node 0 if (my_node == home_node) { @@ -229,7 +229,7 @@ TEST_F(TestLocation, test_migrate_entity_expire_cache) /* NOLINT */ { bool executed = false; vt::theLocMan()->virtual_loc->getLocation( - entity, home_node, [=,&executed](vt::NodeType resident_node) { + entity, home_node, [=,&executed](vt::NodeT resident_node) { // With a clear cache, the result should always be accurate/up-to-date EXPECT_TRUE(resident_node == migrate_to_node); executed = true; @@ -251,11 +251,13 @@ TEST_F(TestLocation, test_migrate_multiple_entities) /* NOLINT */ { auto const nb_nodes = vt::theContext()->getNumNodes(); // cannot perform entity migration if less than 3 nodes - if (nb_nodes > 2) { + if (nb_nodes.get() > 2) { auto const my_node = vt::theContext()->getNode(); - auto const next_node = (my_node + 1) % nb_nodes; - auto const prev_home = (my_node - 1) >= 0 ? my_node - 1 : nb_nodes-1; - auto const entity = location::default_entity + my_node; + auto const next_node = (my_node + NodeT{1}) % nb_nodes; + auto const prev_home = (my_node - NodeT{1}) >= NodeT{0} ? + my_node - NodeT{1} : + nb_nodes - NodeT{1}; + auto const entity = location::default_entity + my_node.get(); // register the entity on the current node vt::theLocMan()->virtual_loc->registerEntity(entity, my_node); @@ -265,9 +267,9 @@ TEST_F(TestLocation, test_migrate_multiple_entities) /* NOLINT */ { vt::theLocMan()->virtual_loc->entityEmigrated(entity, next_node); auto prev_node = ( - my_node == 0 ? - location::default_entity + nb_nodes - 1 : - location::default_entity + my_node - 1 + my_node == NodeT{0} ? + NodeT{location::default_entity + nb_nodes.get() - 1} : + NodeT{location::default_entity + my_node.get() - 1} ); vt::theLocMan()->virtual_loc->entityImmigrated( prev_node, prev_home, my_node @@ -277,14 +279,14 @@ TEST_F(TestLocation, test_migrate_multiple_entities) /* NOLINT */ { int check_sum = 0; bool success; - for (auto i = 0; i < nb_nodes; ++i) { + for (auto i = 0; i < nb_nodes.get(); ++i) { success = false; // The entity can be located on the node where it has been registered vt::theLocMan()->virtual_loc->getLocation( - location::default_entity + i, i, - [i, &success, &check_sum, nb_nodes](vt::NodeType found) { + location::default_entity + i, NodeT{i}, + [i, &success, &check_sum, nb_nodes](vt::NodeT found) { - auto expected = (i + 1) % nb_nodes; + auto expected = NodeT{(i + 1) % nb_nodes.get()}; EXPECT_EQ(expected, found); success = true; check_sum++; @@ -303,7 +305,7 @@ TEST_F(TestLocation, test_migrate_multiple_entities) /* NOLINT */ { // this test can only be done for cases where getLocation is synchronous -> // local or cache - if (i == my_node || i + 1 == my_node) { + if (NodeT{i} == my_node || NodeT{i + 1} == my_node) { EXPECT_TRUE(success); EXPECT_EQ(check_sum, i + 1); } @@ -318,7 +320,7 @@ TYPED_TEST_P(TestLocationRoute, test_route_entity) { auto const nb_nodes = vt::theContext()->getNumNodes(); auto const my_node = vt::theContext()->getNode(); auto const entity = location::default_entity; - auto const home = 0; + auto const home = NodeT{0}; // Register the entity on the node 0 if (my_node == home) { @@ -359,7 +361,7 @@ TYPED_TEST_P(TestLocationRoute, test_entity_cache_hits) /* NOLINT */ { auto const nb_nodes = vt::theContext()->getNumNodes(); auto const my_node = vt::theContext()->getNode(); auto const entity = location::default_entity; - auto const home = 0; + auto const home = NodeT{0}; auto const nb_rounds = 3; auto nb_received = 0; @@ -377,7 +379,7 @@ TYPED_TEST_P(TestLocationRoute, test_entity_cache_hits) /* NOLINT */ { // finalize if (my_node == home) { - EXPECT_EQ(nb_received, (nb_nodes - 1) * nb_rounds); + EXPECT_EQ(nb_received, (nb_nodes.get() - 1) * nb_rounds); } } @@ -386,22 +388,22 @@ TYPED_TEST_P(TestLocationRoute, test_entity_cache_migrated_entity) /* NOLINT */{ auto const nb_nodes = vt::theContext()->getNumNodes(); // cannot perform entity migration if less than 3 nodes - if (nb_nodes > 2) { + if (nb_nodes.get() > 2) { auto const my_node = vt::theContext()->getNode(); auto const entity = location::default_entity; - auto const home = 0; - auto const new_home = 3; + auto const home = NodeT{0}; + auto const new_home = NodeT{3}; auto const nb_rounds = 5; auto nb_received = 0; - ::vt::runInEpochCollective([my_node, entity] { + ::vt::runInEpochCollective([my_node, entity, home] { // register entity if (my_node == home) { vt::theLocMan()->virtual_loc->registerEntity(entity, my_node); } }); - ::vt::runInEpochCollective([my_node, entity, &nb_received] { + ::vt::runInEpochCollective([my_node, home, new_home, entity, &nb_received] { if (my_node == home) { // migrate entity: unregister it but keep its id in cache vt::theLocMan()->virtual_loc->entityEmigrated(entity, new_home); @@ -429,7 +431,7 @@ TYPED_TEST_P(TestLocationRoute, test_entity_cache_migrated_entity) /* NOLINT */{ // finalize if (my_node == new_home) { - auto const min_expected_ack = (nb_nodes - 2) * nb_rounds; + auto const min_expected_ack = (nb_nodes.get() - 2) * nb_rounds; EXPECT_TRUE(nb_received >= min_expected_ack); } } diff --git a/tests/unit/location/test_location_common.h b/tests/unit/location/test_location_common.h index 8a7438f6ce..8f3cef5fa5 100644 --- a/tests/unit/location/test_location_common.h +++ b/tests/unit/location/test_location_common.h @@ -57,31 +57,31 @@ int const invalid_entity = -1; struct EntityMsg : vt::Message { - EntityMsg(int in_entity, vt::NodeType in_home, bool in_large = false) + EntityMsg(int in_entity, vt::NodeT in_home, bool in_large = false) : entity_ (in_entity), home_ (in_home), is_large_(in_large) {} int entity_ = invalid_entity; - vt::NodeType home_ = vt::uninitialized_destination; + vt::NodeT home_ = vt::NodeT{}; bool is_large_ = false; }; struct ShortMsg : vt::LocationRoutedMsg { - ShortMsg(int in_entity, vt::NodeType in_from) + ShortMsg(int in_entity, vt::NodeT in_from) : from_(in_from), entity_(in_entity) {} - vt::NodeType from_ = vt::uninitialized_destination; + vt::NodeT from_ = vt::NodeT{}; int entity_ = invalid_entity; }; struct LongMsg : vt::LocationRoutedMsg { - LongMsg(int in_entity, vt::NodeType in_from) + LongMsg(int in_entity, vt::NodeT in_from) : from_(in_from), entity_(in_entity), data_ () @@ -89,13 +89,13 @@ struct LongMsg : vt::LocationRoutedMsg { std::memset(data_, 0, vt::location::small_msg_max_size); } - vt::NodeType from_ = vt::uninitialized_destination; + vt::NodeT from_ = vt::NodeT{}; int entity_ = invalid_entity; char data_[vt::location::small_msg_max_size] = ""; }; struct SerialMsg : ShortMsg { - SerialMsg(int in_entity, vt::NodeType in_from) + SerialMsg(int in_entity, vt::NodeT in_from) : ShortMsg(in_entity, in_from) { } }; @@ -139,8 +139,8 @@ bool isCached(int const entity) { // - (previous) home node or not template void verifyCacheConsistency( - int const entity, vt::NodeType const my_node, - vt::NodeType const home, vt::NodeType const new_home, int const nb_rounds + int const entity, vt::NodeT const my_node, + vt::NodeT const home, vt::NodeT const new_home, int const nb_rounds ) { for (int iter = 0; iter < nb_rounds; ++iter) { diff --git a/tests/unit/mapping/test_mapping.nompi.cc b/tests/unit/mapping/test_mapping.nompi.cc index f2ed0041e3..522955b448 100644 --- a/tests/unit/mapping/test_mapping.nompi.cc +++ b/tests/unit/mapping/test_mapping.nompi.cc @@ -60,7 +60,7 @@ TEST_F(TestMapping, test_mapping_block_1d) { static constexpr Index1D::DenseIndexType const val = 16; static constexpr Index1D::DenseIndexType const max = 256; - static constexpr NodeType const nnodes = 8; + static constexpr NodeT const nnodes = NodeT{8}; Index1D idx(val); Index1D max_idx(max); @@ -68,22 +68,22 @@ TEST_F(TestMapping, test_mapping_block_1d) { EXPECT_EQ(idx[0], val); EXPECT_EQ(max_idx[0], max); - std::vector map_cnt(nnodes); + std::vector map_cnt(nnodes.get()); - EXPECT_EQ(max % nnodes, 0); + EXPECT_EQ(max % nnodes.get(), 0); for (int i = 0; i < max; i++) { Index1D idx_test(i); auto const& node = mapping::dense1DBlockMap(&idx_test, &max_idx, nnodes); //fmt::print("node={},idx val={}, idx max={}\n", node, idx_test[0], max_idx[0]); - map_cnt[node]++; + map_cnt[node.get()]++; } - EXPECT_EQ(map_cnt.size(), static_cast(nnodes)); + EXPECT_EQ(map_cnt.size(), static_cast(nnodes.get())); Index1D::IndexSizeType map_count_fst = map_cnt[0]; - for (int i = 1; i < nnodes; i++) { + for (int i = 1; i < nnodes.get(); i++) { EXPECT_EQ(map_cnt[i], map_count_fst); } } @@ -91,7 +91,7 @@ TEST_F(TestMapping, test_mapping_block_1d) { TEST_F(TestMapping, test_mapping_block_2d) { using namespace vt; - static constexpr NodeType const nnodes = 8; + static constexpr NodeT const nnodes = NodeT{8}; using IndexType = Index2D::DenseIndexType; @@ -108,7 +108,7 @@ TEST_F(TestMapping, test_mapping_block_2d) { EXPECT_EQ(max_idx[0], max0); EXPECT_EQ(max_idx[1], max1); - std::vector map_cnt(nnodes); + std::vector map_cnt(nnodes.get()); EXPECT_EQ((max0 * max1) % nnodes, 0); @@ -120,15 +120,15 @@ TEST_F(TestMapping, test_mapping_block_2d) { // "node={},idx val=[{},{}], idx max=[{},{}]\n", // node, idx_test[0], idx_test[1], max_idx[0], max_idx[1] // ); - map_cnt[node]++; + map_cnt[node.get()]++; } } - EXPECT_EQ(map_cnt.size(), static_cast(nnodes)); + EXPECT_EQ(map_cnt.size(), static_cast(nnodes.get())); Index2D::IndexSizeType map_count_fst = map_cnt[0]; - for (int i = 1; i < nnodes; i++) { + for (int i = 1; i < nnodes.get(); i++) { EXPECT_EQ(map_cnt[i], map_count_fst); } } @@ -137,7 +137,7 @@ TEST_F(TestMapping, test_mapping_block_2d) { TEST_F(TestMapping, test_mapping_block_3d) { using namespace vt; - static constexpr NodeType const nnodes = 8; + static constexpr NodeT const nnodes = NodeT{8}; using IndexType = Index2D::DenseIndexType; @@ -160,23 +160,23 @@ TEST_F(TestMapping, test_mapping_block_3d) { std::vector map_cnt(nnodes); - EXPECT_EQ((max0 * max1 * max2) % nnodes, 0); + EXPECT_EQ((max0 * max1 * max2) % nnodes.get(), 0); for (int i = 0; i < max_idx[0]; i++) { for (int j = 0; j < max_idx[1]; j++) { for (int k = 0; k < max_idx[2]; k++) { Index3D idx_test(i, j, k); auto const& node = mapping::dense3DBlockMap(&idx_test, &max_idx, nnodes); - map_cnt[node]++; + map_cnt[node.get()]++; } } } - EXPECT_EQ(map_cnt.size(), static_cast(nnodes)); + EXPECT_EQ(map_cnt.size(), static_cast(nnodes.get())); Index3D::IndexSizeType map_count_fst = map_cnt[0]; - for (int i = 1; i < nnodes; i++) { + for (int i = 1; i < nnodes.get(); i++) { EXPECT_EQ(map_cnt[i], map_count_fst); } } diff --git a/tests/unit/mapping/test_mapping_registry.cc b/tests/unit/mapping/test_mapping_registry.cc index 2d998ac7c6..cbe688f1e1 100644 --- a/tests/unit/mapping/test_mapping_registry.cc +++ b/tests/unit/mapping/test_mapping_registry.cc @@ -67,7 +67,7 @@ struct TestMappingRegistry : TestParallelHarness { static constexpr Index1D::DenseIndexType const val = 64; static constexpr Index1D::DenseIndexType const max = 256; - static constexpr NodeType const nnodes = 8; + static constexpr NodeT const nnodes = NodeT{8}; Index1D idx(val); Index1D max_idx(max); @@ -76,24 +76,20 @@ struct TestMappingRegistry : TestParallelHarness { auto const node = fn->dispatch(&idx, &max_idx, nnodes); if (msg->is_block) { - EXPECT_EQ(val / (max / nnodes), node); + EXPECT_EQ(val / (max / nnodes.get()), node.get()); } else { - EXPECT_EQ(val % nnodes, node); + EXPECT_EQ(val % nnodes.get(), node.get()); } //fmt::print("node={}\n", node); } }; -static NodeType map_fn( - Index1D* idx, Index1D* max_idx, NodeType nnodes -) { +static NodeT map_fn(Index1D* idx, Index1D* max_idx, NodeT nnodes) { return mapping::dense1DBlockMap(idx, max_idx, nnodes); } -static NodeType map_fn2( - Index1D* idx, Index1D* max_idx, NodeType nnodes -) { +static NodeT map_fn2(Index1D* idx, Index1D* max_idx, NodeT nnodes) { return mapping::dense1DRoundRobinMap(idx, max_idx, nnodes); } @@ -104,7 +100,7 @@ TEST_F(TestMappingRegistry, test_mapping_block_1d_registry) { fmt::print("test_type_safe_active_fn_send: node={}\n", my_node); #endif - if (my_node == 0) { + if (my_node == NodeT{0}) { auto map_han = auto_registry::makeAutoHandlerMap(); auto msg = makeMessage(map_han); msg->is_block = true; diff --git a/tests/unit/memory/test_memory_active.cc b/tests/unit/memory/test_memory_active.cc index 53ce419e4a..5f6623047b 100644 --- a/tests/unit/memory/test_memory_active.cc +++ b/tests/unit/memory/test_memory_active.cc @@ -77,7 +77,7 @@ TYPED_TEST_P(TestMemoryActive, test_memory_remote_send) { auto const& num_nodes = theContext()->getNumNodes(); bool const run_test = num_nodes > 1; - NodeType const to_node = 1; + NodeT const to_node = NodeT{1}; std::vector> msgs; diff --git a/tests/unit/memory/test_memory_lifetime.cc b/tests/unit/memory/test_memory_lifetime.cc index 8ab52b14c4..96962d1e0e 100644 --- a/tests/unit/memory/test_memory_lifetime.cc +++ b/tests/unit/memory/test_memory_lifetime.cc @@ -123,7 +123,7 @@ TEST_F(TestMemoryLifetime, test_active_send_serial_lifetime) { auto const& num_nodes = theContext()->getNumNodes(); runInEpochCollective([&]{ - auto const next_node = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto const next_node = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; for (int i = 0; i < num_msgs_sent; i++) { auto msg = makeMessage(); theMsg()->sendMsg(next_node, msg); @@ -158,7 +158,7 @@ TEST_F(TestMemoryLifetime, test_active_send_normal_lifetime_msgptr) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - auto const next_node = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto const next_node = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; for (int i = 0; i < num_msgs_sent; i++) { auto msg = makeMessage(); // sendMsg takes MsgPtr ownership - keep our own handle diff --git a/tests/unit/objgroup/test_objgroup.cc b/tests/unit/objgroup/test_objgroup.cc index 572e6c238c..5d46717a20 100644 --- a/tests/unit/objgroup/test_objgroup.cc +++ b/tests/unit/objgroup/test_objgroup.cc @@ -196,7 +196,7 @@ TEST_F(TestObjGroup, test_proxy_schedule) { normal, objgroup, "obj->recv:{} after term\n", obj->recv_ ); - EXPECT_EQ(obj->recv_, num_nodes + 1); + EXPECT_EQ(obj->recv_, num_nodes.get() + 1); } TEST_F(TestObjGroup, test_proxy_callbacks) { @@ -211,13 +211,13 @@ TEST_F(TestObjGroup, test_proxy_callbacks) { auto proxy2 = vt::theObjGroup()->makeCollective("test_proxy_callbacks", 1); auto proxy3 = vt::theObjGroup()->makeCollective("test_proxy_callbacks"); - if (my_node == 0) { - proxy1[0].send<&MyObjA::handler>(); - proxy1[0].send<&MyObjA::handler>(); - proxy1[1].send<&MyObjA::handler>(); - } else if (my_node == 1) { + if (my_node == NodeT{0}) { + proxy1[NodeT{0}].send<&MyObjA::handler>(); + proxy1[NodeT{0}].send<&MyObjA::handler>(); + proxy1[NodeT{1}].send<&MyObjA::handler>(); + } else if (my_node == NodeT{1}) { proxy2.broadcast<&MyObjB::handler>(); - proxy3[0].send<&MyObjA::handler>(); + proxy3[NodeT{0}].send<&MyObjA::handler>(); } // check received messages for each group @@ -232,7 +232,7 @@ TEST_F(TestObjGroup, test_proxy_callbacks) { default: EXPECT_EQ(obj1->recv_, 0); break; } EXPECT_EQ(obj2->recv_, 1); - EXPECT_EQ(obj3->recv_, my_node == 0 ? 1 : 0); + EXPECT_EQ(obj3->recv_, my_node.get() == 0 ? 1 : 0); } TEST_F(TestObjGroup, test_proxy_reduce) { @@ -266,7 +266,7 @@ TEST_F(TestObjGroup, test_proxy_reduce) { proxy4.reduce, Verify<4>>(msg4); }); - auto const root_node = 0; + auto const root_node = vt::NodeT{0}; if (my_node == root_node) { EXPECT_EQ(TestObjGroup::total_verify_expected_, 4); } @@ -339,7 +339,7 @@ struct MyTestMsg : vt::Message { using MessageParentType = vt::Message; vt_msg_serialize_required(); - explicit MyTestMsg(NodeType const node) : node_{node} { + explicit MyTestMsg(NodeT const node) : node_{node} { ::fmt::print("Creating MyTestMsg on node: {}\n", node_); } @@ -356,12 +356,12 @@ struct MyTestMsg : vt::Message { } } - NodeType fromNode() const { return node_; } + NodeT fromNode() const { return node_; } bool wasSerialized() const { return was_serialized_; } private: - NodeType node_{-1}; + NodeT node_{-1}; bool was_serialized_{false}; }; diff --git a/tests/unit/objgroup/test_objgroup_common.h b/tests/unit/objgroup/test_objgroup_common.h index eafc12d033..b19ac9f603 100644 --- a/tests/unit/objgroup/test_objgroup_common.h +++ b/tests/unit/objgroup/test_objgroup_common.h @@ -54,7 +54,7 @@ namespace vt { namespace tests { namespace unit { struct MyMsg : vt::Message { MyMsg() : from_(vt::theContext()->getNode()) {} - vt::NodeType from_ = vt::uninitialized_destination; + vt::NodeT from_ = vt::NodeT{}; }; struct SysMsg : vt::collective::ReduceTMsg { diff --git a/tests/unit/phase/test_phase_insertions.cc b/tests/unit/phase/test_phase_insertions.cc index 615ab7c3b0..a59aaf8a31 100644 --- a/tests/unit/phase/test_phase_insertions.cc +++ b/tests/unit/phase/test_phase_insertions.cc @@ -92,7 +92,7 @@ void colHandler(MyCol* col) { } } -static NodeType map_fn(Index1D* idx, Index1D* max_idx, NodeType nnodes) { +static NodeT map_fn(Index1D* idx, Index1D* max_idx, NodeT nnodes) { return mapping::dense1DRoundRobinMap(idx, max_idx, nnodes); } @@ -118,7 +118,7 @@ TEST_F(TestPhaseInsertions, test_phase_insertions_1) { auto token = proxy.beginModification(); for (int i = 0; i < range.x() / 2; i++) { - if (i % num_nodes == this_node) { + if (vt::NodeT{i} % num_nodes == this_node) { proxy[i].insert(token); } } @@ -129,7 +129,7 @@ TEST_F(TestPhaseInsertions, test_phase_insertions_1) { for (int phase = 0; phase < num_phases; phase++) { // Do some work. runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); @@ -139,16 +139,16 @@ TEST_F(TestPhaseInsertions, test_phase_insertions_1) { auto token = proxy.beginModification(); - if (this_node == 0 and insert_counter < num_elms) { + if (this_node == vt::NodeT{0} and insert_counter < num_elms) { proxy[insert_counter].insert(token); insert_counter++; } // Try to re-insert an element that already exists to test for reinsertion // bugs - if (this_node == 0 or this_node == 1) { - proxy[0].insertAt(token, 1); - proxy[0].insertAt(token, 0); + if (this_node == vt::NodeT{0} or this_node == vt::NodeT{1}) { + proxy[0].insertAt(token, vt::NodeT{1}); + proxy[0].insertAt(token, vt::NodeT{0}); } proxy.finishModification(std::move(token)); diff --git a/tests/unit/pipe/test_callback_bcast.cc b/tests/unit/pipe/test_callback_bcast.cc index 3ebf52983d..7952ad4b4c 100644 --- a/tests/unit/pipe/test_callback_bcast.cc +++ b/tests/unit/pipe/test_callback_bcast.cc @@ -157,7 +157,7 @@ TEST_F(TestCallbackBcast, test_callback_bcast_remote_1) { theCollective()->barrier(); runInEpochCollective([&]{ - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; auto cb = theCB()->makeBcast(); auto msg = makeMessage(cb); theMsg()->sendMsg(next, msg); @@ -175,7 +175,7 @@ TEST_F(TestCallbackBcast, test_callback_bcast_remote_2) { theCollective()->barrier(); runInEpochCollective([&]{ - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; auto cb = theCB()->makeBcast(); auto msg = makeMessage(cb); theMsg()->sendMsg(next, msg); @@ -193,7 +193,7 @@ TEST_F(TestCallbackBcast, test_callback_bcast_remote_3) { theCollective()->barrier(); runInEpochCollective([&]{ - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; auto cb = theCB()->makeBcast(); auto msg = makeMessage(cb); theMsg()->sendMsg(next, msg); diff --git a/tests/unit/pipe/test_callback_bcast_collection.extended.cc b/tests/unit/pipe/test_callback_bcast_collection.extended.cc index ca31be1ebe..b8ad281744 100644 --- a/tests/unit/pipe/test_callback_bcast_collection.extended.cc +++ b/tests/unit/pipe/test_callback_bcast_collection.extended.cc @@ -134,21 +134,21 @@ TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_1) { vt::CollectionProxy proxy; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy = theCollection()->construct( range, "test_callback_bcast_collection_1" ); } runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto cb = theCB()->makeBcast(proxy); cb.send(8,9,10); } }); runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); @@ -158,7 +158,7 @@ TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_2) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - if (num_nodes < 2) { + if (num_nodes < vt::NodeT{2}) { return; } @@ -166,15 +166,15 @@ TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_2) { vt::CollectionProxy proxy; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy = theCollection()->construct( range, "test_callback_bcast_collection_2" ); } runInEpochCollective([&]{ - if (this_node == 0) { - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + if (this_node == vt::NodeT{0}) { + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; auto cb = theCB()->makeBcast(proxy); auto msg = makeMessage(cb); theMsg()->sendMsg(next, msg); @@ -182,7 +182,7 @@ TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_2) { }); runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); @@ -192,7 +192,7 @@ TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_3) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - if (num_nodes < 2) { + if (num_nodes < vt::NodeT{2}) { return; } @@ -200,15 +200,15 @@ TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_3) { vt::CollectionProxy proxy; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy = theCollection()->construct( range, "test_callback_bcast_collection_3" ); } runInEpochCollective([&]{ - if (this_node == 0) { - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + if (this_node == vt::NodeT{0}) { + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; auto cb = theCB()->makeBcast(proxy); auto msg = makeMessage(cb); theMsg()->sendMsg(next, msg); @@ -216,7 +216,7 @@ TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_3) { }); runInEpochCollective([&]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); diff --git a/tests/unit/pipe/test_callback_func.cc b/tests/unit/pipe/test_callback_func.cc index a9603faa1c..c8b2e6d192 100644 --- a/tests/unit/pipe/test_callback_func.cc +++ b/tests/unit/pipe/test_callback_func.cc @@ -81,23 +81,23 @@ TEST_F(TestCallbackFunc, test_callback_func_2) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - if (num_nodes < 2) { + if (num_nodes < vt::NodeT{2}) { return; } called = 0; runInEpochCollective([this_node]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto cb = theCB()->makeFunc( vt::pipe::LifetimeEnum::Once, []{ called = 400; } ); auto msg = makeMessage(cb); - theMsg()->sendMsg(1, msg); + theMsg()->sendMsg(vt::NodeT{1}, msg); } }); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { EXPECT_EQ(called, 400); } } diff --git a/tests/unit/pipe/test_callback_func_ctx.cc b/tests/unit/pipe/test_callback_func_ctx.cc index 09054798b6..bc6a31f5a6 100644 --- a/tests/unit/pipe/test_callback_func_ctx.cc +++ b/tests/unit/pipe/test_callback_func_ctx.cc @@ -110,7 +110,7 @@ TEST_F(TestCallbackFuncCtx, test_callback_func_ctx_2) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - if (num_nodes < 2) { + if (num_nodes < vt::NodeT{2}) { return; } @@ -118,7 +118,7 @@ TEST_F(TestCallbackFuncCtx, test_callback_func_ctx_2) { ctx = std::make_unique(); ctx->val = this_node; - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; auto cb = theCB()->makeFunc( vt::pipe::LifetimeEnum::Once, ctx.get(), [next](DataMsg* msg, Context* my_ctx) { diff --git a/tests/unit/pipe/test_callback_send.cc b/tests/unit/pipe/test_callback_send.cc index be1a577957..7b940ef02a 100644 --- a/tests/unit/pipe/test_callback_send.cc +++ b/tests/unit/pipe/test_callback_send.cc @@ -152,7 +152,7 @@ TEST_F(TestCallbackSend, test_callback_send_remote_1) { called = 0; runInEpochCollective([this_node, num_nodes]{ - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; auto cb = theCB()->makeSend(this_node); auto msg = makeMessage(cb); theMsg()->sendMsg(next, msg); @@ -168,7 +168,7 @@ TEST_F(TestCallbackSend, test_callback_send_remote_2) { called = 0; runInEpochCollective([this_node, num_nodes]{ - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; auto cb = theCB()->makeSend(this_node); auto msg = makeMessage(cb); theMsg()->sendMsg(next, msg); @@ -184,7 +184,7 @@ TEST_F(TestCallbackSend, test_callback_send_remote_3) { called = 0; runInEpochCollective([this_node, num_nodes]{ - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; auto cb = theCB()->makeSend(this_node); auto msg = makeMessage(cb); theMsg()->sendMsg(next, msg); diff --git a/tests/unit/pipe/test_callback_send_collection.extended.cc b/tests/unit/pipe/test_callback_send_collection.extended.cc index 5dfad65c5c..d461758762 100644 --- a/tests/unit/pipe/test_callback_send_collection.extended.cc +++ b/tests/unit/pipe/test_callback_send_collection.extended.cc @@ -131,14 +131,14 @@ TEST_F(TestCallbackSendCollection, test_callback_send_collection_1) { vt::CollectionProxy proxy; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy = theCollection()->construct( range, "test_callback_send_collection_1" ); } runInEpochCollective([this_node, proxy]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < 32; i++) { if (i % 2 == 0) { auto cb = @@ -154,7 +154,7 @@ TEST_F(TestCallbackSendCollection, test_callback_send_collection_1) { }); runInEpochCollective([this_node, proxy]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); @@ -164,7 +164,7 @@ TEST_F(TestCallbackSendCollection, test_callback_send_collection_2) { auto const& this_node = theContext()->getNode(); auto const& num_nodes = theContext()->getNumNodes(); - if (num_nodes < 2) { + if (num_nodes < vt::NodeT{2}) { return; } @@ -172,16 +172,16 @@ TEST_F(TestCallbackSendCollection, test_callback_send_collection_2) { vt::CollectionProxy proxy; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy = theCollection()->construct( range, "test_callback_send_collection_2" ); } runInEpochCollective([this_node, num_nodes, proxy]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < 32; i++) { - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; if (i % 2 == 0) { auto cb = theCB()->makeSend(proxy(i)); @@ -198,7 +198,7 @@ TEST_F(TestCallbackSendCollection, test_callback_send_collection_2) { }); runInEpochCollective([this_node, proxy]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); @@ -210,14 +210,14 @@ TEST_F(TestCallbackSendCollection, test_callback_send_collection_3) { vt::CollectionProxy proxy; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy = theCollection()->construct( range, "test_callback_send_collection_3" ); } runInEpochCollective([this_node, proxy]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { for (auto i = 0; i < 32; i++) { if (i % 2 == 0) { auto cb = @@ -232,7 +232,7 @@ TEST_F(TestCallbackSendCollection, test_callback_send_collection_3) { }); runInEpochCollective([this_node, proxy]{ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { proxy.broadcast(); } }); diff --git a/tests/unit/pipe/test_signal_cleanup.cc b/tests/unit/pipe/test_signal_cleanup.cc index 01bf454ac6..bea1d79fb8 100644 --- a/tests/unit/pipe/test_signal_cleanup.cc +++ b/tests/unit/pipe/test_signal_cleanup.cc @@ -78,7 +78,7 @@ TEST_F(TestSignalCleanup, test_signal_cleanup_3) { int c1 = 0, c2 = 0; - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto cb = theCB()->makeFunc( vt::pipe::LifetimeEnum::Once, [&c1](DataMsg* msg){ c1++; @@ -86,7 +86,7 @@ TEST_F(TestSignalCleanup, test_signal_cleanup_3) { } ); auto msg = makeMessage(cb); - theMsg()->sendMsg(1, msg); + theMsg()->sendMsg(vt::NodeT{1}, msg); } // run until termination @@ -105,7 +105,7 @@ TEST_F(TestSignalCleanup, test_signal_cleanup_3) { // Since the RT has been finalized, the pipe ID for the new callback will be // the same as the one before. // - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto cb = theCB()->makeFunc( vt::pipe::LifetimeEnum::Once, [&c2](DataMsg* msg){ c2++; @@ -113,14 +113,14 @@ TEST_F(TestSignalCleanup, test_signal_cleanup_3) { } ); auto msg = makeMessage(cb); - theMsg()->sendMsg(1, msg); + theMsg()->sendMsg(vt::NodeT{1}, msg); } // run until termination vt::theSched()->runSchedulerWhile([]{ return not vt::rt->isTerminated(); }); // now, check if we only fired the callbacks exactly once! - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { EXPECT_EQ(c1, 1); EXPECT_EQ(c2, 1); } diff --git a/tests/unit/pool/test_pool_message_sizes.cc b/tests/unit/pool/test_pool_message_sizes.cc index 2af7a6eeb0..67d306cccf 100644 --- a/tests/unit/pool/test_pool_message_sizes.cc +++ b/tests/unit/pool/test_pool_message_sizes.cc @@ -59,8 +59,8 @@ using namespace vt::tests::unit; static constexpr int64_t const min_bytes = 1; static constexpr int64_t const max_bytes = 16384; static constexpr int const max_test_count = 1024; -static constexpr NodeType const from_node = 0; -static constexpr NodeType const to_node = 1; +static constexpr NodeT const from_node = NodeT{0}; +static constexpr NodeT const to_node = NodeT{1}; struct TestPoolMessageSizes : TestParallelHarness { static int count; @@ -96,7 +96,7 @@ void TestPoolMessageSizes::testPoolFun(TestMsg* prev_msg) { count++; - NodeType const next = + NodeT const next = this_node == from_node ? to_node : from_node; if (count < max_test_count) { diff --git a/tests/unit/rdma/test_rdma_common.h b/tests/unit/rdma/test_rdma_common.h index 54a42afa57..0deb94c2f7 100644 --- a/tests/unit/rdma/test_rdma_common.h +++ b/tests/unit/rdma/test_rdma_common.h @@ -45,7 +45,7 @@ #define INCLUDED_UNIT_RDMA_TEST_RDMA_COMMON_H #include -#include "vt/configs/types/types_type.h" +#include "vt/configs/types/types_node.h" namespace vt { namespace tests { namespace unit { @@ -53,27 +53,27 @@ template struct UpdateData { template static void init( - HandleT& handle, int space, std::size_t size, vt::NodeType rank + HandleT& handle, int space, std::size_t size, vt::NodeT rank ) { handle.modifyExclusive([=](T* val, std::size_t count){ - setMem(val, space, size, rank, 0); + setMem(val, space, size, rank.get(), 0); }); } static void setMem( - T* ptr, int space, std::size_t size, vt::NodeType rank, std::size_t offset + T* ptr, int space, std::size_t size, vt::NodeT rank, std::size_t offset ) { for (std::size_t i = offset; i < size; i++) { - ptr[i] = static_cast(space * rank + i); + ptr[i] = static_cast(space * rank.get() + i); } } static void test( - std::unique_ptr ptr, int space, std::size_t size, vt::NodeType rank, + std::unique_ptr ptr, int space, std::size_t size, vt::NodeT rank, std::size_t offset, T val = T{} ) { for (std::size_t i = offset; i < size; i++) { - EXPECT_EQ(ptr[i], static_cast(space * rank + i + val)); + EXPECT_EQ(ptr[i], static_cast(space * rank.get() + i + val)); } } }; diff --git a/tests/unit/rdma/test_rdma_handle.h b/tests/unit/rdma/test_rdma_handle.h index 67b8f27899..fdc4a7ea8a 100644 --- a/tests/unit/rdma/test_rdma_handle.h +++ b/tests/unit/rdma/test_rdma_handle.h @@ -99,7 +99,7 @@ void test_rdma_handle_1() { vt::theCollective()->barrier(); auto num = vt::theContext()->getNumNodes(); - for (vt::NodeType node = 0; node < num; node++) { + for (vt::NodeT node = 0; node < num; node++) { { auto ptr = std::make_unique(size); handle.get(node, ptr.get(), size, 0, vt::Lock::Shared); @@ -143,7 +143,7 @@ void test_rdma_handle_2() { auto num = vt::theContext()->getNumNodes(); auto next = rank + 1 < num ? rank + 1 : 0; //auto prev = rank - 1 >= 0 ? rank - 1 : num-1; - for (vt::NodeType node = 0; node < num; node++) { + for (vt::NodeT node = 0; node < num; node++) { { auto ptr = std::make_unique(size); handle.get(node, ptr.get(), size, 0, vt::Lock::Shared); @@ -195,7 +195,7 @@ void test_rdma_handle_3() { vt::theCollective()->barrier(); auto num = vt::theContext()->getNumNodes(); - for (vt::NodeType node = 0; node < num; node++) { + for (vt::NodeT node = 0; node < num; node++) { { auto ptr = std::make_unique(size); for (std::size_t i = 0; i < size; i++) { @@ -208,7 +208,7 @@ void test_rdma_handle_3() { // Barrier to allow gets to finish vt::theCollective()->barrier(); - for (vt::NodeType node = 0; node < num; node++) { + for (vt::NodeT node = 0; node < num; node++) { { auto ptr = std::make_unique(size); handle.get(node, ptr.get(), size, 0, vt::Lock::Exclusive); @@ -236,7 +236,7 @@ void test_rdma_handle_4() { vt::theCollective()->barrier(); auto num = vt::theContext()->getNumNodes(); - for (vt::NodeType node = 0; node < num; node++) { + for (vt::NodeT node = 0; node < num; node++) { EXPECT_EQ(handle.getCount(node), (node + 1) * per_size); } @@ -261,7 +261,7 @@ void test_rdma_handle_5() { vt::theCollective()->barrier(); auto num = vt::theContext()->getNumNodes(); - for (vt::NodeType node = 0; node < num; node++) { + for (vt::NodeT node = 0; node < num; node++) { for (int i = 0; i < 10; i++) { handle.fetchOp(node, 1, i, MPI_SUM, vt::Lock::Shared); } @@ -270,7 +270,7 @@ void test_rdma_handle_5() { // Barrier so all fetches complete vt::theCollective()->barrier(); - for (vt::NodeType node = 0; node < num; node++) { + for (vt::NodeT node = 0; node < num; node++) { { auto ptr = std::make_unique(size); handle.get(node, ptr.get(), size, 0, vt::Lock::Exclusive); diff --git a/tests/unit/rdma/test_rdma_static_sub_handle.extended.cc b/tests/unit/rdma/test_rdma_static_sub_handle.extended.cc index 49a34045ae..b31b050eb9 100644 --- a/tests/unit/rdma/test_rdma_static_sub_handle.extended.cc +++ b/tests/unit/rdma/test_rdma_static_sub_handle.extended.cc @@ -268,7 +268,7 @@ TYPED_TEST_P(TestRDMAHandleSet, test_rdma_handle_set_4) { auto this_node = theContext()->getNode(); auto num_nodes = theContext()->getNumNodes(); - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto next = this_node + NodeT{1} < num_nodes ? this_node + NodeT{1} : NodeT{0}; int32_t num_hans = 4; std::size_t num_vals = 10; int space = 100; diff --git a/tests/unit/runtime/test_mpi_access_guards.cc b/tests/unit/runtime/test_mpi_access_guards.cc index 4f63a80427..0cf023c834 100644 --- a/tests/unit/runtime/test_mpi_access_guards.cc +++ b/tests/unit/runtime/test_mpi_access_guards.cc @@ -90,7 +90,7 @@ void testMpiAccess(bool access_allowed, bool grant_access) { // Sending message for common-case of attempting MPI access within // a message handler; it applies to all cases through the scheduler. auto msg = vt::makeMessage(); - theMsg()->sendMsg(1, msg); + theMsg()->sendMsg(vt::NodeT{1}, msg); } } diff --git a/tests/unit/scheduler/test_scheduler_loop.cc b/tests/unit/scheduler/test_scheduler_loop.cc index c39304ec6b..52659e946a 100644 --- a/tests/unit/scheduler/test_scheduler_loop.cc +++ b/tests/unit/scheduler/test_scheduler_loop.cc @@ -83,7 +83,7 @@ static void message_handler_with_nested_loop(TestMsg* msg) { } // Pass message around the ring.. - NodeType target_node = (theContext()->getNode() + 1) % theContext()->getNumNodes(); + NodeT target_node = (theContext()->getNode() + NodeT{1}) % theContext()->getNumNodes(); int next_depth = depth + 1; auto next_msg = vt::makeMessage(); @@ -112,8 +112,8 @@ TEST_F(TestSchedulerLoop, test_scheduler_loop_nesting_1) { SET_MIN_NUM_NODES_CONSTRAINT(2); - NodeType node = theContext()->getNode(); - NodeType target_node = (node + 1) % theContext()->getNumNodes(); + NodeT node = theContext()->getNode(); + NodeT target_node = (node + NodeT{1}) % theContext()->getNumNodes(); auto msg = vt::makeMessage(); msg->action_ = 1; diff --git a/tests/unit/scheduler/test_scheduler_timings.cc b/tests/unit/scheduler/test_scheduler_timings.cc index 3521cd7973..d2017ae578 100644 --- a/tests/unit/scheduler/test_scheduler_timings.cc +++ b/tests/unit/scheduler/test_scheduler_timings.cc @@ -87,7 +87,7 @@ void myHandler(MyMsg* msg) { auto handler = auto_registry::makeAutoHandler(); auto msg = vt::makeMessage(); msg->ms = time; - auto maker = vt::runnable::makeRunnable(msg, false, handler, 0) + auto maker = vt::runnable::makeRunnable(msg, false, handler, NodeT{0}) .withLBData(std::get<1>(v[i]).get(), id); auto runnable = maker.getRunnableImpl(); runnable->setupHandler(handler); @@ -123,7 +123,7 @@ TEST_F(TestSchedTimings, test_sched_msg) { auto handler = auto_registry::makeAutoHandler(); - auto maker = vt::runnable::makeRunnable(next_msg, false, handler, 0); + auto maker = vt::runnable::makeRunnable(next_msg, false, handler, NodeT{0}); auto runnable = maker.getRunnableImpl(); runnable->setupHandler(handler); diff --git a/tests/unit/serialization/test_serialize_messenger.cc b/tests/unit/serialization/test_serialize_messenger.cc index c66bff5a1d..d4001e6162 100644 --- a/tests/unit/serialization/test_serialize_messenger.cc +++ b/tests/unit/serialization/test_serialize_messenger.cc @@ -110,7 +110,7 @@ TEST_F(TestSerialMessenger, test_serial_messenger_1) { auto msg = makeMessage(); msg->init(); auto han = auto_registry::makeAutoHandler(); - SerializedMessenger::sendSerialMsg(1, msg.get(), han); + SerializedMessenger::sendSerialMsg(vt::NodeT{1}, msg.get(), han); } } } diff --git a/tests/unit/termination/test_collection_chainset_tracking.cc b/tests/unit/termination/test_collection_chainset_tracking.cc index af932be0c1..f0ee2f832c 100644 --- a/tests/unit/termination/test_collection_chainset_tracking.cc +++ b/tests/unit/termination/test_collection_chainset_tracking.cc @@ -72,10 +72,10 @@ TEST_F(TestCollectionChainsetTracking, test_local_chainset_tracking) { theCollective()->barrier(); - auto getNthPosition = [&](Index3D idx, int n) -> NodeType { + auto getNthPosition = [&](Index3D idx, int n) -> NodeT { auto const home = theCollection()->getMappedNode(proxy, idx); auto num = vt::theContext()->getNumNodes(); - return (home + n) % num; + return (home + NodeT{n}) % num; }; for (int i = 1; i < num_nodes + 1; i++) { @@ -115,10 +115,10 @@ TEST_F(TestCollectionChainsetTracking, test_home_chainset_tracking) { theCollective()->barrier(); - auto getNthPosition = [&](Index3D idx, int n) -> NodeType { + auto getNthPosition = [&](Index3D idx, int n) -> NodeT { auto const home = theCollection()->getMappedNode(proxy, idx); auto num = vt::theContext()->getNumNodes(); - return (home + n) % num; + return (home + NodeT{n}) % num; }; for (int i = 1; i < num_nodes + 1; i++) { diff --git a/tests/unit/termination/test_epoch_guard.cc b/tests/unit/termination/test_epoch_guard.cc index e58360898e..e21a19ae1f 100644 --- a/tests/unit/termination/test_epoch_guard.cc +++ b/tests/unit/termination/test_epoch_guard.cc @@ -74,7 +74,7 @@ struct TestEpochGuard : TestParallelHarness { EXPECT_EQ(theMsg()->getEpoch(), ep); auto node = theContext()->getNode(); if (0 == node) { - theMsg()->sendMsg(1, msg); + theMsg()->sendMsg(vt::NodeT{1}, msg); } } @@ -91,7 +91,7 @@ struct TestEpochGuard : TestParallelHarness { EXPECT_EQ(theMsg()->getEpoch(), ep); auto node = theContext()->getNode(); if (0 == node) { - theMsg()->sendMsg(1, msg); + theMsg()->sendMsg(vt::NodeT{1}, msg); } guard.pop(); diff --git a/tests/unit/termination/test_term_chaining.cc b/tests/unit/termination/test_term_chaining.cc index 4627e3e96a..e084915b3f 100644 --- a/tests/unit/termination/test_term_chaining.cc +++ b/tests/unit/termination/test_term_chaining.cc @@ -79,7 +79,7 @@ struct TestTermChaining : TestParallelHarness { EXPECT_EQ(theContext()->getNode(), 1); auto msg2 = makeMessage(); - theMsg()->sendMsg(0, msg2); + theMsg()->sendMsg(vt::NodeT{0}, msg2); } static void test_handler_response(TestMsg* msg) { @@ -96,7 +96,7 @@ struct TestTermChaining : TestParallelHarness { EXPECT_EQ(handler_count, 12); handler_count++; auto msg2 = makeMessage(); - theMsg()->sendMsg(0, msg2); + theMsg()->sendMsg(vt::NodeT{0}, msg2); } static void test_handler_chained(TestMsg* msg) { @@ -140,7 +140,7 @@ struct TestTermChaining : TestParallelHarness { vt::theMsg()->pushEpoch(epoch1); auto msg = makeMessage(); chain.add( - epoch1, theMsg()->sendMsg(1, msg) + epoch1, theMsg()->sendMsg(vt::NodeT{1}, msg) ); vt::theMsg()->popEpoch(epoch1); vt::theTerm()->finishedEpoch(epoch1); @@ -149,7 +149,7 @@ struct TestTermChaining : TestParallelHarness { vt::theMsg()->pushEpoch(epoch2); auto msg2 = makeMessage(); chain.add( - epoch2, theMsg()->sendMsg(1, msg2) + epoch2, theMsg()->sendMsg(vt::NodeT{1}, msg2) ); vt::theMsg()->popEpoch(epoch2); vt::theTerm()->finishedEpoch(epoch2); @@ -160,12 +160,12 @@ struct TestTermChaining : TestParallelHarness { static void chain_reduce() { auto node = theContext()->getNode(); - if (0 == node) { + if (vt::NodeT{0} == node) { EpochType epoch1 = theTerm()->makeEpochRooted(); vt::theMsg()->pushEpoch(epoch1); auto msg = makeMessage(); chain.add( - epoch1, theMsg()->sendMsg(1, msg.get())); + epoch1, theMsg()->sendMsg(vt::NodeT{1}, msg.get())); vt::theMsg()->popEpoch(epoch1); vt::theTerm()->finishedEpoch(epoch1); } @@ -173,8 +173,8 @@ struct TestTermChaining : TestParallelHarness { EpochType epoch2 = theTerm()->makeEpochCollective(); vt::theMsg()->pushEpoch(epoch2); auto msg2 = makeMessage(theContext()->getNode()); - auto cb = vt::theCB()->makeSend( 0 ); - chain.add(epoch2, theCollective()->global()->reduce< vt::collective::None >(0, msg2.get(), cb)); + auto cb = vt::theCB()->makeSend( NodeT{0} ); + chain.add(epoch2, theCollective()->global()->reduce< vt::collective::None >(vt::NodeT{0}, msg2.get(), cb)); vt::theMsg()->popEpoch(epoch2); vt::theTerm()->finishedEpoch(epoch2); @@ -195,8 +195,8 @@ struct TestTermChaining : TestParallelHarness { EpochType epoch2 = theTerm()->makeEpochRooted(); vt::theMsg()->pushEpoch(epoch2); auto msg2 = makeMessage(theContext()->getNode()); - auto cb = vt::theCB()->makeSend( 0 ); - chain.add(epoch2, theCollective()->global()->reduce< vt::collective::None >(0, msg2.get(), cb)); + auto cb = vt::theCB()->makeSend( NodeT{0} ); + chain.add(epoch2, theCollective()->global()->reduce< vt::collective::None >(vt::NodeT{0}, msg2.get(), cb)); vt::theMsg()->popEpoch(epoch2); vt::theTerm()->finishedEpoch(epoch2); @@ -219,7 +219,7 @@ TEST_F(TestTermChaining, test_termination_chaining_1) { fmt::print("global collective epoch {:x}\n", epoch); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { theMsg()->pushEpoch(epoch); start_chain(); theTerm()->finishedEpoch(epoch); @@ -244,10 +244,10 @@ TEST_F(TestTermChaining, test_termination_chaining_collective_1) { chain = vt::messaging::DependentSendChain{}; handler_count = 0; - if (num_nodes == 2) { + if (num_nodes == vt::NodeT{2}) { vt::runInEpochCollective( chain_reduce ); EXPECT_EQ(handler_count, 3); - } else if (num_nodes == 1) { + } else if (num_nodes == vt::NodeT{1}) { vt::runInEpochCollective( chain_reduce_single ); EXPECT_EQ(handler_count, 2); } diff --git a/tests/unit/termination/test_term_cleanup.cc b/tests/unit/termination/test_term_cleanup.cc index 57f779f8a5..45d5ec862b 100644 --- a/tests/unit/termination/test_term_cleanup.cc +++ b/tests/unit/termination/test_term_cleanup.cc @@ -75,7 +75,7 @@ TEST_F(TestTermCleanup, test_termination_cleanup_1) { EpochType const epoch = theTerm()->makeEpochCollective(); //fmt::print("global collective epoch {:x}\n", epoch); - NodeType const next = this_node + 1 < num_nodes ? this_node + 1 : 0; + NodeT const next = NodeT{this_node.get() + 1 < num_nodes.get() ? this_node.get() + 1 : 0}; auto msg = makeMessage(); envelopeSetEpoch(msg->env, epoch); @@ -118,7 +118,7 @@ TEST_F(TestTermCleanup, test_termination_cleanup_2) { ); //fmt::print("global collective epoch {:x}\n", epoch); - NodeType const next = this_node + 1 < num_nodes ? this_node + 1 : 0; + NodeT const next = NodeT{this_node.get() + 1 < num_nodes.get() ? this_node.get() + 1 : 0}; for (int j = 0; j < 5; j++) { auto msg = makeMessage(); diff --git a/tests/unit/termination/test_term_dep_send_chain.cc b/tests/unit/termination/test_term_dep_send_chain.cc index b02b02bc86..581b1cb176 100644 --- a/tests/unit/termination/test_term_dep_send_chain.cc +++ b/tests/unit/termination/test_term_dep_send_chain.cc @@ -74,7 +74,7 @@ struct MyObjGroup; struct MyCol : vt::Collection { MyCol() = default; - MyCol(NodeType num, int k) : max_x(static_cast(num)), max_y(k) { + MyCol(NodeT num, int k) : max_x(static_cast(num)), max_y(k) { idx_ = getIndex(); } @@ -256,7 +256,7 @@ struct MyCol : vt::Collection { migrating_ = true; auto node = vt::theContext()->getNode(); auto num = vt::theContext()->getNumNodes(); - auto next = node + 1 < num ? node + 1 : 0; + auto next = NodeT{node.get() + 1 < num.get() ? node.get() + 1 : 0}; this->migrate(next); } @@ -315,7 +315,7 @@ struct MyObjGroup { frontend_proxy_ = vt::theObjGroup()->makeCollective(this, "MyObjGroup"); } - void makeColl(std::string const& label, NodeType num_nodes, int k) { + void makeColl(std::string const& label, NodeT num_nodes, int k) { auto range = vt::Index2D(static_cast(num_nodes),k); backend_proxy_ = vt::theCollection()->constructCollective( range, [=](vt::Index2D idx) { return std::make_unique(num_nodes, k); }, @@ -363,7 +363,7 @@ struct MyObjGroup { chains_->nextStep("op4", [=](vt::Index2D idx) { auto node = vt::theContext()->getNode(); auto num = vt::theContext()->getNumNodes(); - auto next = node + 1 < num ? node + 1 : 0; + auto next = NodeT{node.get() + 1 < num.get() ? node.get() + 1 : 0}; auto proxy = frontend_proxy_(next); auto c = vt::theCB()->makeSend(proxy); return backend_proxy_(idx).template send(c); @@ -480,7 +480,7 @@ TEST_P(TestTermDepSendChain, test_term_dep_send_chain) { vt::theCollective()->barrier(); for (int t = 0; t < iter; t++) { - if (this_node == 0 && t % 5 == 0) { + if (this_node == vt::NodeT{0} && t % 5 == 0) { fmt::print("start iter={}, k={}, max_iter={}\n", t, k, iter); } @@ -517,7 +517,7 @@ struct PrintParam { struct MergeCol : vt::Collection { MergeCol() = default; - MergeCol(NodeType num, double off) : offset_( off ) { + MergeCol(NodeT num, double off) : offset_( off ) { idx_ = getIndex(); } @@ -583,7 +583,7 @@ struct MergeObjGroup frontend_proxy_ = vt::theObjGroup()->makeCollective(this, "MergeObjGroup"); } - void makeColl(std::string const& label, NodeType num_nodes, int k, double offset) { + void makeColl(std::string const& label, NodeT num_nodes, int k, double offset) { auto const node = theContext()->getNode(); auto range = vt::Index2D(static_cast(num_nodes),k); backend_proxy_ = vt::theCollection()->constructCollective( diff --git a/tests/unit/termination/test_termination_action_callable.extended.cc b/tests/unit/termination/test_termination_action_callable.extended.cc index e1d9f6248e..af5f0a9dcf 100644 --- a/tests/unit/termination/test_termination_action_callable.extended.cc +++ b/tests/unit/termination/test_termination_action_callable.extended.cc @@ -49,9 +49,9 @@ namespace vt { namespace tests { namespace unit { namespace channel { // set channel counting ranks -vt::NodeType root = vt::uninitialized_destination; -vt::NodeType node = vt::uninitialized_destination; -vt::NodeType all = vt::uninitialized_destination; +vt::NodeT root = vt::NodeT{}; +vt::NodeT node = vt::NodeT{}; +vt::NodeT all = vt::NodeT{}; std::unordered_map data; bool ok = false; diff --git a/tests/unit/termination/test_termination_action_common.cc b/tests/unit/termination/test_termination_action_common.cc index 4837a978e3..1d6157e358 100644 --- a/tests/unit/termination/test_termination_action_common.cc +++ b/tests/unit/termination/test_termination_action_common.cc @@ -47,9 +47,9 @@ namespace vt { namespace tests { namespace unit { namespace channel { // set channel counting ranks -vt::NodeType root = vt::uninitialized_destination; -vt::NodeType node = vt::uninitialized_destination; -vt::NodeType all = vt::uninitialized_destination; +vt::NodeT root = vt::NodeT{}; +vt::NodeT node = vt::NodeT{}; +vt::NodeT all = vt::NodeT{}; std::unordered_map data; bool ok = false; diff --git a/tests/unit/termination/test_termination_action_common.h b/tests/unit/termination/test_termination_action_common.h index 5f7537b17c..761572e3de 100644 --- a/tests/unit/termination/test_termination_action_common.h +++ b/tests/unit/termination/test_termination_action_common.h @@ -57,9 +57,9 @@ using namespace vt::tests::unit; namespace vt { namespace tests { namespace unit { namespace channel { // set channel counting ranks -extern vt::NodeType root; -extern vt::NodeType node; -extern vt::NodeType all; +extern vt::NodeT root; +extern vt::NodeT node; +extern vt::NodeT all; extern std::unordered_map data; extern bool ok; @@ -81,7 +81,7 @@ struct BaseFixture : Base { // explicit inheritance Base::SetUp(); // set channel counting ranks - channel::root = 0; + channel::root = vt::NodeT{0}; channel::node = vt::theContext()->getNode(); channel::all = vt::theContext()->getNumNodes(); SET_MIN_NUM_NODES_CONSTRAINT(2); @@ -111,7 +111,7 @@ struct SimpleFixture : TestParallelHarness { // explicit inheritance TestParallelHarness::SetUp(); // set channel counting ranks - channel::root = 0; + channel::root = vt::NodeT{0}; channel::node = vt::theContext()->getNode(); channel::all = vt::theContext()->getNumNodes(); SET_MIN_NUM_NODES_CONSTRAINT(2); diff --git a/tests/unit/termination/test_termination_action_common.impl.h b/tests/unit/termination/test_termination_action_common.impl.h index ddd38219af..19f891afda 100644 --- a/tests/unit/termination/test_termination_action_common.impl.h +++ b/tests/unit/termination/test_termination_action_common.impl.h @@ -95,12 +95,12 @@ inline void compute(vt::EpochType const& epoch) { int rounds = dist_round(engine); if (channel::all > 2) { for (int k = 0; k < rounds; ++k) { - int dst = channel::node + dist_dest(engine); - int ttl = dist_ttl(engine); + auto dst = channel::node + NodeT{dist_dest(engine)}; + auto ttl = dist_ttl(engine); channel::routeBasic(dst, ttl, epoch); } } else { - channel::broadcast(1, epoch); + channel::broadcast(vt::NodeT{1}, epoch); } } diff --git a/tests/unit/termination/test_termination_action_global.cc b/tests/unit/termination/test_termination_action_global.cc index f00fe8308d..50a4b4403f 100644 --- a/tests/unit/termination/test_termination_action_global.cc +++ b/tests/unit/termination/test_termination_action_global.cc @@ -50,7 +50,7 @@ struct TestTermGlobal : action::BaseFixture {}; TEST_P(TestTermGlobal, test_term_detect_broadcast) /* NOLINT*/{ if (channel::node == channel::root) { // start computation - channel::broadcast(1, vt::no_epoch); + channel::broadcast(vt::NodeT{1}, vt::no_epoch); // trigger detection and check status action::finalize(vt::no_epoch, order_); } diff --git a/tests/unit/termination/test_termination_channel_counting.h b/tests/unit/termination/test_termination_channel_counting.h index a7c890621e..bd5a5a6fc0 100644 --- a/tests/unit/termination/test_termination_channel_counting.h +++ b/tests/unit/termination/test_termination_channel_counting.h @@ -56,9 +56,9 @@ namespace vt { namespace tests { namespace unit { namespace channel { // ranks -extern vt::NodeType node; -extern vt::NodeType root; -extern vt::NodeType all; +extern vt::NodeT node; +extern vt::NodeT root; +extern vt::NodeT all; // data per rank and epoch struct Data { @@ -72,7 +72,7 @@ struct Data { : degree_(0), activator_(0) { - for (vt::NodeType dst = 0; dst < all; ++dst) { + for (vt::NodeT dst = NodeT{0}; dst < all; ++dst) { count_[dst] = {0, 0, 0}; } } @@ -80,8 +80,8 @@ struct Data { ~Data() { count_.clear(); } int degree_ = 0; - vt::NodeType activator_ = 0; - std::unordered_map count_; + vt::NodeT activator_ = NodeT{0}; + std::unordered_map count_; }; // channel counters per epoch and per rank @@ -89,15 +89,15 @@ extern std::unordered_map data; // send any kind of message template * handler> -void sendMsg(vt::NodeType dst, int count, vt::EpochType ep); +void sendMsg(vt::NodeT dst, int count, vt::EpochType ep); // broadcast basic message template * handler> void broadcast(int count, vt::EpochType ep); // route basic message, send control messages -inline void routeBasic(vt::NodeType dst, int ttl, vt::EpochType ep); -inline void sendPing(vt::NodeType dst, int count, vt::EpochType ep); -inline void sendEcho(vt::NodeType dst, int count, vt::EpochType ep); +inline void routeBasic(vt::NodeT dst, int ttl, vt::EpochType ep); +inline void sendPing(vt::NodeT dst, int count, vt::EpochType ep); +inline void sendEcho(vt::NodeT dst, int count, vt::EpochType ep); // on receipt of a basic message. inline void basicHandler(BasicMsg* msg); diff --git a/tests/unit/termination/test_termination_channel_counting.impl.h b/tests/unit/termination/test_termination_channel_counting.impl.h index 0991ee9ffd..7680f9d1f3 100644 --- a/tests/unit/termination/test_termination_channel_counting.impl.h +++ b/tests/unit/termination/test_termination_channel_counting.impl.h @@ -47,8 +47,8 @@ namespace vt { namespace tests { namespace unit { namespace channel { template* handler> -void sendMsg(vt::NodeType dst, int count, vt::EpochType ep) { - vtAssert(dst != vt::uninitialized_destination, "Invalid destination"); +void sendMsg(vt::NodeT dst, int count, vt::EpochType ep) { + vtAssert(dst != vt::NodeT{}, "Invalid destination"); vtAssert(dst != node, "Invalid destination"); auto msg = makeMessage(node, dst, count, ep); @@ -63,7 +63,7 @@ void sendMsg(vt::NodeType dst, int count, vt::EpochType ep) { template* handler> void broadcast(int count, vt::EpochType ep) { auto msg = makeMessage( - node, vt::uninitialized_destination, count, ep + node, vt::NodeT{}, count, ep ); if (ep != vt::no_epoch) { vt::envelopeSetEpoch(msg->env,ep); @@ -79,25 +79,25 @@ void broadcast(int count, vt::EpochType ep) { } } -inline void routeBasic(vt::NodeType dst, int ttl, vt::EpochType ep) { +inline void routeBasic(vt::NodeT dst, int ttl, vt::EpochType ep) { sendMsg(dst, ttl, ep); // increment outgoing message counter data[ep].count_[dst].out_++; } -inline void sendPing(vt::NodeType dst, int count, vt::EpochType ep) { +inline void sendPing(vt::NodeT dst, int count, vt::EpochType ep) { sendMsg(dst, count, ep); } -inline void sendEcho(vt::NodeType dst, int count, vt::EpochType ep) { +inline void sendEcho(vt::NodeT dst, int count, vt::EpochType ep) { vt_debug_print( normal, term, "rank:{} echo::dst {}\n", node, dst ); - vtAssert(dst >= 0, "Invalid destination"); - vtAssert(dst != vt::uninitialized_destination, "Invalid destination"); + vtAssert(dst >= NodeT{0}, "Invalid destination"); + vtAssert(dst != vt::NodeT{}, "Invalid destination"); sendMsg(dst, count, ep); } @@ -118,9 +118,9 @@ inline void routedHandler(BasicMsg* msg) { vtAssert(node != root, "Cannot route from root"); basicHandler(msg); - if (all > 2 && msg->ttl_ > 0) { + if (all > NodeT{2} && msg->ttl_ > 0) { // avoid implicit cast - vt::NodeType const one = 1; + vt::NodeT const one = NodeT{1}; int const nb_rounds = static_cast(drand48()*5); for (int k = 0; k < nb_rounds; ++k) { diff --git a/tests/unit/termination/test_termination_channel_message.h b/tests/unit/termination/test_termination_channel_message.h index 0bcbc00fb0..0673c95931 100644 --- a/tests/unit/termination/test_termination_channel_message.h +++ b/tests/unit/termination/test_termination_channel_message.h @@ -54,13 +54,13 @@ namespace vt { namespace tests { namespace unit { namespace channel { struct BasicMsg : vt::Message { int ttl_ = 0; // time to live for message routing - vt::NodeType src_ = vt::uninitialized_destination; - vt::NodeType dst_ = vt::uninitialized_destination; + vt::NodeT src_ = vt::NodeT{}; + vt::NodeT dst_ = vt::NodeT{}; vt::EpochType epoch_ = vt::no_epoch; BasicMsg() = default; BasicMsg( - vt::NodeType in_src, vt::NodeType in_dst, + vt::NodeT in_src, vt::NodeT in_dst, int in_ttl = 1, vt::EpochType in_epoch = vt::no_epoch ) : ttl_ (in_ttl - 1), src_ (in_src), @@ -75,13 +75,13 @@ struct BasicMsg : vt::Message { struct CtrlMsg : vt::Message { int count_ = 0; // incoming/outgoing basic message count - vt::NodeType src_ = vt::uninitialized_destination; - vt::NodeType dst_ = vt::uninitialized_destination; + vt::NodeT src_ = vt::NodeT{}; + vt::NodeT dst_ = vt::NodeT{}; vt::EpochType epoch_ = vt::no_epoch; CtrlMsg() = default; CtrlMsg( - vt::NodeType in_src, vt::NodeType in_dst, + vt::NodeT in_src, vt::NodeT in_dst, int in_nb = 0, vt::EpochType in_epoch = vt::no_epoch ) : count_(in_nb), src_ (in_src), diff --git a/tests/unit/termination/test_termination_reset.cc b/tests/unit/termination/test_termination_reset.cc index 2300e7b491..def729e977 100644 --- a/tests/unit/termination/test_termination_reset.cc +++ b/tests/unit/termination/test_termination_reset.cc @@ -71,10 +71,10 @@ TEST_F(TestTermReset, test_termination_reset_1) { auto const& this_node = theContext()->getNode(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto msg = makeMessage(); theMsg()->broadcastMsg(msg); - } else if (this_node == 1) { + } else if (this_node == vt::NodeT{1}) { theTerm()->addAction([=]{ EXPECT_EQ(handler_count, 10); }); @@ -87,10 +87,10 @@ TEST_F(TestTermReset, test_termination_reset_1) { handler_count = 0; theCollective()->barrier(); - if (this_node == 1) { + if (this_node == vt::NodeT{1}) { auto msg = makeMessage(); theMsg()->broadcastMsg(msg); - } else if (this_node == 0) { + } else if (this_node == vt::NodeT{0}) { theTerm()->addAction([=]{ EXPECT_EQ(handler_count, 10); }); diff --git a/tests/unit/test_helpers.h b/tests/unit/test_helpers.h index 0a54a20fde..31f8b13bc8 100644 --- a/tests/unit/test_helpers.h +++ b/tests/unit/test_helpers.h @@ -58,7 +58,7 @@ extern char** test_argv; * Maximum number of ranks/nodes detected by CMake on this machine. * Defaults to number of processors detected on the host system. */ -constexpr NodeType CMAKE_DETECTED_MAX_NUM_NODES = vt_detected_max_num_nodes; +constexpr NodeT CMAKE_DETECTED_MAX_NUM_NODES = NodeT{vt_detected_max_num_nodes}; /** * Check whether we're oversubscribing on the current execution. diff --git a/tests/unit/test_parallel_harness.h b/tests/unit/test_parallel_harness.h index a8c95c3eda..ba2a7405e1 100644 --- a/tests/unit/test_parallel_harness.h +++ b/tests/unit/test_parallel_harness.h @@ -177,7 +177,7 @@ using TestParallelHarnessParam = TestParallelHarnessAny< testing::TestWithParam >; -using TestParameterHarnessNode = TestParallelHarnessParam; +using TestParameterHarnessNode = TestParallelHarnessParam; }}} // end namespace vt::tests::unit diff --git a/tutorial/tutorial_1a.h b/tutorial/tutorial_1a.h index e583ca2d4f..8350cdba93 100644 --- a/tutorial/tutorial_1a.h +++ b/tutorial/tutorial_1a.h @@ -58,10 +58,10 @@ static inline void context() { */ // Equivalent to: MPI_Comm_rank(...) - NodeType const this_node = ::vt::theContext()->getNode(); + auto const this_node = ::vt::theContext()->getNode(); // Equivalent to: MPI_Comm_size(...) - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); // The header-only library fmt is used for printing throughout VT. You can use // it because the headers are included by default diff --git a/tutorial/tutorial_1b.h b/tutorial/tutorial_1b.h index 94c4a959fc..1a1fa8677e 100644 --- a/tutorial/tutorial_1b.h +++ b/tutorial/tutorial_1b.h @@ -94,8 +94,8 @@ struct MsgHandlerB { }; static inline void activeMessageNode() { - NodeType const this_node = ::vt::theContext()->getNode(); - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const this_node = ::vt::theContext()->getNode(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); (void)num_nodes; // don't warn about unused variable /* @@ -114,8 +114,8 @@ static inline void activeMessageNode() { * msgHandlerA, which uses the functor style send. */ - if (this_node == 0) { - NodeType const to_node = 1; + if (this_node == vt::NodeT{0}) { + NodeT const to_node = NodeT{1}; auto msg = ::vt::makeMessage(29,32); ::vt::theMsg()->sendMsg(to_node, msg); } @@ -150,7 +150,7 @@ static void msgHandlerA(MyMsg* msg) { * * A vtAssert will be raised if such an invalid use is detected. */ - NodeType const to_node = 0; + NodeT const to_node = NodeT{0}; auto msg2 = ::vt::makeMessage(10,20); ::vt::theMsg()->sendMsg(to_node, msg2); diff --git a/tutorial/tutorial_1c.h b/tutorial/tutorial_1c.h index f7e9946974..37d7830d2a 100644 --- a/tutorial/tutorial_1c.h +++ b/tutorial/tutorial_1c.h @@ -122,8 +122,8 @@ static void msgSerialA(ParticleMsg* msg); // Tutorial code to demonstrate serialization in active message sends static inline void activeMessageSerialization() { - NodeType const this_node = ::vt::theContext()->getNode(); - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const this_node = ::vt::theContext()->getNode(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); (void)num_nodes; // don't warn about unused variable /* @@ -132,8 +132,8 @@ static inline void activeMessageSerialization() { * message as if it is sent directly the sendMsg. */ - if (this_node == 0) { - NodeType const to_node = 1; + if (this_node == vt::NodeT{0}) { + NodeT const to_node = NodeT{1}; auto msg = ::vt::makeMessage(1,2,3); msg->particles.push_back(Particle{10,11,12}); msg->particles.push_back(Particle{13,14,15}); diff --git a/tutorial/tutorial_1d.h b/tutorial/tutorial_1d.h index e2e12e3e4f..71238d3bdb 100644 --- a/tutorial/tutorial_1d.h +++ b/tutorial/tutorial_1d.h @@ -68,8 +68,8 @@ static void msgHandlerX(MyDataMsg* msg); // Tutorial code to demonstrate broadcasting a message to the entire system static inline void activeMessageBroadcast() { - NodeType const this_node = ::vt::theContext()->getNode(); - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const this_node = ::vt::theContext()->getNode(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); (void)num_nodes; // don't warn about unused variable /* @@ -90,7 +90,7 @@ static inline void activeMessageBroadcast() { * Most calls to VT that supply a message are expected to relinquish ownership. */ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto const default_proxy = theObjGroup()->getDefault(); default_proxy.broadcast(1.0, 2.0, 3.0); } diff --git a/tutorial/tutorial_1e.h b/tutorial/tutorial_1e.h index bd21eacbf8..3319635dcd 100644 --- a/tutorial/tutorial_1e.h +++ b/tutorial/tutorial_1e.h @@ -56,8 +56,8 @@ static void msgHandlerGroupA(MySimpleMsg* msg); // Tutorial code to demonstrate rooted group creation and broadcast to that group static inline void activeMessageGroupRoot() { - NodeType const this_node = ::vt::theContext()->getNode(); - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const this_node = ::vt::theContext()->getNode(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); /* * This is an example of the rooted group creation and broadcast to that @@ -67,9 +67,9 @@ static inline void activeMessageGroupRoot() { * broadcast will only arrive on the nodes in that group. */ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { // Create range for the group [1,num_nodes); - auto range = std::make_unique<::vt::group::region::Range>(1, num_nodes); + auto range = std::make_unique<::vt::group::region::Range>(vt::NodeT{1}, num_nodes); // The non-collective group is created by a single node based on a range or // list of nodes. The lambda is executed once the group is created. By // setting the group in the envelope of the message and broadcasting the diff --git a/tutorial/tutorial_1f.h b/tutorial/tutorial_1f.h index fc6a79742c..9429c0660e 100644 --- a/tutorial/tutorial_1f.h +++ b/tutorial/tutorial_1f.h @@ -56,8 +56,8 @@ static void msgHandlerGroupB(MySimpleMsg2* msg); // Tutorial code to demonstrate collective group creation and broadcast to that group static inline void activeMessageGroupCollective() { - NodeType const this_node = ::vt::theContext()->getNode(); - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const this_node = ::vt::theContext()->getNode(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); (void)num_nodes; // don't warn about unused variable /* diff --git a/tutorial/tutorial_1g.h b/tutorial/tutorial_1g.h index 7379d165cf..e3f09c73c3 100644 --- a/tutorial/tutorial_1g.h +++ b/tutorial/tutorial_1g.h @@ -64,13 +64,13 @@ static void getCallbackHandler(MsgWithCallback* msg); // An active message handler used as the target for a callback static void callbackHandler(DataMsg* msg) { - NodeType const cur_node = ::vt::theContext()->getNode(); + NodeT const cur_node = ::vt::theContext()->getNode(); ::fmt::print("{}: triggering active message callback\n", cur_node); } // An active message handler used as the target for a callback static void callbackBcastHandler(DataMsg* msg) { - NodeType const cur_node = ::vt::theContext()->getNode(); + NodeT const cur_node = ::vt::theContext()->getNode(); ::fmt::print("{}: triggering active message callback bcast\n", cur_node); } @@ -80,15 +80,15 @@ static MyContext ctx = {}; // A message handler with context used as the target for a callback static void callbackCtx(DataMsg* msg, MyContext* cbctx) { - NodeType const cur_node = ::vt::theContext()->getNode(); + NodeT const cur_node = ::vt::theContext()->getNode(); ::fmt::print("{}: triggering context callback\n", cur_node); } // Tutorial code to demonstrate using a callback static inline void activeMessageCallback() { - NodeType const this_node = ::vt::theContext()->getNode(); - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const this_node = ::vt::theContext()->getNode(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); (void)num_nodes; // don't warn about unused variable /* @@ -98,11 +98,11 @@ static inline void activeMessageCallback() { * context, message send of virtual context collection (element or broadcast) */ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { // Node sending the callback message to, which shall invoke the callback - NodeType const to_node = 1; + auto const to_node = NodeT{1}; // Node that we want to callback to execute on - NodeType const cb_node = 0; + auto const cb_node = this_node; // Example lambda callback (void) auto void_fn = [=]{ diff --git a/tutorial/tutorial_1h.h b/tutorial/tutorial_1h.h index 250206f5aa..fed0c91cae 100644 --- a/tutorial/tutorial_1h.h +++ b/tutorial/tutorial_1h.h @@ -58,7 +58,7 @@ struct ReduceDataMsg : ::vt::collective::ReduceTMsg {}; // Functor that is the target of the reduction struct ReduceResult { void operator()(ReduceDataMsg* msg) { - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); fmt::print("reduction value={}\n", msg->getConstVal()); assert(num_nodes * 50 == msg->getConstVal()); (void)num_nodes; // don't warn about unused value when not debugging @@ -68,9 +68,9 @@ struct ReduceResult { // Tutorial code to demonstrate using reduction on all nodes static inline void activeMessageReduce() { - NodeType const this_node = ::vt::theContext()->getNode(); + auto const this_node = ::vt::theContext()->getNode(); (void)this_node; // don't warn about unused variable - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); (void)num_nodes; // don't warn about unused variable /* @@ -82,7 +82,7 @@ static inline void activeMessageReduce() { // operator for the combine during the reduce using ReduceOp = ::vt::collective::PlusOp; - NodeType const root_reduce_node = 0; + auto const root_reduce_node = vt::NodeT{0}; auto reduce_msg = ::vt::makeMessage(); diff --git a/tutorial/tutorial_2a.h b/tutorial/tutorial_2a.h index d3e8f47056..bd8f8e13e5 100644 --- a/tutorial/tutorial_2a.h +++ b/tutorial/tutorial_2a.h @@ -74,8 +74,8 @@ void MyCol::msgHandler(MyCollMsg* msg) { // Tutorial code to demonstrate creating a collection static inline void collection() { - NodeType const this_node = ::vt::theContext()->getNode(); - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const this_node = ::vt::theContext()->getNode(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); (void)num_nodes; // don't warn about unused variable /* @@ -93,7 +93,7 @@ static inline void collection() { .bulkInsert() // Bulk insert all the elements within the bounds .wait(); // Wait for construction and get the proxy back - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { // Broadcast a message to the entire collection. The msgHandler will be // invoked on every element to the collection proxy.broadcast(); diff --git a/tutorial/tutorial_2b.h b/tutorial/tutorial_2b.h index 31737b1c3e..391a22e05c 100644 --- a/tutorial/tutorial_2b.h +++ b/tutorial/tutorial_2b.h @@ -105,15 +105,15 @@ void ReduceCol::reduceHandler(ColRedMsg* msg) { // Tutorial code to demonstrate reducing a collection static inline void collectionReduce() { - NodeType const this_node = ::vt::theContext()->getNode(); - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const this_node = ::vt::theContext()->getNode(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); (void)num_nodes; // don't warn about unused variable /* * This is an example of reducing over a virtual context collection */ - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { // Range of 32 elements for the collection auto range = vt::Index1D(32); diff --git a/tutorial/tutorial_3a.h b/tutorial/tutorial_3a.h index 346b2e553e..f034866e0a 100644 --- a/tutorial/tutorial_3a.h +++ b/tutorial/tutorial_3a.h @@ -61,8 +61,8 @@ static void recurHandler(ExampleMsg* msg); // Tutorial code to demonstrate using a callback static inline void activeMessageTerm() { - NodeType const this_node = ::vt::theContext()->getNode(); - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); + auto const this_node = ::vt::theContext()->getNode(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); (void)num_nodes; // don't warn about unused variable /* @@ -75,10 +75,10 @@ static inline void activeMessageTerm() { // Create a new epoch: this is a collective invocation auto const new_epoch = theTerm()->makeEpochCollective(); - if (this_node == 0) { + if (this_node == vt::NodeT{0}) { auto msg = vt::makeMessage(8); envelopeSetEpoch(msg->env, new_epoch); - vt::theMsg()->sendMsg(this_node+1, msg); + vt::theMsg()->sendMsg(this_node+NodeT{1}, msg); } // Any node that wishes to have a notification on termination for a given @@ -98,8 +98,8 @@ static inline void activeMessageTerm() { // Message handler that recursively sends messages static void recurHandler(ExampleMsg* msg) { - NodeType const num_nodes = ::vt::theContext()->getNumNodes(); - NodeType const this_node = ::vt::theContext()->getNode(); + auto const num_nodes = ::vt::theContext()->getNumNodes(); + auto const this_node = ::vt::theContext()->getNode(); ::fmt::print( "{}: recurHandler: ttl={}, triggered\n", this_node, msg->ttl @@ -108,7 +108,9 @@ static void recurHandler(ExampleMsg* msg) { if (msg->ttl > 0) { auto const num_send = static_cast(drand48() * 3); for (auto i = 0; i < num_send; i++) { - auto next_node = (this_node + 1 > num_nodes - 1) ? 0 : (this_node + 1); + auto next_node = (this_node + NodeT{1} > num_nodes - NodeT{1}) ? + NodeT{0} : + (this_node + NodeT{1}); ::fmt::print( "{}: recurHandler: i={}, next_node={}, num_send={}\n",