diff --git a/examples/rdma/rdma_simple_put.cc b/examples/rdma/rdma_simple_put.cc index 7b4dbe1b72..60dd1ede59 100644 --- a/examples/rdma/rdma_simple_put.cc +++ b/examples/rdma/rdma_simple_put.cc @@ -145,7 +145,7 @@ int main(int argc, char** argv) { auto msg = vt::makeMessage(this_node); msg->han = my_handle; - vt::theMsg()->broadcastMsg(msg); + vt::theMsg()->broadcastMsg(msg, false); } vt::finalize(); diff --git a/src/vt/group/global/group_default.cc b/src/vt/group/global/group_default.cc index 86dd89d09c..f49815c37f 100644 --- a/src/vt/group/global/group_default.cc +++ b/src/vt/group/global/group_default.cc @@ -163,13 +163,16 @@ namespace vt { namespace group { namespace global { 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; + vt_debug_print( broadcast, node, "DefaultGroup::broadcast msg={}, size={}, from={}, dest={}, is_root={}\n", print_ptr(base.get()), size, from, dest, print_bool(is_root) ); - if (is_root || ((num_children > 0) && !is_root_of_tree) || send_to_root) { + if ((num_children > 0 || send_to_root) && (!this_node_dest || first_send)) { auto const& send_tag = static_cast( messaging::MPITag::ActiveMsgTag ); @@ -192,10 +195,6 @@ namespace vt { namespace group { namespace global { }); } - if (is_root && envelopeGetDeliverBcast(msg->env)) { - *deliver = true; - } - // If not the root of the spanning tree, send to the root to propagate to // the rest of the tree if (send_to_root) { @@ -210,6 +209,10 @@ namespace vt { namespace group { namespace global { } } + if (is_root) { + *deliver = envelopeGetDeliverBcast(msg->env); + } + return event; } diff --git a/tests/unit/active/test_active_bcast_put.cc b/tests/unit/active/test_active_bcast_put.cc index ff3da48a0b..c4f96f5df2 100644 --- a/tests/unit/active/test_active_bcast_put.cc +++ b/tests/unit/active/test_active_bcast_put.cc @@ -131,7 +131,7 @@ TEST_P(TestActiveBroadcastPut, test_type_safe_active_fn_bcast2) { } }); - ASSERT_TRUE(handler_count == num_msg_sent); + ASSERT_EQ(num_msg_sent, handler_count); } // Spin here so test_vec does not go out of scope before the send completes diff --git a/tests/unit/active/test_active_broadcast.cc b/tests/unit/active/test_active_broadcast.cc index 358479d12a..429ab7b622 100644 --- a/tests/unit/active/test_active_broadcast.cc +++ b/tests/unit/active/test_active_broadcast.cc @@ -109,7 +109,7 @@ TEST_P(TestActiveBroadcast, test_type_safe_active_fn_bcast2) { } }); - ASSERT_TRUE(handler_count == num_msg_sent); + ASSERT_EQ(num_msg_sent, handler_count); } } diff --git a/tests/unit/location/test_location.cc b/tests/unit/location/test_location.cc index 100c83a8be..47edba555a 100644 --- a/tests/unit/location/test_location.cc +++ b/tests/unit/location/test_location.cc @@ -404,11 +404,12 @@ TYPED_TEST_P(TestLocationRoute, test_entity_cache_migrated_entity) /* NOLINT */{ auto const nb_rounds = 5; auto nb_received = 0; - // register entity - if (my_node == home) { - vt::theLocMan()->virtual_loc->registerEntity(entity, my_node); - } - vt::theCollective()->barrier(); + ::vt::runInEpochCollective([my_node, entity] { + // register entity + if (my_node == home) { + vt::theLocMan()->virtual_loc->registerEntity(entity, my_node); + } + }); if (my_node == home) { // migrate entity: unregister it but keep its id in cache