Gromacs
2024.4
|
Impl class for ObservablesReducer.
Public Member Functions | |
Impl (std::vector< double > &&communicationBuffer, std::vector< ObservablesReducerBuilder::CallbackAfterReduction > &®isteredCallbacks) | |
Constructor. | |
ObservablesReducerStatus | requireReduction (int callbackIndex, ReductionRequirement requirement) |
May be called by any subscribed module, via the callback supplied by ObservablesReducerBuilder::build(). More... | |
Public Attributes | |
std::vector< double > | communicationBuffer_ |
Storage for communication buffer. More... | |
std::vector < ObservablesReducerBuilder::CallbackAfterReduction > | registeredCallbacks_ |
Registered callbacks that might be used after communication. | |
std::vector< int > | callbacksAfterReduction_ |
Indices into registeredCallbacks_ of callbacks to use after the next reduction. | |
bool | reduceSoon_ = false |
Whether the reduction will occur soon because a module required it. More... | |
ObservablesReducerStatus | status_ = ObservablesReducerStatus::ReadyToReduce |
Whether reduction has taken place this step. | |
|
inline |
May be called by any subscribed module, via the callback supplied by ObservablesReducerBuilder::build().
If this method has been called on this rank since the last call to reduceComplete() with a requirement
to communicate soon, then it will make the communication buffer available via communicationBuffer() to compute_globals()
, so it can copy it to the buffer it uses for MPI communication.
It is the subscribers' responsibility to coordinate so that all subscribers on all ranks agree on the need to communicate, e.g. by orchestating communication based on the current step number or a previous message.
Does not check that the callback corresponds to a module that subscribed to the builder().
Returns the status of the ObservablesReducer about whether reduction has already been called on this step.
std::vector<double> gmx::ObservablesReducer::Impl::communicationBuffer_ |
Storage for communication buffer.
Must never be resized, because that would potentially invalidate views of it held by the subscribers.
bool gmx::ObservablesReducer::Impl::reduceSoon_ = false |
Whether the reduction will occur soon because a module required it.
"Soon" means this step or next, depending when during the step it was required, as there is only one point during a normal simulator step where observables reduction might occur.