Skip to content

Commit

Permalink
#1129: scheduler: add subphase collectives
Browse files Browse the repository at this point in the history
  • Loading branch information
nlslatt committed May 13, 2022
1 parent d4f04ee commit 7999707
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/vt/scheduler/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ void runInEpochCollective(Callable&& fn);
template <typename Callable>
void runInEpochCollective(std::string const& label, Callable&& fn);

template <typename Callable>
void runSubphaseCollective(Callable&& fn);

template <typename Callable>
void runSubphaseCollective(std::string const& label, Callable&& fn);

namespace messaging {

template <typename T>
Expand Down
15 changes: 15 additions & 0 deletions src/vt/scheduler/scheduler.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "vt/config.h"
#include "vt/messaging/active.h"
#include "vt/termination/termination.h"
#include "vt/phase/phase_manager.h"

namespace vt {

Expand All @@ -72,6 +73,20 @@ void runInEpochCollective(std::string const& label, Callable&& fn) {
runInEpoch(ep, std::forward<Callable>(fn));
}

template <typename Callable>
void runSubphaseCollective(Callable&& fn) {
runSubphaseCollective("UNLABELED", std::forward<Callable>(fn));
}

template <typename Callable>
void runSubphaseCollective(std::string const& label, Callable&& fn) {
auto ep = theTerm()->makeEpochCollective(label);
theTerm()->addActionEpoch(ep, [=]{
thePhase()->advanceSubphase();
});
runInEpoch(ep, std::forward<Callable>(fn));
}

template <typename Callable>
void runInEpochRooted(Callable&& fn) {
runInEpochRooted("UNLABELED", std::forward<Callable>(fn));
Expand Down

0 comments on commit 7999707

Please sign in to comment.