Skip to content

Commit

Permalink
#1129: examples: update lb_iter subphase usage
Browse files Browse the repository at this point in the history
  • Loading branch information
nlslatt committed May 13, 2022
1 parent 011e202 commit e7e18a6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions examples/collection/lb_iter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ struct IterCol : vt::Collection<IterCol, vt::Index1D> {
struct IterMsg : vt::CollectionMessage<IterCol> {
IterMsg() = default;
IterMsg(
int64_t const in_work_amt, int64_t const in_iter, int64_t const subphase
int64_t const in_work_amt, int64_t const in_iter
)
: iter_(in_iter), work_amt_(in_work_amt), subphase_(subphase)
: iter_(in_iter), work_amt_(in_work_amt)
{ }

int64_t iter_ = 0;
int64_t work_amt_ = 0;
int64_t subphase_ = 0;
};

void iterWork(IterMsg* msg);
Expand All @@ -77,7 +76,6 @@ struct IterCol : vt::Collection<IterCol, vt::Index1D> {
static double weight = 1.0f;

void IterCol::iterWork(IterMsg* msg) {
this->lb_data_.setSubPhase(msg->subphase_);
double val = 0.1f;
double val2 = 0.4f * msg->work_amt_;
auto const idx = getIndex().x();
Expand Down Expand Up @@ -130,14 +128,14 @@ int main(int argc, char** argv) {
for (int i = 0; i < num_iter; i++) {
auto cur_time = vt::timing::getCurrentTime();

vt::runInEpochCollective([=]{
proxy.broadcastCollective<IterCol::IterMsg,&IterCol::iterWork>(10, i, 0);
vt::runSubphaseCollective([=]{
proxy.broadcastCollective<IterCol::IterMsg,&IterCol::iterWork>(10, i);
});
vt::runInEpochCollective([=]{
proxy.broadcastCollective<IterCol::IterMsg,&IterCol::iterWork>(5, i, 1);
vt::runSubphaseCollective([=]{
proxy.broadcastCollective<IterCol::IterMsg,&IterCol::iterWork>(5, i);
});
vt::runInEpochCollective([=]{
proxy.broadcastCollective<IterCol::IterMsg,&IterCol::iterWork>(15, i, 2);
vt::runSubphaseCollective([=]{
proxy.broadcastCollective<IterCol::IterMsg,&IterCol::iterWork>(15, i);
});

auto total_time = vt::timing::getCurrentTime() - cur_time;
Expand Down

0 comments on commit e7e18a6

Please sign in to comment.