Peano
Loading...
Searching...
No Matches
ccz4-main.cpp
Go to the documentation of this file.
1// **********************************************************************************************
2// This file is modifed from the original version generated by exahype2.
3// You are free to change the content here, but do not delete it or the
4// auto-generated main file will disable the additional step and causing compiling errors.
5// in some circumstance.
6// **********************************************************************************************
7
8#include <iomanip>
9
10#include "config.h"
11#include "Constants.h"
12#include "ccz4-main.h"
13#include "exahype2/UnitTests.h"
15#include "observers/CreateGrid.h"
16#include "observers/CreateGridAndConvergeLoadBalancing.h"
17#include "observers/CreateGridButPostponeRefinement.h"
18#include "observers/InitGrid.h"
19#include "observers/PlotSolution.h"
20#include "observers/CheckpointSolution.h"
21#include "observers/TimeStep.h"
22#include "peano4/peano.h"
23#include "peano4/UnitTests.h"
24#include "repositories/DataRepository.h"
25#include "repositories/SolverRepository.h"
26#include "repositories/StepRepository.h"
27#include "tarch/UnitTests.h"
30#include "tarch/logging/Log.h"
39#include "tarch/timing/Watch.h"
42
44#if defined(USE_ADDITIONAL_MESH_TRAVERSAL)
45 #include "observers/AdditionalMeshTraversal.h"
46#endif
48
49using namespace applications::exahype2::ccz4;
50
52
53
58
59
69 static bool gridConstructed = false;
70 static bool gridInitialised = false;
71 static bool gridBalanced = false;
72 static double nextMaxPlotTimeStamp = FirstPlotTimeStamp;
73 static double nextMinPlotTimeStamp = FirstPlotTimeStamp;
74 static double nextMaxCheckpointTimeStamp = FirstCheckpointTimeStamp;
75 static double nextMinCheckpointTimeStamp = FirstCheckpointTimeStamp;
76 static bool haveJustWrittenSnapshot = false;
77 static bool haveReceivedNoncriticialAssertion = false;
78 static bool addGridSweepWithoutGridRefinementNext = false;
80 std::numeric_limits<double>::max()
81 );
82 static int globalNumberOfTrees = 0;
83 bool continueToSolve = true;
84
85 if (tarch::hasNonCriticalAssertionBeenViolated() and not haveReceivedNoncriticialAssertion) {
87 repositories::StepRepository::toProgramStep(repositories::StepRepository::Steps::PlotSolution)
88 );
89 haveReceivedNoncriticialAssertion = true;
91 "selectNextAlgorithmicStep()", "non-critical assertion has been triggered in code. Dump final state and terminate"
92 );
94 continueToSolve = false;
95 } else if (gridConstructed and not gridBalanced) {
96 if (not repositories::loadBalancer.isEnabled(true) and not repositories::loadBalancer.hasSplitRecently()) {
97 logInfo("selectNextAlgorithmicStep()", "all ranks have switched off their load balancing");
98 gridBalanced = true;
99 } else {
100 logInfo(
101 "selectNextAlgorithmicStep()", "wait for load balancing to become stable: " << repositories::loadBalancer
102 );
103 }
104
105 peano4::parallel::Node::getInstance().setNextProgramStep(repositories::StepRepository::toProgramStep(
106 repositories::StepRepository::Steps::CreateGridAndConvergeLoadBalancing
107 ));
108 } else if (gridBalanced and not gridInitialised) {
110 repositories::StepRepository::toProgramStep(repositories::StepRepository::Steps::InitGrid)
111 );
112
113 gridInitialised = true;
114 } else if (not gridConstructed) {
115 if (tarch::la::max(peano4::parallel::SpacetreeSet::getInstance().getGridStatistics().getMinH()) < tarch::la::max(minH)) {
117 logDebug(
118 "selectNextAlgorithmicStep()", "mesh has refined, so reset minH=" << minH << " and postpone further refinement"
119 );
120 addGridSweepWithoutGridRefinementNext = true;
121 } else if (repositories::loadBalancer.getGlobalNumberOfTrees() > globalNumberOfTrees) {
122 logInfo("selectNextAlgorithmicStep()", "mesh has rebalanced recently, so postpone further refinement)");
123 addGridSweepWithoutGridRefinementNext = true;
124 globalNumberOfTrees = repositories::loadBalancer.getGlobalNumberOfTrees();
125 }
126 else if (
127 peano4::parallel::SpacetreeSet::getInstance().getGridStatistics().getStationarySweeps()>5
128 and
129 // ensure that a proper creation has been ran before, so the mesh had the opportunity
130 // to refine further if it has not done yet
131 repositories::StepRepository::toStepEnum( peano4::parallel::Node::getInstance().getCurrentProgramStep() ) == repositories::StepRepository::Steps::CreateGrid
132 ) {
133 logInfo(
134 "selectNextAlgorithmicStep()", "grid has been stationary for quite some time. Terminate grid construction"
135 );
136 addGridSweepWithoutGridRefinementNext = false;
137 gridConstructed = true;
138 } else {
139 logInfo(
140 "selectNextAlgorithmicStep()",
141 "mesh rebalancing seems to be stationary, so study whether to refine mesh further in next sweep: "
143 );
144 addGridSweepWithoutGridRefinementNext = false;
145 globalNumberOfTrees = repositories::loadBalancer.getGlobalNumberOfTrees();
146 }
147
148 // Actual grid traversal choice
149 if (addGridSweepWithoutGridRefinementNext) {
150 peano4::parallel::Node::getInstance().setNextProgramStep(repositories::StepRepository::toProgramStep(
151 repositories::StepRepository::Steps::CreateGridButPostponeRefinement
152 ));
153 } else {
155 repositories::StepRepository::toProgramStep(repositories::StepRepository::Steps::CreateGrid)
156 );
157 }
158
159 continueToSolve = true;
160 } else {
161 if (TimeInBetweenPlots > 0.0 and repositories::getMinTimeStamp() < MinTerminalTime and repositories::getMaxTimeStamp() < MaxTerminalTime and (repositories::getMinTimeStamp() >= nextMinPlotTimeStamp or repositories::getMaxTimeStamp() >= nextMaxPlotTimeStamp) and repositories::mayPlot()) {
162 if (repositories::getMinTimeStamp() >= nextMinPlotTimeStamp) {
163 nextMinPlotTimeStamp += TimeInBetweenPlots;
164 }
165 if (repositories::getMaxTimeStamp() >= nextMaxPlotTimeStamp) {
166 nextMaxPlotTimeStamp += TimeInBetweenPlots;
167 }
168
169 if (nextMinPlotTimeStamp < repositories::getMinTimeStamp()) {
171 "selectNextAlgorithmicStep()",
172 "code is asked to plot every dt="
173 << TimeInBetweenPlots << ", but this seems to be less than the time step size of the solvers. "
174 << "So postpone next plot to t=" << (repositories::getMinTimeStamp() + TimeInBetweenPlots)
175 );
176 nextMinPlotTimeStamp = repositories::getMinTimeStamp() + TimeInBetweenPlots;
177 } else if (nextMaxPlotTimeStamp < repositories::getMaxTimeStamp()) {
179 "selectNextAlgorithmicStep()",
180 "code is asked to plot every dt="
181 << TimeInBetweenPlots << ", but this seems to be less than the time step size of the solvers. "
182 << "So postpone next plot to t=" << (repositories::getMaxTimeStamp() + TimeInBetweenPlots)
183 );
184 nextMaxPlotTimeStamp = repositories::getMaxTimeStamp() + TimeInBetweenPlots;
185 }
186
187 nextMaxPlotTimeStamp = std::max(nextMaxPlotTimeStamp, nextMinPlotTimeStamp);
188
190 repositories::StepRepository::toProgramStep(repositories::StepRepository::Steps::PlotSolution)
191 );
192 haveJustWrittenSnapshot = true;
193 continueToSolve = true;
194 } else if (TimeInBetweenCheckpoints > 0.0 and repositories::getMinTimeStamp() < MinTerminalTime and repositories::getMaxTimeStamp() < MaxTerminalTime and (repositories::getMinTimeStamp() >= nextMinCheckpointTimeStamp or repositories::getMaxTimeStamp() >= nextMaxCheckpointTimeStamp) and repositories::mayPlot()) {
195 if (repositories::getMinTimeStamp() >= nextMinCheckpointTimeStamp) {
196 nextMinCheckpointTimeStamp += TimeInBetweenCheckpoints;
197 }
198 if (repositories::getMaxTimeStamp() >= nextMaxCheckpointTimeStamp) {
199 nextMaxCheckpointTimeStamp += TimeInBetweenCheckpoints;
200 }
201
202 if (nextMinCheckpointTimeStamp < repositories::getMinTimeStamp()) {
204 "selectNextAlgorithmicStep()",
205 "code is asked to Checkpoint every dt="
206 << TimeInBetweenCheckpoints << ", but this seems to be less than the time step size of the solvers. "
207 << "So postpone next Checkpoint to t=" << (repositories::getMinTimeStamp() + TimeInBetweenCheckpoints)
208 );
209 nextMinCheckpointTimeStamp = repositories::getMinTimeStamp() + TimeInBetweenCheckpoints;
210 } else if (nextMaxCheckpointTimeStamp < repositories::getMaxTimeStamp()) {
212 "selectNextAlgorithmicStep()",
213 "code is asked to Checkpoint every dt="
214 << TimeInBetweenCheckpoints << ", but this seems to be less than the time step size of the solvers. "
215 << "So postpone next Checkpoint to t=" << (repositories::getMaxTimeStamp() + TimeInBetweenCheckpoints)
216 );
217 nextMaxCheckpointTimeStamp = repositories::getMaxTimeStamp() + TimeInBetweenCheckpoints;
218 }
219
220 nextMaxCheckpointTimeStamp = std::max(nextMaxCheckpointTimeStamp, nextMinCheckpointTimeStamp);
221
223 repositories::StepRepository::toProgramStep(repositories::StepRepository::Steps::CheckpointSolution)
224 );
225 haveJustWrittenSnapshot = true;
226 continueToSolve = true;
227 } else if (repositories::getMinTimeStamp() < MinTerminalTime and repositories::getMaxTimeStamp() < MaxTerminalTime) {
229 repositories::StepRepository::toProgramStep(repositories::StepRepository::Steps::TimeStep)
230 );
231 continueToSolve = true;
232 haveJustWrittenSnapshot = false;
233 } else {
234 if (not haveJustWrittenSnapshot and TimeInBetweenPlots > 0.0 and repositories::mayPlot()) {
236 repositories::StepRepository::toProgramStep(repositories::StepRepository::Steps::PlotSolution)
237 );
238 continueToSolve = true; // don't want to terminate immediately
239 haveJustWrittenSnapshot = true;
240 nextMinPlotTimeStamp = std::numeric_limits<double>::max();
241 nextMaxPlotTimeStamp = std::numeric_limits<double>::max();
242 } else if (not haveJustWrittenSnapshot and TimeInBetweenPlots > 0.0 and not repositories::mayPlot()) {
243 continueToSolve = true; // don't want to terminate immediately but to wait for incomplete time steps to complete
244 } else {
245 continueToSolve = false;
246 }
247 }
248 }
249
250 return continueToSolve;
251}
252
253
254void step() {
256 auto stepName = repositories::StepRepository::toStepEnum(stepIdentifier);
257
258 static tarch::logging::Log _log("");
259#if PeanoDebug > 0
260#else
261 if (tarch::mpi::Rank::getInstance().isGlobalMaster())
262#endif
263 logInfo("step()", "Starting AlgorithmicStep [" << repositories::StepRepository::toString(stepName)<<"]" );
264
265 static tarch::timing::Watch watch("::", "step()", false);
266
267 static int creepingNumberOfLocalCells = 0;
268
269 switch (stepName) {
270 case repositories::StepRepository::Steps::CreateGridButPostponeRefinement: {
271 tarch::logging::LogFilter::getInstance().switchProgramPhase("create-grid-but-postpone-refinement");
272
274
275 repositories::startGridConstructionStep();
276
277 OTTER_DEFINE_TASK(step_task, OTTER_NULL_TASK, otter_no_add_to_pool, otter::label::step);
278 OTTER_TASK_START(step_task);
279
280 observers::CreateGridButPostponeRefinement observer;
281 watch.start();
283 watch.stop();
285
286 OTTER_TASK_WAIT_IMPLICIT(children);
287 OTTER_TASK_END(step_task);
288 OTTER_TASK_WAIT_IMPLICIT(descendants);
289
290 repositories::finishGridConstructionStep();
291 } break;
292 case repositories::StepRepository::Steps::CreateGrid: {
294
296
297 repositories::startGridConstructionStep();
298
299 OTTER_DEFINE_TASK(step_task, OTTER_NULL_TASK, otter_no_add_to_pool, otter::label::step);
300 OTTER_TASK_START(step_task);
301
302 observers::CreateGrid observer;
303 watch.start();
305 watch.stop();
307
308 OTTER_TASK_WAIT_IMPLICIT(children);
309 OTTER_TASK_END(step_task);
310 OTTER_TASK_WAIT_IMPLICIT(descendants);
311
312 repositories::finishGridConstructionStep();
313
314 // We always overestimate so give the convergence the opportunity to catch up. The constant
315 // here is a magic one.
318 } break;
319 case repositories::StepRepository::Steps::CreateGridAndConvergeLoadBalancing: {
320 if (creepingNumberOfLocalCells < ::toolbox::loadbalancing::getWeightOfHeaviestLocalSpacetree() - 1) {
321 logInfo(
322 "step()",
323 "it seems the grid has just refined before we switched to the phase where we make the load balancing converge. Wait for a few iterations more to give load balancing chance to catch up"
324 );
327 }
328
329 tarch::logging::LogFilter::getInstance().switchProgramPhase("create-grid-and-converge-load-balancing");
330
332
333 // The smaller here corresponds to the -1 below
334 if (::toolbox::loadbalancing::getWeightOfHeaviestLocalSpacetree() < 0 and repositories::loadBalancer.isEnabled(false)) {
335 logInfo("step()", "rank is degenerated so disable load balancing temporarily");
336 repositories::loadBalancer.enable(false);
337 }
338 if (
340 and
341 repositories::loadBalancer.isEnabled(false)
342 ) {
343 logInfo(
344 "step()",
345 "grid construction and decomposition on this rank seem to be stable as we have around "
346 << creepingNumberOfLocalCells << " local cells in the heaviest tree. Disable load balancing temporarily"
347 );
348 repositories::loadBalancer.enable(false);
349 }
350
351 repositories::startGridConstructionStep();
352
353 OTTER_DEFINE_TASK(step_task, OTTER_NULL_TASK, otter_no_add_to_pool, otter::label::step);
354 OTTER_TASK_START(step_task);
355
356 observers::CreateGridButPostponeRefinement observer;
357 watch.start();
359 watch.stop();
361
362 OTTER_TASK_WAIT_IMPLICIT(children);
363 OTTER_TASK_END(step_task);
364 OTTER_TASK_WAIT_IMPLICIT(descendants);
365
366 repositories::finishGridConstructionStep();
367
368 if (
370 and
371 not repositories::loadBalancer.hasSplitRecently()
372 and
373 repositories::loadBalancer.isEnabled(false)
374 ) {
375 logInfo(
376 "step()",
377 "have to decrement local cell counter "
378 << creepingNumberOfLocalCells << " as maximum weight is "
380 );
381 creepingNumberOfLocalCells = (creepingNumberOfLocalCells
383 / 2;
384 }
385 } break;
386 case repositories::StepRepository::Steps::InitGrid: {
388 repositories::loadBalancer.enable(false);
389
391
392 repositories::startGridInitialisationStep();
393
394 OTTER_DEFINE_TASK(step_task, OTTER_NULL_TASK, otter_no_add_to_pool, otter::label::step);
395 OTTER_TASK_START(step_task);
396
397 observers::InitGrid observer;
398 observers::InitGrid::prepareTraversal();
399 watch.start();
401 watch.stop();
402 observers::InitGrid::unprepareTraversal();
404
405 OTTER_TASK_WAIT_IMPLICIT(children);
406 OTTER_TASK_END(step_task);
407 OTTER_TASK_WAIT_IMPLICIT(descendants);
408
409 repositories::finishGridInitialisationStep();
410 } break;
411 case repositories::StepRepository::Steps::PlotSolution: {
413 const double minTimeStamp = repositories::getMinTimeStamp();
414 const double maxTimeStamp = repositories::getMaxTimeStamp();
415 const double minTimeStepSize = repositories::getMinTimeStepSize();
416 const double maxTimeStepSize = repositories::getMaxTimeStepSize();
417
419
420 repositories::startPlottingStep(minTimeStamp, maxTimeStamp, minTimeStepSize, maxTimeStepSize);
421
422 OTTER_DEFINE_TASK(step_task, OTTER_NULL_TASK, otter_no_add_to_pool, otter::label::step);
423 OTTER_TASK_START(step_task);
424
425 observers::PlotSolution observer;
426 observers::PlotSolution::prepareTraversal();
427 watch.start();
429 watch.stop();
430 observers::PlotSolution::unprepareTraversal();
432
433 OTTER_TASK_WAIT_IMPLICIT(children);
434 OTTER_TASK_END(step_task);
435 OTTER_TASK_WAIT_IMPLICIT(descendants);
436
437 repositories::finishPlottingStep();
438 } break;
439 case repositories::StepRepository::Steps::CheckpointSolution: {
441 const double minTimeStamp = repositories::getMinTimeStamp();
442 const double maxTimeStamp = repositories::getMaxTimeStamp();
443 const double minTimeStepSize = repositories::getMinTimeStepSize();
444 const double maxTimeStepSize = repositories::getMaxTimeStepSize();
445
447
448 repositories::startPlottingStep(minTimeStamp, maxTimeStamp, minTimeStepSize, maxTimeStepSize);
449
450 OTTER_DEFINE_TASK(step_task, OTTER_NULL_TASK, otter_no_add_to_pool, otter::label::step);
451 OTTER_TASK_START(step_task);
452
453 observers::CheckpointSolution observer;
454 observers::CheckpointSolution::prepareTraversal();
455 watch.start();
457 watch.stop();
458 observers::CheckpointSolution::unprepareTraversal();
460
461 OTTER_TASK_WAIT_IMPLICIT(children);
462 OTTER_TASK_END(step_task);
463 OTTER_TASK_WAIT_IMPLICIT(descendants);
464
465 repositories::finishPlottingStep();
466 } break;
467 case repositories::StepRepository::Steps::TimeStep: {
469 if (repositories::loadBalancer.isEnabled(false)) {
470 logInfo("step()", "disable load balancing throughout initialisation (to be removed in later releases)");
471 repositories::loadBalancer.enable(false);
472 }
473
474 const double minTimeStamp = repositories::getMinTimeStamp();
475 const double maxTimeStamp = repositories::getMaxTimeStamp();
476 const double minTimeStepSize = repositories::getMinTimeStepSize();
477 const double maxTimeStepSize = repositories::getMaxTimeStepSize();
478 const double minMeshSize = repositories::getMinMeshSize();
479 const double maxMeshSize = repositories::getMaxMeshSize();
480
481
483
484 repositories::startTimeStep(minTimeStamp, maxTimeStamp, minTimeStepSize, maxTimeStepSize);
485
486 OTTER_DEFINE_TASK(step_task, OTTER_NULL_TASK, otter_no_add_to_pool, otter::label::step);
487 OTTER_TASK_START(step_task);
488
489 observers::TimeStep observer;
490 observers::TimeStep::prepareTraversal();
491 watch.start();
493 watch.stop();
494 observers::TimeStep::unprepareTraversal();
496
497 OTTER_TASK_WAIT_IMPLICIT(children);
498 OTTER_TASK_END(step_task);
499 OTTER_TASK_WAIT_IMPLICIT(descendants);
500
501 repositories::finishTimeStep();
502 } break;
504 #if defined(USE_ADDITIONAL_MESH_TRAVERSAL)
505 case repositories::StepRepository::Steps::AdditionalMeshTraversal:
506 {
507 tarch::logging::LogFilter::getInstance().switchProgramPhase( "additional-MeshTraversal" );
508
509 repositories::suspendSolversForOneGridSweep();
510 observers::AdditionalMeshTraversal observer;
511 observers::AdditionalMeshTraversal::prepareTraversal();
513 observers::AdditionalMeshTraversal::unprepareTraversal();
514 }
515 break;
516 #endif
518 case repositories::StepRepository::Steps::Undef:
519 assertion(false);
520 break;
521 }
522
523#if PeanoDebug > 0
524#else
525 if (tarch::mpi::Rank::getInstance().isGlobalMaster())
526#endif
527 logInfo("step()", "Finishing [" << repositories::StepRepository::toString(stepName) << "] Current SolverState [" << AbstractCCZ4::toString(repositories::instanceOfCCZ4.getSolverState())<<"]" );
528}
529
530int main(int argc, char** argv) {
531 constexpr int ExitCodeSuccess = 0;
532 constexpr int ExitCodeUnitTestsFailed = 1;
533 constexpr int ExitCodeInvalidArguments = 2;
534 constexpr int ExitCodeInvalidBuild = 3;
535
536 static tarch::timing::Watch watch("::", "main()", false);
537
539
540 // Do this early, so people can use logInfo properly.
541 repositories::initLogFilters();
542
546
547 peano4::initSingletons(DomainOffset, DomainSize, PeriodicBC);
548
549 repositories::initSharedMemoryAndGPUEnvironment();
550
551 if (tarch::mpi::Rank::getInstance().getNumberOfRanks() > 1 and tarch::multicore::Core::getInstance().getNumberOfThreads() <= 1) {
552 logError("main()", "MPI runs without multithreading are not supported currently.");
553 return ExitCodeInvalidBuild;
554 }
555
556 repositories::DataRepository::initDatatypes();
557
558 #if PeanoDebug >= 2
560 unitTests->addTestCase(peano4::getUnitTests());
561 unitTests->addTestCase(tarch::getUnitTests());
564 unitTests->run();
565 if (unitTests->getNumberOfErrors() != 0) {
566 logError("main()", "unit tests failed. Quit.");
567 tarch::mpi::Rank::abort(ExitCodeUnitTestsFailed);
568 }
569 delete unitTests;
570#endif
571
572 repositories::startSimulation();
573
575
577
578#if defined(SharedOMP)
579#pragma omp parallel
580 {
581#pragma omp master
582 {
583#endif
584
585#if defined(UseSmartMPI)
586 const bool isGlobalMaster = tarch::mpi::Rank::getInstance().isGlobalMaster() and smartmpi::isComputeRank();
587 const bool isPeanoComputeNode = not tarch::mpi::Rank::getInstance().isGlobalMaster() and smartmpi::isComputeRank();
588#else
589 const bool isGlobalMaster = tarch::mpi::Rank::getInstance().isGlobalMaster();
590 const bool isPeanoComputeNode = not tarch::mpi::Rank::getInstance().isGlobalMaster();
591#endif
592
593 if (isGlobalMaster) {
594 while (selectNextAlgorithmicStep()) {
595 watch.start();
596 step();
597 watch.stop();
598
600 logInfo("main()", "time per mesh sweep (current/average): " << std::fixed << std::setprecision(2) << watch.getCalendarTime() << " / " << timePerMeshSweepMeasurement.getValue() );
601 }
602
603 logInfo("main()", "terminated successfully");
604 logInfo(
605 "main()",
606 "initial grid construction: " << gridConstructionMeasurement.getAccumulatedValue(
608 );
609 logInfo(
610 "main()",
611 "plotting: " << plotMeasurement.getAccumulatedValue() << "s\t" << plotMeasurement.toString()
612 );
613 logInfo(
614 "main()",
615 "time stepping: " << timeStepMeasurement.getAccumulatedValue(
616 ) << "s\t" << timeStepMeasurement.toString()
617 );
618 logInfo(
619 "main()",
620 "average time per mesh sweep: " << timePerMeshSweepMeasurement.getValue() << "\t" << timePerMeshSweepMeasurement.toString()
621 );
622 } else if (isPeanoComputeNode) {
623 while (peano4::parallel::Node::getInstance().continueToRun()) {
624 step();
625 }
626 }
627#if defined(UseSmartMPI)
628 else {
629 while (smartmpi::continueToRun()) {
630 smartmpi::tick();
631 }
632 }
633#endif
634
635#if defined(SharedOMP)
636 }
637 }
638#endif
639
641
643
644 repositories::finishSimulation();
645
647 repositories::DataRepository::shutdownDatatypes();
651
652 return ExitCodeSuccess;
653}
#define assertion(expr)
#define logError(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
Definition Log.h:464
#define logDebug(methodName, logMacroMessageStream)
Definition Log.h:50
#define logWarning(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
Definition Log.h:440
#define logInfo(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
Definition Log.h:411
tarch::timing::Measurement gridConstructionMeasurement
Definition ccz4-main.cpp:55
tarch::timing::Measurement timePerMeshSweepMeasurement
Definition ccz4-main.cpp:54
tarch::logging::Log _log("::")
tarch::timing::Measurement timeStepMeasurement
Definition ccz4-main.cpp:56
bool selectNextAlgorithmicStep()
Decide which step to run next.
Definition ccz4-main.cpp:68
tarch::timing::Measurement plotMeasurement
Definition ccz4-main.cpp:57
void step()
int main()
Definition main.cpp:321
int getCurrentProgramStep() const
Definition Node.cpp:447
void setNextProgramStep(int number)
The user tells the set which program step to use, i.e.
Definition Node.cpp:441
static Node & getInstance()
This operation returns the singleton instance.
Definition Node.cpp:108
peano4::grid::GridStatistics getGridStatistics() const
Return statistics object for primary spacetree.
static SpacetreeSet & getInstance()
void traverse(peano4::grid::TraversalObserver &observer)
Invoke traverse on all spacetrees in parallel.
void switchProgramPhase(const std::string &activeProgramPhase)
static LogFilter & getInstance()
Log Device.
Definition Log.h:516
void writeToCSV(std::string filename="statistics")
Write data to csv file.
static Statistics & getInstance()
This is not the canonical realisation of singletons as I use it usually for stats in Peano.
bool isGlobalMaster() const
Is this node the global master process, i.e.
Definition Rank.cpp:420
static Rank & getInstance()
This operation returns the singleton instance.
Definition Rank.cpp:539
static void abort(int errorCode)
A proper abort in an MPI context has to use MPI_Abort.
Definition Rank.cpp:592
static Core & getInstance()
Definition Core.cpp:57
int getNumberOfThreads() const
Returns the number of threads that is used.
Definition Core.cpp:68
int getNumberOfErrors() const
Definition TestCase.cpp:11
void addTestCase(const std::string &fullQualifiedPath, TestCase *testCase)
Adds a new test case.
virtual void run()
Runs all test cases assigned.
double getAccumulatedValue() const
std::string toString() const
void setValue(const double &value)
Set the value.
A simple class that has to be included to measure the clock ticks required for an operation.
Definition Watch.h:45
double getCalendarTime()
This method returns the elapsed calendar time between the start and stop command of the timer,...
Definition Watch.cpp:74
void stop()
Stop timer.
Definition Watch.cpp:55
void start()
(Re)Start the Timer
Definition Watch.cpp:48
std::string toString(Filter filter)
Definition convert.cpp:170
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:18
static const char * step
Definition otter.h:106
static const char * create_grid
Definition otter.h:113
static const char * init
Definition otter.h:110
static const char * plot
Definition otter.h:111
static const char * timestep
Definition otter.h:112
static const char * create_grid_converge
Definition otter.h:115
static const char * create_grid_no_refine
Definition otter.h:114
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:12
void shutdownSingletons()
The very first thing I have to do is to shut down Node.
Definition peano.cpp:150
void fillLookupTables()
Fill Lookup Tables.
Definition peano.cpp:87
int initParallelEnvironment(int *argc, char ***argv)
Init Parallel Environment.
Definition peano.cpp:101
void initSingletons(const tarch::la::Vector< Dimensions, double > &offset, const tarch::la::Vector< Dimensions, double > &width, const std::bitset< Dimensions > &periodicBC=0)
Fire up all the singletons.
Definition peano.cpp:133
void shutdownParallelEnvironment()
Shutdown all the parallel environment, i.e.
Definition peano.cpp:127
double max(double a, double b, double c)
I need the maximum of three values all the time, to I decided to write a function for this.
Definition Scalar.cpp:8
void shutdownSmartMPI()
Definition multicore.cpp:49
void initSmartMPI()
Switch on SmartMPI.
Definition multicore.cpp:33
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:17
bool hasNonCriticalAssertionBeenViolated()
void shutdownNonCriticalAssertionEnvironment()
peano4::shutdownParallelEnvironment().
void initNonCriticalAssertionEnvironment()
Register the assertion tag from the global communicator.
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
Definition UnitTests.cpp:11
int getWeightOfHeaviestLocalSpacetree()
This is a helper routine which is used by ExaHyPE's default main for for example.
#define OTTER_TASK_WAIT_IMPLICIT(...)
Definition otter.h:141
#define OTTER_FINALISE()
Definition otter.h:125
#define OTTER_TASK_END(...)
Definition otter.h:136
#define OTTER_INITIALISE()
Definition otter.h:124
#define OTTER_PHASE_SWITCH(...)
Definition otter.h:144
#define OTTER_TASK_START(...)
Definition otter.h:135
#define OTTER_DEFINE_TASK(...)
Definition otter.h:128
tarch::la::Vector< Dimensions, double > getMinH() const
Simple vector class.
Definition Vector.h:150