Skip to content

Commit

Permalink
#431: lb: first try on vector reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
mperrinel committed Sep 12, 2019
1 parent dfcb3c0 commit c7002b7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/vt/collective/reduce/operators/functors/or_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ struct OrOp {
}
};

template <typename T>
struct OrOp<std::vector<T>> {
void operator()(std::vector<T>& v1, std::vector<T> 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 {
Expand Down
1 change: 1 addition & 0 deletions src/vt/vrt/collection/balance/lb_invoke/invoke.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ InvokeLB::makeLB(MsgSharedPtr<StartLBMsg> msg) {

/*static*/ void InvokeLB::releaseLBCollective(InvokeMsg* msg) {
return releaseLBCollective(msg->phase_);

}

}}}} /* end namespace vt::vrt::collection::balance */
5 changes: 5 additions & 0 deletions src/vt/vrt/collection/balance/lb_invoke/invoke.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ struct InvokeLB {
static void releaseLBCollective(InvokeReduceMsg* msg);
static void releaseLBCollective(PhaseType phase);

using ReduceMsgType = collective::ReduceVecMsg<bool>;
void doneReduce(ReduceMsgType* msg) {

}

template <typename LB>
static objgroup::proxy::Proxy<LB> makeLB(MsgSharedPtr<StartLBMsg> msg);

Expand Down
8 changes: 8 additions & 0 deletions src/vt/vrt/collection/balance/statsmaplb/statsmaplb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <random>

Expand All @@ -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<StatsMapLB,balance::InvokeLB::ReduceMsgType,&balance::InvokeLB::doneReduce>(proxy);
// auto msg = makeMessage<balance::InvokeLB::ReduceMsgType>(phase_changed_map_);
// proxy.reduce<collective::reduce::operators::OrOp<std::vector<int>>>(msg.get(),cb);
}


private:
void loadPhaseChangedMap();
Expand Down

0 comments on commit c7002b7

Please sign in to comment.