24 int unitTestsErrors = 0;
29 unitTestsErrors +=
tests->getNumberOfErrors();
34 unitTestsErrors +=
tests->getNumberOfErrors();
37 if (unitTestsErrors != 0) {
38 logError(
"main()",
"unit tests failed. Quit.");
65 logInfo(
"runParallel(...)",
"create initial grid (step #1)" );
66 int numberOfGridConstructionSteps = 0;
71 numberOfGridConstructionSteps<20
75 numberOfGridConstructionSteps++;
88 logInfo(
"runParallel(...)",
"trigger split of initial grid among ranks with " << numberOfCellsPerRank <<
" cells per rank" );
91 logWarning(
"runParallel(...)",
"failed to assign rank " << rank <<
" " << numberOfCellsPerRank <<
" cell(s)" );
95 const int MaxNumberOfConstructionSteps =
static_cast<int>(std::round( std::log(1.0 / h)/std::log(3.0)+1 )) - 1;
96 assertion1(MaxNumberOfConstructionSteps>=0, MaxNumberOfConstructionSteps);
97 logInfo(
"runParallel(...)",
"commit split and give ranks " << MaxNumberOfConstructionSteps <<
" iterations to 'recover' (step #2)" );
98 for (
int i=0; i<MaxNumberOfConstructionSteps; i++) {
104 logInfo(
"runParallel(...)",
"trigger split of master rank into threads with " << numberOfCellsPerThread <<
" cells per thread (total: " <<
peano4::parallel::SpacetreeSet::getInstance().getGridStatistics().getNumberOfLocalUnrefinedCells() <<
")");
105 for (
int thread=1; thread<numberOfThreads; thread++) {
107 logWarning(
"runParallel(...)",
"failed to assign thread " << thread <<
" " << numberOfCellsPerThread <<
" cell(s)" );
111 logInfo(
"runParallel(...)",
"run one step committing split and telling other ranks to split as well (step #3)" );
115 logInfo(
"runParallel(...)",
"commit splits into threads and give ranks time to 'recover' (step #4)" );
116 for (
int i=0; i<3; i++) {
121 logInfo(
"runParallel(...)",
"start parallel traversals (step #5)" );
125 const int Iterations=2;
127 const int Iterations=20;
130 for (
int i=0; i<Iterations; i++) {
134 logInfo(
"runParallel(...)",
"terminated successfully" );
153 logInfo(
"runParallel(...)",
"trigger split of master rank into threads with " << numberOfCellsPerThread <<
" cells per thread");
154 for (
int thread=1; thread<numberOfThreads; thread++) {
156 logWarning(
"runParallel(...)",
"failed to assign thread " << thread <<
" " << numberOfCellsPerThread <<
" cell(s)" );
167int main(
int argc,
char** argv) {
168 const int ExitCodeSuccess = 0;
169 const int ExitCodeUnitTestsFailed = 1;
198 if (argc<3 or argc>6) {
199 logError(
"main(...)",
"Usage: ./executable mesh-width flops-per-cell [core-count] [spawn-frequency] [integration-points]");
203 double meshWidth = std::atof( argv[1] );
204 int flopsPerCell = std::atoi( argv[2] );
206 logError(
"main(...)",
"Usage: ./executable mesh-width");
207 logError(
"main(...)",
" mesh-width has to be a positive value");
210 if (meshWidth>=1.0) {
211 logError(
"main(...)",
"Usage: ./executable mesh-width");
212 logError(
"main(...)",
" mesh-width has to be smaller than one");
217 int cores = std::atoi( argv[3] );
230 logInfo(
"main(...)",
"run on " << numberOfRanks <<
" ranks with " << numberOfCores <<
" thread(s) each" );
#define assertionEquals(lhs, rhs)
#define assertion1(expr, param)
#define logError(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
#define logDebug(methodName, logMacroMessageStream)
#define logTraceOut(methodName)
#define logWarning(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
#define logTraceInWith1Argument(methodName, argument0)
#define logInfo(methodName, logMacroMessageStream)
Wrapper macro around tarch::tarch::logging::Log to improve logging.
tarch::logging::Log _log("examples::grid")
static double FractionOfCellsYieldingIntegrationTask
static int IntegrationAccuracy
static constexpr int RanksObserverTemplate
void setNextProgramStep(int number)
The user tells the set which program step to use, i.e.
static Node & getInstance()
This operation returns the singleton instance.
bool split(int treeId, const peano4::SplitInstruction &instruction, int targetRank)
Split a local tree.
peano4::grid::GridStatistics getGridStatistics() const
Return statistics object for primary spacetree.
void init(const tarch::la::Vector< Dimensions, double > &offset, const tarch::la::Vector< Dimensions, double > &width, const std::bitset< Dimensions > &periodicBC=0)
static SpacetreeSet & getInstance()
std::set< int > getLocalSpacetrees() const
void traverse(peano4::grid::TraversalObserver &observer)
Invoke traverse on all spacetrees in parallel.
void setOutputFile(const std::string &outputLogFileName)
Is redundant, as you could use setLogFormat() instead.
static ChromeTraceFileLogger & getInstance()
void addFilterListEntry(const FilterListEntry &entry)
Add one filter list entry.
static LogFilter & getInstance()
int getNumberOfRanks() const
static Rank & getInstance()
This operation returns the singleton instance.
static Core & getInstance()
int getNumberOfThreads() const
Returns the number of threads that is used.
void configure(int numberOfThreads=UseDefaultNumberOfThreads)
Configure the whole node, i.e.
Represents one test case.
std::string toString(Filter filter)
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
void fillLookupTables()
Fill Lookup Tables.
int initParallelEnvironment(int *argc, char ***argv)
Init Parallel Environment.
void shutdownParallelEnvironment()
Shutdown all the parallel environment, i.e.
tarch::tests::TestCase * getUnitTests()
Please destroy after usage.
int getNumberOfLocalUnrefinedCells() const
Represents one entry of the filter list.
static const std::string TargetTrace
static const std::string TargetDebug
static const std::string TargetInfo