SpECTRE  v2024.04.12
PhaseChange Struct Reference

PhaseChange objects determine the storage types and logic for moving between phases based on runtime data. More...

#include <PhaseChange.hpp>

Public Member Functions

 PhaseChange (CkMigrateMessage *msg)
 
 WRAPPED_PUPable_abstract (PhaseChange)
 
template<typename ParallelComponent , typename DbTags , typename Metavariables , typename ArrayIndex >
void contribute_phase_data (const gsl::not_null< db::DataBox< DbTags > * > box, Parallel::GlobalCache< Metavariables > &cache, const ArrayIndex &array_index) const
 Send data from all participating_components to the Main chare for determining the next phase.
 
template<typename... DecisionTags, typename Metavariables >
std::optional< std::pair< Parallel::Phase, PhaseControl::ArbitrationStrategy > > arbitrate_phase_change (const gsl::not_null< tuples::TaggedTuple< DecisionTags... > * > phase_change_decision_data, const Parallel::Phase current_phase, const Parallel::GlobalCache< Metavariables > &cache) const
 Determine a phase request and PhaseControl::ArbitrationStrategy based on aggregated phase_change_decision_data on the Main Chare.
 
template<typename Metavariables , typename... Tags>
void initialize_phase_data (const gsl::not_null< tuples::TaggedTuple< Tags... > * > phase_change_decision_data) const
 Initialize the phase_change_decision_data on the main chare to starting values.
 

Detailed Description

PhaseChange objects determine the storage types and logic for moving between phases based on runtime data.

The phase control flow must have the cooperation of each parallel component, but make phase decisions centrally so that at any point, all components are in the same phase. The operations needed by the parallel components and by the Main chare, are:

  1. Parallel components must select and/or compute the runtime data necessary for choosing the next phase, then contribute it to a global reduction to the Main component. The components must then halt at a globally-valid state for the phase change. The requirements for the state will vary depending on the phase choices, so triggers must be selected appropriately for the PhaseChange object. For instance, selecting a common slab will usually represent a globally well-behaved state for a DgElementArray.
  2. On the Main chare, the PhaseChange objects must use the collected reduction data, or other persistent data stored in phase_change_decision_data to decide on a phase to request and an PhaseControl::ArbitrationStrategy to determine how to resolve multiple simultaneous requests. Additionally, the PhaseChange objects must specify initialization functions to set the starting state of the tags in phase_change_decision_data for which they are responsible.

In addition to the options type alias and static constexpr Options::String help variable needed to be option-creatable, a derived class of PhaseChange must specify the type aliases:

  • argument_tags: A tmpl::list of tags from the DataBox to be passed to contribute_phase_data_impl as const references.
  • return_tags: A tmpl::list of mutable tags from the DataBox to be passed to contribute_phase_data_impl as gsl::not_null pointers. This should be used only for tags that may be altered during the contribute_phase_data_impl function.
  • phase_change_tags_and_combines: A tmpl::list of tags for populating the phase_change_decision_data in the Main chare. Each tag in this list must also define a combine_method and a main_combine_method for performing the aggregation during reduction.
  • participating_components (templated on Metavariables): A tmpl::list of components that contribute data during this reduction. This can be used to screen out components that will not have the necessary information to contribute to the reduction. If all components should participate, this type alias can be set to simply typename Metavariables::component_list.

And member functions with signatures:

template <typename... DecisionTags>
void initialize_phase_data_impl(
phase_change_decision_data) const;
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:261
  • Must set all tags in phase_change_tags_and_combines to useful initial states in the phase_change_decision_data.
template <typename ParallelComponent, typename ArrayIndex>
void contribute_phase_data_impl(
[DataBox return tags...], [DataBox argument tags...],
const ArrayIndex& array_index) const;
A Charm++ chare that caches global data once per Charm++ node.
Definition: GlobalCache.hpp:221
template <typename... DecisionTags, typename Metavariables>
typename std::optional<
arbitrate_phase_change_impl(
phase_change_decision_data,
const Parallel::Phase current_phase,
Phase
The possible phases of an executable.
Definition: Phase.hpp:40
  • Should examine the collected data in phase_change_decision_data and optionally return a std::pair with the desired Parallel::Phase and an PhaseControl::ArbitrationStrategy indicating a method for arbitrating multiple simultaneous requests. Alternatively, it may return std::nullopt to abstain from the phase decision. The arbitrate_phase_change_impl may (and often will) mutate the phase_change_decision_data. For instance, it may be desirable to 'reset' the data to allow for future jumps associated with the same PhaseChange, or the PhaseChange will describe multiple changes in sequence, and the state of that sequential process can be recorded in phase_change_decision_data.

The documentation for this struct was generated from the following file: