From c7002b799ebc8458101a724962736b4a28bd94ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Perrinel=20Me=CC=81riadeg?= Date: Thu, 12 Sep 2019 14:55:34 +0200 Subject: [PATCH] #431: lb: first try on vector reduction --- src/vt/collective/reduce/operators/functors/or_op.h | 9 +++++++++ src/vt/vrt/collection/balance/lb_invoke/invoke.cc | 1 + src/vt/vrt/collection/balance/lb_invoke/invoke.h | 5 +++++ src/vt/vrt/collection/balance/statsmaplb/statsmaplb.h | 8 ++++++++ 4 files changed, 23 insertions(+) diff --git a/src/vt/collective/reduce/operators/functors/or_op.h b/src/vt/collective/reduce/operators/functors/or_op.h index 31054b30b4..9b910c1a92 100644 --- a/src/vt/collective/reduce/operators/functors/or_op.h +++ b/src/vt/collective/reduce/operators/functors/or_op.h @@ -56,6 +56,15 @@ struct OrOp { } }; +template +struct OrOp> { + void operator()(std::vector& v1, std::vector const& v2) { + vtAssert(v1.size() == v2.size(), "Sizes of vectors in reduce must be equal"); + for (size_t ii = 0; ii < v1.size(); ++ii) + v1[ii] = v1[ii] or v2[ii]; + } +}; + }}}} /* end namespace vt::collective::reduce::operators */ namespace vt { namespace collective { diff --git a/src/vt/vrt/collection/balance/lb_invoke/invoke.cc b/src/vt/vrt/collection/balance/lb_invoke/invoke.cc index 9e7a6710ef..75d59fdc39 100644 --- a/src/vt/vrt/collection/balance/lb_invoke/invoke.cc +++ b/src/vt/vrt/collection/balance/lb_invoke/invoke.cc @@ -197,6 +197,7 @@ InvokeLB::makeLB(MsgSharedPtr msg) { /*static*/ void InvokeLB::releaseLBCollective(InvokeMsg* msg) { return releaseLBCollective(msg->phase_); + } }}}} /* end namespace vt::vrt::collection::balance */ diff --git a/src/vt/vrt/collection/balance/lb_invoke/invoke.h b/src/vt/vrt/collection/balance/lb_invoke/invoke.h index b9be98a10b..ad61f7c25f 100644 --- a/src/vt/vrt/collection/balance/lb_invoke/invoke.h +++ b/src/vt/vrt/collection/balance/lb_invoke/invoke.h @@ -68,6 +68,11 @@ struct InvokeLB { static void releaseLBCollective(InvokeReduceMsg* msg); static void releaseLBCollective(PhaseType phase); + using ReduceMsgType = collective::ReduceVecMsg; + void doneReduce(ReduceMsgType* msg) { + + } + template static objgroup::proxy::Proxy makeLB(MsgSharedPtr msg); diff --git a/src/vt/vrt/collection/balance/statsmaplb/statsmaplb.h b/src/vt/vrt/collection/balance/statsmaplb/statsmaplb.h index 45985ab251..a14a47d4d2 100644 --- a/src/vt/vrt/collection/balance/statsmaplb/statsmaplb.h +++ b/src/vt/vrt/collection/balance/statsmaplb/statsmaplb.h @@ -47,6 +47,8 @@ #include "vt/config.h" #include "vt/vrt/collection/balance/baselb/baselb.h" +#include "vt/vrt/collection/balance/lb_invoke/invoke.h" +#include "vt/collective/reduce/operators/functors/or_op.h" #include @@ -64,6 +66,12 @@ struct StatsMapLB : BaseLB { double getDefaultMaxThreshold() const override { return 0.0; } bool getDefaultAutoThreshold() const override { return true; } + void doReduce() { +// auto cb = theCB()->makeBcast(proxy); +// auto msg = makeMessage(phase_changed_map_); +// proxy.reduce>>(msg.get(),cb); + } + private: void loadPhaseChangedMap();