Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <iosfwd>
7 : #include <vector>
8 :
9 : /// \cond
10 : namespace Options {
11 : class Option;
12 : template <typename T>
13 : struct create_from_yaml;
14 : } // namespace Options
15 : /// \endcond
16 :
17 : namespace Parallel {
18 :
19 : /*!
20 : * \ingroup ParallelGroup
21 : * \brief The possible phases of an executable
22 : *
23 : * \details Spectre executables are split into distinct phases separated by
24 : * global synchronizations. Each executable will start with phase
25 : * `Initialization` and end with phase `Exit`. The metavariables of each
26 : * executable must define `default_phase_order`, an array of Parallel::Phase
27 : * that must contain at least `Initialization` as the first element and `Exit`
28 : * as the last element. Usually the next phase is determined from the
29 : * `default_phase_order` provided by the metavariables. If more complex
30 : * decision making is desired, use the PhaseControl infrastructure.
31 : *
32 : * \warning The phases are in alphabetical order. Do not use the values of the
33 : * underlying integral type as they will change as new phases are added to the
34 : * list!
35 : *
36 : * \see PhaseChange and \ref dev_guide_parallelization_foundations
37 : * "Parallelization infrastructure" for details.
38 : *
39 : */
40 1 : enum class Phase {
41 : // If you add a new phase: put it in the list alphabetically, add it to the
42 : // vector created by known_phases() below, and add it to the stream operator
43 : // If the new phase is the first or last in the list, update Test_Phase.
44 :
45 : /// phase in which AMR adjusts the domain
46 : AdjustDomain,
47 : /// phase in which elliptic problems construct a matrix representation
48 : BuildMatrix,
49 : /// phase in which sanity checks are done after AMR
50 : CheckDomain,
51 : /// a cleanup phase
52 : Cleanup,
53 : /// a phase in which the rotation control system is disable and the
54 : /// rotation function of time is switched to settling to a constant.
55 : DisableRotationControl,
56 : /// phase in which AMR criteria are evaluated
57 : EvaluateAmrCriteria,
58 : /// phase in which time steps are taken for an evolution executable
59 : Evolve,
60 : /// generic execution phase of an executable
61 : Execute,
62 : /// final phase of an executable
63 : Exit,
64 : /// phase in which initial data is imported from volume files
65 : ImportInitialData,
66 : /// initial phase of an executable
67 : Initialization,
68 : /// phase in which quantities dependent on imported initial data are
69 : /// initialized
70 : InitializeInitialDataDependentQuantities,
71 : /// phase in which the time stepper executes a self-start procedure
72 : InitializeTimeStepperHistory,
73 : /// phase in which components are migrated
74 : LoadBalancing,
75 : /// phase in which components know an error occurred and they need to do some
76 : /// sort of cleanup, such as dumping data to disk.
77 : PostFailureCleanup,
78 : /// phase in which components register with other components
79 : Register,
80 : /// phase in which components register with the data importer components
81 : RegisterWithElementDataReader,
82 : /// phase run after a checkpoint-restart
83 : Restart,
84 : /// phase in which something is solved
85 : Solve,
86 : /// phase in which something is tested
87 : Testing,
88 : /// phase in which options are changed after restart
89 : UpdateOptionsAtRestartFromCheckpoint,
90 : /// phase in which array sections are updated
91 : UpdateSections,
92 : /// phase in which checkpoint files are written to disk
93 : WriteCheckpoint
94 : };
95 :
96 0 : std::vector<Phase> known_phases();
97 :
98 : /// Output operator for a Phase.
99 1 : std::ostream& operator<<(std::ostream& os, const Phase& phase);
100 : } // namespace Parallel
101 :
102 : template <>
103 0 : struct Options::create_from_yaml<Parallel::Phase> {
104 : template <typename Metavariables>
105 0 : static Parallel::Phase create(const Options::Option& options) {
106 : return create<void>(options);
107 : }
108 : };
109 :
110 : template <>
111 0 : Parallel::Phase Options::create_from_yaml<Parallel::Phase>::create<void>(
112 : const Options::Option& options);
|