Peano 4
Loading...
Searching...
No Matches
peano.cpp
Go to the documentation of this file.
1#include "peano.h"
2#include "../config.h"
3
4#include "peano4/utils/Loop.h"
6
10#include "tarch/mpi/Rank.h"
12#include "tarch/tarch.h"
14
17
18#include <list>
19#include <fstream>
20
25#ifdef CompilerHasUTSName
26#include <sys/utsname.h>
27#endif
28
30 static bool wrote = false;
31 if (
33 std::cout << "Peano 4 (C) www.peano-framework.org" << std::endl;
34 std::string buildInfo = "build: ";
35
36 buildInfo += std::to_string(Dimensions);
37 buildInfo += "d";
38
39 #ifdef Parallel
40 buildInfo += ", with mpi (";
41 buildInfo += std::to_string( tarch::mpi::Rank::getInstance().getNumberOfRanks() );
42 buildInfo += " ranks)";
43 #else
44 buildInfo += ", no mpi";
45 #endif
46
47 #if defined(SharedOMP)
48 buildInfo += ", omp";
49 #elif defined(SharedTBB)
50 buildInfo += ", tbb";
51 #elif defined(SharedSYCL)
52 buildInfo += ", sycl threading";
53 #elif defined(SharedCPP)
54 buildInfo += ", C++ threading";
55 #else
56 buildInfo += ", no threading";
57 #endif
58
59 if (tarch::multicore::Core::getInstance().getNumberOfThreads()>1) {
60 buildInfo += " (";
61 buildInfo += std::to_string( tarch::multicore::Core::getInstance().getNumberOfThreads() );
62 buildInfo += " threads)";
63 }
64
65 #if defined(GPUOffloadingOMP)
66 buildInfo += ", omp offloading";
67 #elif defined(GPUOffloadingSYCL)
68 buildInfo += ", sycl";
69 #elif defined(GPUOffloadingCPP)
70 buildInfo += ", C++ offloading";
71 #elif defined(GPUOffloadingCUDA)
72 buildInfo += ", CUDA offloading";
73 #else
74 buildInfo += ", no gpu support";
75 #endif
76
77 if (tarch::accelerator::Device::getInstance().getNumberOfDevices()>0) {
78 buildInfo += " (";
79 buildInfo += std::to_string( tarch::accelerator::Device::getInstance().getNumberOfDevices() );
80 buildInfo += " gpus)";
81 }
82
83 #if PeanoDebug>0
84 buildInfo += ", debug level=" + std::to_string(PeanoDebug);
85 #endif
86
87 std::cout << buildInfo << std::endl;
88 }
89 wrote = true;
90}
91
93/*
94 Had in in Globals.cpp
95
96 setupLookupTableForTwoPowI();
97 setupLookupTableForThreePowI();
98 setupLookupTableForFourPowI();
99 setupLookupTableForDPowI();
100*/
101
104}
105
106int peano4::initParallelEnvironment([[maybe_unused]] int* argc, [[maybe_unused]] char*** argv) {
107 int result = 0;
108 #ifdef Parallel
109 if ( tarch::mpi::Rank::getInstance().init(argc, argv) ) {
111
112 clock_t timeout = 60;
115 } else {
116 result = -2;
117 }
118 #endif
119
120 #ifdef SharedMemoryParallelisation
121 if ( tarch::multicore::Core::getInstance().isInitialised() ) {
122 } else {
123 result = -3;
124 }
125 #endif
126
128
129 return result;
130}
131
137
154
161
162
std::bitset< Dimensions > periodicBC
Definition main.cpp:19
static void shutdownMPIDatatypes()
Definition Node.cpp:44
void shutdown()
The shutdown is invoked by peano4::shutdownSingletons()
Definition Node.cpp:452
static void initMPIDatatypes()
I originally wanted to embed these guys into the singleton's constructor.
Definition Node.cpp:27
static Node & getInstance()
This operation returns the singleton instance.
Definition Node.cpp:108
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()
virtual void shutdown() override
static Device & getInstance()
static BooleanSemaphoreService & getInstance()
Don't use this routine.
void setDeadlockTimeOut(int valueInSeconds)
Set deadlock time out.
Definition Rank.cpp:565
static int getGlobalMasterRank()
Get the global master.
Definition Rank.cpp:414
static Rank & getInstance()
This operation returns the singleton instance.
Definition Rank.cpp:538
void setTimeOutWarning(int valueInSeconds)
Set time out warning.
Definition Rank.cpp:559
void shutdown()
Shuts down the application.
Definition Rank.cpp:390
static Core & getInstance()
Definition Core.cpp:55
void shutdown()
Shutdown parallel environment.
Definition Core.cpp:62
static ServiceRepository & getInstance()
void init()
Maybe the only service that you don't have to init and shutdown.
void setupLookupTableForDLinearised()
Definition Loop.cpp:68
void setupLookupTableForDDelinearised()
Definition Loop.cpp:79
void shutdownSingletons()
The very first thing I have to do is to shut down Node.
Definition peano.cpp:155
void writeCopyrightMessage()
You can invoke this operation manually, but it will also implicitly be triggered by the init routines...
Definition peano.cpp:29
void fillLookupTables()
Fill Lookup Tables.
Definition peano.cpp:92
void runTestsAndBenchmarks()
Runs GPU Offloading tests, GPU Bandwidth benchmarks and prints the benchmark results.
Definition peano.cpp:163
int initParallelEnvironment(int *argc, char ***argv)
Init Parallel Environment.
Definition peano.cpp:106
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:138
void shutdownParallelEnvironment()
Shutdown all the parallel environment, i.e.
Definition peano.cpp:132
void printDeviceInformation()
Prints device information based on the available accelerator backend.
void offloadCapabilityTest()
Performs offload capability tests for the available GPU accelerator backend.
Simple vector class.
Definition Vector.h:134