56 {
57
58
59#ifdef _OPENMP
60
61
62
63
64
65
66
67
68
69
70
71
72
73 int provided;
74 MPI_Init_thread(&
m_argc, &
m_argv, MPI_THREAD_FUNNELED, &provided);
75
76
77
78
79
80
81
82
83#else
85#endif
86 int domainId, noDomains;
87#ifndef MAIA_WINDOWS
88 fftw_mpi_init();
89#endif
90 MPI_Comm_rank(MPI_COMM_WORLD, &domainId);
91 MPI_Comm_size(MPI_COMM_WORLD, &noDomains);
93
94
95 MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
96
97
98 if(domainId == 0) {
99 cerr0.rdbuf(cerr.rdbuf());
100 } else {
102 }
103
104
105
106
107 static_assert(CHAR_BIT == 8, "Unexpected type size: char has " XSTRINGIFY(CHAR_BIT) " bits (expected: 8)");
108 static_assert(
sizeof(
MChar) == 1,
"MChar has unexpected type size");
109#ifndef _SX
110 static_assert(
sizeof(
MBool) == 1,
"MBool has unexpected type size");
111#endif
112 static_assert(
sizeof(
MInt) == 4,
"MInt has unexpected type size");
113 static_assert(
sizeof(
MInt) == 4,
"MInt has unexpected type size");
114 static_assert(
sizeof(
MLong) == 8,
"MLong has unexpected type size");
115 static_assert(
sizeof(
MFloat) == 8,
"MFloat has unexpected type size");
116
117
120
121
122#if(MAIA_INFOOUT_FILE_TYPE == 1 && MAIA_INFOOUT_ROOT_ONLY == false)
123 m_log.
open(
"m_log_" + to_string(
globalDomainId()), MAIA_INFOOUT_PROJECT_NAME, MAIA_INFOOUT_FILE_TYPE, MPI_COMM_WORLD,
124 MAIA_INFOOUT_ROOT_ONLY);
125#else
126 m_log.
open(
"m_log", MAIA_INFOOUT_PROJECT_NAME, MAIA_INFOOUT_FILE_TYPE, MPI_COMM_WORLD, MAIA_INFOOUT_ROOT_ONLY);
127#endif
128
129
131
132
134
135
136 SET_DEBUG_LEVEL(0);
137
138
139
140
143
144
145#ifdef WITH_LIKWID
146 LIKWID_MARKER_INIT;
147 LIKWID_MARKER_THREADINIT;
148#endif
149
150
151 DEBUG("main:: reset timer", MAIA_DEBUG_LEVEL1);
152 RESET_TIMERS();
153
154 NEW_TIMER_GROUP(tg, "MAIA");
155
156
157 NEW_TIMER(timertotal, "Total", tg);
158 RECORD_TIMER_START(timertotal);
159
160
161 NEW_SUB_TIMER(timer1, "New Environment", timertotal);
162 RECORD_TIMER_START(timer1);
163
164 DEBUG("main:: new Environment", MAIA_DEBUG_LEVEL1);
166 RECORD_TIMER_STOP(timer1);
167
168
169 DEBUG("main:: mEnvironment->run", MAIA_DEBUG_LEVEL1);
170 NEW_SUB_TIMER(timer2, "Run Environment", timertotal);
171 RECORD_TIMER_START(timer2);
173 RECORD_TIMER_STOP(timer2);
174
175
176 NEW_SUB_TIMER(timer3, "End Environment", timertotal);
177 DEBUG("main:: mEnvironment->end", MAIA_DEBUG_LEVEL1);
178 RECORD_TIMER_START(timer3);
180 RECORD_TIMER_STOP(timer3);
181
182
183#ifdef WITH_LIKWID
184 LIKWID_MARKER_CLOSE;
185#endif
186
187
188 DEBUG("main:: delete environment", MAIA_DEBUG_LEVEL1);
192 }
193
194
195 RECORD_TIMER_STOP(timertotal);
196
197
198 DEBUG("main:: display all timers", MAIA_DEBUG_LEVEL1);
199 STOP_ALL_RECORD_TIMERS();
200 DISPLAY_ALL_TIMERS();
201
202
204
205
206 DEBUG("main:: mDealloc", MAIA_DEBUG_LEVEL1);
208
209
210 DEBUG("main:: close streams", MAIA_DEBUG_LEVEL1);
213
214
215
216
217#ifndef MAIA_WINDOWS
218 fftw_mpi_cleanup();
219#endif
220 MPI_Finalize();
221
222 return EXIT_SUCCESS;
223}
void mDealloc()
Deallocates all memory allocated previously by mAlloc(...)
Environment for the program.
MInt run()
Runs the Environment, makes the Application run.
MInt end()
Ends the Environment.
static MInt m_argc
Reads the name of the property-file and creates a new Application.
void open(const MString &filename, const MString &projectName, MInt fileType=0, MPI_Comm mpiComm=MPI_COMM_WORLD, MBool rootOnlyHardwired=false)
Opens a file by passing the parameters to InfoOut_<xyz>FileBuffer::open(...).
void close(MBool forceClose=false)
Pass the close call to the respective internal buffer.
MBool setRootOnly(MBool rootOnly=true)
Sets interal state of whether only the root domain (rank 0) should write to file.
MInt setMinFlushSize(MInt minFlushSize)
Sets the minimum buffer length that has to be reached before the buffer is flushed.
static MString printSelfReport()
Returns a shortened string summing up the scratch space state information.
GlobalMpiInformation g_mpiInformation
MInt globalNoDomains()
Return global number of domains.
MInt globalDomainId()
Return global domain id.
Environment * mEnvironment