From c0807042d2951db4dcf75704515435dcd94f4828 Mon Sep 17 00:00:00 2001 From: Jacob Domagala Date: Mon, 15 Jul 2024 20:25:17 +0200 Subject: [PATCH] #2318: Fix and issue with multicast not sending to all required nodes --- src/vt/objgroup/proxy/proxy_objgroup.impl.h | 29 ++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/vt/objgroup/proxy/proxy_objgroup.impl.h b/src/vt/objgroup/proxy/proxy_objgroup.impl.h index a0779cf7fd..f546b65719 100644 --- a/src/vt/objgroup/proxy/proxy_objgroup.impl.h +++ b/src/vt/objgroup/proxy/proxy_objgroup.impl.h @@ -139,7 +139,8 @@ Proxy::multicast(GroupType type, Params&&... params) const{ template template typename Proxy::PendingSendType Proxy::multicast( - group::region::Region::RegionUPtrType&& nodes, Params&&... params) const { + group::region::Region::RegionUPtrType&& nodes, Params&&... params +) const { vtAssert( not dynamic_cast(nodes.get()), "multicast: range of nodes is not supported for ShallowList!" @@ -150,13 +151,29 @@ typename Proxy::PendingSendType Proxy::multicast( auto groupID = theGroup()->GetTempGroupForRange(range); if (!groupID.has_value()) { - groupID = theGroup()->newGroup( - std::move(nodes), []([[maybe_unused]] GroupType type) {} - ); - theGroup()->AddNewTempGroup(range, groupID.value()); + return typename Proxy::PendingSendType{ + theTerm()->getCurrentEpoch(), + [&, this, + args = std::make_tuple(std::forward(params)...)] { + std::apply( + [&, this](auto&&... unpackedArgs) { + // Explicit copy, we move 'nodes' in group creation + auto range_copy = nodes->makeList(); + auto id = + theGroup()->newGroup(std::move(nodes), [&, this](GroupType type) { + multicast( + type, std::forward(unpackedArgs)...); + }); + theGroup()->AddNewTempGroup(range_copy, id); + }, + std::move(args)); + }}; + } else { + return multicast(groupID.value(), std::forward(params)...); } - return multicast(groupID.value(), std::forward(params)...); + // Silence nvcc warning (no longer needed for CUDA 11.7 and up) + return typename Proxy::PendingSendType{std::nullptr_t{}}; } template