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 : /// phase in which AMR criteria are evaluated 54 : EvaluateAmrCriteria, 55 : /// phase in which time steps are taken for an evolution executable 56 : Evolve, 57 : /// generic execution phase of an executable 58 : Execute, 59 : /// final phase of an executable 60 : Exit, 61 : /// phase in which initial data is imported from volume files 62 : ImportInitialData, 63 : /// initial phase of an executable 64 : Initialization, 65 : /// phase in which quantities dependent on imported initial data are 66 : /// initialized 67 : InitializeInitialDataDependentQuantities, 68 : /// phase in which the time stepper executes a self-start procedure 69 : InitializeTimeStepperHistory, 70 : /// phase in which components are migrated 71 : LoadBalancing, 72 : /// phase in which components know an error occurred and they need to do some 73 : /// sort of cleanup, such as dumping data to disk. 74 : PostFailureCleanup, 75 : /// phase in which components register with other components 76 : Register, 77 : /// phase in which components register with the data importer components 78 : RegisterWithElementDataReader, 79 : /// phase in which something is solved 80 : Solve, 81 : /// phase in which something is tested 82 : Testing, 83 : /// phase in which checkpoint files are written to disk 84 : WriteCheckpoint 85 : }; 86 : 87 0 : std::vector<Phase> known_phases(); 88 : 89 : /// Output operator for a Phase. 90 1 : std::ostream& operator<<(std::ostream& os, const Phase& phase); 91 : } // namespace Parallel 92 : 93 : template <> 94 0 : struct Options::create_from_yaml<Parallel::Phase> { 95 : template <typename Metavariables> 96 0 : static Parallel::Phase create(const Options::Option& options) { 97 : return create<void>(options); 98 : } 99 : }; 100 : 101 : template <> 102 0 : Parallel::Phase Options::create_from_yaml<Parallel::Phase>::create<void>( 103 : const Options::Option& options);