Skip to content

Commit

Permalink
Merge pull request #1968 from DARMA-tasking/1967-add-interface-to-dis…
Browse files Browse the repository at this point in the history
…able-td-for-performance-testing

#1967: TD: add enable/disable for performance tests
  • Loading branch information
lifflander authored and cz4rs committed Sep 28, 2022
2 parents 68fae40 + 96cc8e5 commit 77a3e12
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/vt/termination/termination.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1233,4 +1233,18 @@ std::size_t TerminationDetector::getNumTerminatedCollectiveEpochs() const {
return window->getTotalTerminated();
}

void TerminationDetector::disableTD(EpochType in_epoch) {
vtAssert(not isDS(in_epoch), "Must be a wave based epoch");
auto& state = in_epoch == any_epoch_sentinel ?
any_epoch_state_ : findOrCreateState(in_epoch, false);
state.incrementDependency();
}

void TerminationDetector::enableTD(EpochType in_epoch) {
vtAssert(not isDS(in_epoch), "Must be a wave based epoch");
auto& state = in_epoch == any_epoch_sentinel ?
any_epoch_state_ : findOrCreateState(in_epoch, false);
state.decrementDependency();
}

}} // end namespace vt::term
19 changes: 19 additions & 0 deletions src/vt/termination/termination.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,25 @@ struct TerminationDetector :
*/
void addDependency(EpochType predecessor, EpochType successoor);

/**
* \brief Disable termination detection on an epoch. Local counting is still
* enabled, but any non-local progress is halted until it is enabled
*
* \warning Does not work with DS epochs. It must be a wave based epoch.
*
* \param[in] in_epoch the epoch
*/
void disableTD(EpochType in_epoch = any_epoch_sentinel);

/**
* \brief Enable termination detection on an epoch.
*
* \warning Does not work with DS epochs. It must be a wave based epoch.
*
* \param[in] in_epoch the epoch
*/
void enableTD(EpochType in_epoch = any_epoch_sentinel);

public:
// Methods for testing state of TD from unit tests
EpochContainerType<TermStateType> const& getEpochState() { return epoch_state_; }
Expand Down

0 comments on commit 77a3e12

Please sign in to comment.