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