14#include "arcane/utils/ArcanePrecomp.h"
16#include "arcane/utils/Iterator.h"
17#include "arcane/utils/PlatformUtils.h"
18#include "arcane/utils/Array.h"
19#include "arcane/utils/Enumerator.h"
20#include "arcane/utils/Collection.h"
21#include "arcane/utils/IOnlineDebuggerService.h"
23#include "arcane/core/ModuleMaster.h"
24#include "arcane/core/EntryPoint.h"
25#include "arcane/core/CaseOptionsMain.h"
26#include "arcane/core/ITimeHistoryMng.h"
27#include "arcane/core/IVariableMng.h"
28#include "arcane/core/ISubDomain.h"
29#include "arcane/core/IApplication.h"
30#include "arcane/core/IModuleMng.h"
31#include "arcane/core/ITimeLoopMng.h"
32#include "arcane/core/IParallelMng.h"
33#include "arcane/core/ICaseMng.h"
34#include "arcane/core/IModuleMng.h"
35#include "arcane/core/ModuleBuildInfo.h"
36#include "arcane/core/ITimeLoopService.h"
50 ModuleBuildInfo mbi(sd, sd->defaultMeshHandle(),
"ArcaneMasterInternal");
82 &ModuleMaster::_masterLoopExit,
86 &ModuleMaster::_masterMeshChanged,
90 &ModuleMaster::_masterRestore,
146 info() <<
"Initialization to restore the functions of the input data: "
149 <<
" iteration=" << opt_iteration;
152 _masterContinueInit();
191 info() <<
"Information on consumption (unit:second): Con(R=...,I=...,C=...)";
192 info() <<
" R -> consumption in real time (clock) since the beginning of the computation";
193 info() <<
" I -> real time (clock) spent during the last iteration";
194 info() <<
" C -> consumption in CPU time since the beginning of the computation";
195 info() <<
"Information on memory consumption (unit: Mo): Mem=(X,m=X1:R1,M=X2:R2,avg=Z)";
196 info() <<
" X -> memory consumption of the process";
197 info() <<
" X1 -> memory consumption of the least memory hungry process and R1 is its rank";
198 info() <<
" X2 -> memory consumption of the most memory hungry process and R2 is its rank";
199 info() <<
" Z -> average memory consumption of all process";
215 m_thm_mem_used = mem_used;
233 values[0] = cpu_time;
234 values[1] = elapsed_time;
235 values[2] = (hyoda) ? hyoda->loopbreak(
subDomain()) : 0.0;
237 cpu_time = values[0];
238 elapsed_time = values[1];
239 if (hyoda && values[2] > 0.0)
253 m_thm_diff_cpu = diff_cpu;
255 m_thm_diff_elapsed = diff_elapsed;
266 Int32 mem_min_rank = 0;
267 Int32 mem_max_rank = 0;
268 pm->
computeMinMaxSum(mem_used, mem_min, mem_max, mem_sum, mem_min_rank, mem_max_rank);
271 Int64 i_diff_elapsed = (
Int64)(diff_elapsed * 1000.0);
274 <<
" Conso=(R=" << (((
Real)i_elapsed) / 1000.0)
275 <<
",I=" << (((
Real)i_diff_elapsed) / 1000.0)
276 <<
",C=" << ((
Real)i_cpu / 1000.0)
277 <<
") Mem=(" << (
Int64)(mem_used / 1e6)
278 <<
",m=" << (
Int64)(mem_min / 1e6)
279 <<
":" << mem_min_rank
280 <<
",M=" << (
Int64)(mem_max / 1e6)
281 <<
":" << mem_max_rank
287 m_has_thm_dump_at_iteration =
false;
310 if (
subDomain()->timeLoopMng()->finalTimeReached()) {
311 info() <<
"===============================================================";
312 info() <<
"====== END OF COMPUTATION REACHED... =======================";
313 info() <<
"===============================================================";
323 if (m_has_thm_dump_at_iteration)
344 thm->
addValue(
"TotalMemory", mem_used);
346 thm->
addValue(
"GlobalCpuTime", global_cpu_time);
347 thm->
addValue(
"ElapsedTime", diff_elapsed);
348 thm->
addValue(
"GlobalElapsedTime", global_elapsed_time);
350 m_has_thm_dump_at_iteration =
true;
352 Int64 i_elapsed = (
Int64)(global_elapsed_time * 1000.0);
353 Int64 i_diff_elapsed = (
Int64)(diff_elapsed * 1000.0);
354 Int64 i_cpu = (
Int64)(global_cpu_time * 1000.0);
357 <<
" Conso=(R=" << (((
Real)i_elapsed) / 1000.0)
358 <<
",I=" << (((
Real)i_diff_elapsed) / 1000.0)
359 <<
",C=" << ((
Real)i_cpu / 1000.0)
360 <<
") Mem=(" << (
Int64)(mem_used / 1e6)
384 service->onTimeLoopBeginLoop();
396 service->onTimeLoopEndLoop();
408 service->onTimeLoopStartInit();
420 service->onTimeLoopContinueInit();
432 service->onTimeLoopExit();
444 service->onTimeLoopMeshChanged();
456 service->onTimeLoopRestore();
ISubDomain * subDomain() const override
Sub-domain associated with the module.
AbstractModule(const ModuleBuildInfo &)
Constructor from a ModuleBuildInfo.
IParallelMng * parallelMng() const override
Message passing parallelism manager.
Modifiable view of an array of type T.
VariableScalarInt32 m_global_iteration
Current iteration.
VariableScalarReal m_global_elapsed_time
Clock time used (in seconds).
VariableScalarReal m_global_cpu_time
CPU time used (in seconds).
VariableScalarReal m_global_old_deltat
Delta T at the time previous to the global time.
VariableScalarReal m_global_old_elapsed_time
Previous clock time used (in seconds).
VariableScalarReal m_global_time
Current time.
CommonVariables(IModule *c)
Constructs the references of the common variables for the module c.
VariableScalarReal m_global_old_cpu_time
Previous CPU time used (in seconds).
VariableScalarReal m_global_old_time
Time previous to the current time.
VariableScalarReal m_global_deltat
Global Delta T.
Information about the floating-point type.
virtual void updateOptions(Real current_time, Real current_deltat, Integer current_iteration)=0
Updates the options based on a time-marching table.
static const char *const WComputeLoop
called during the calculation loop
static const char *const WStartInit
called during new case initialization
static const char *const WRestore
called to restore variables during a rollback
@ PAutoLoadEnd
Automatically loaded at the end. This means that a module possessing an entry point with this propert...
@ PAutoLoadBegin
Automatically loaded at the beginning. This means that a module possessing an entry point with this p...
static const char *const WOnMeshChanged
called after a mesh change
static const char *const WContinueInit
called during continuation initialization
static const char *const WInit
called during initialization
Interface of the parallelism manager for a subdomain.
virtual void computeMinMaxSum(char val, char &min_val, char &max_val, char &sum_val, Int32 &min_rank, Int32 &max_rank)=0
Calculates the sum, min, and max of a value in one operation.
virtual Int32 commSize() const =0
Number of instances in the communicator.
virtual char reduce(eReduceType rt, char v)=0
Performs a reduction of type rt on the real v and returns the value.
Interface of the subdomain manager.
virtual ITimeHistoryMng * timeHistoryMng()=0
Returns the history manager.
virtual ICaseMng * caseMng()=0
Returns the dataset manager.
virtual IParallelMng * allReplicaParallelMng() const =0
Returns the parallelism manager for all replicas.
Class managing a history of values.
virtual void addValue(const String &name, Real value, bool end_time=true, bool is_local=false)=0
Adds the value value to the history name.
Interface of a service operating during the time loop.
Information for building a module.
ISubDomain * subDomain() const
Access to the associated subdomain.
void masterInit()
Auto-loaded entry point at the beginning of initialization.
void masterStartInit()
Auto-loaded entry point at the beginning of a new case initialization.
CaseOptionsMain * m_case_options_main
Instance of module options.
bool m_is_first_loop
Indicates if we are in the first execution loop.
Real m_old_cpu_time
CPU time value at the last iteration.
ModuleMaster(const ModuleBuildInfo &)
Constructor.
void dumpStandardCurves() override
Dumps standard curves (CPUTime, ElapsedTime, ...).
Real m_old_elapsed_time
Clock time value at the last iteration.
virtual void timeStepInformation()
Overridable display of time step information.
void timeLoopEnd()
Auto-loaded entry point at the end of the calculation loop iteration.
void timeLoopBegin()
Auto-loaded entry point at the beginning of the calculation loop iteration.
void addTimeLoopService(ITimeLoopService *tls) override
Adds the time loop service.
UniqueArray< ITimeLoopService * > m_timeloop_services
List of time loop services.
virtual void timeIncrementation()
Overridable time step incrementation.
Integer m_nb_loop
Number of calculation loops performed.
~ModuleMaster() override
Destructor.
void masterContinueInit()
Auto-loaded entry point at the beginning of a new case restart.
TraceMessage info() const
Flow for an information message.
Formatting real numbers with a given precision.
Formatting the stream by length.
@ ReduceMax
Maximum of values.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
double Real
Type representing a real number.
void addEntryPoint(ModuleType *module, const char *name, void(ModuleType::*func)(), const String &where=IEntryPoint::WComputeLoop, int property=IEntryPoint::PNone)
Template routine allowing an entry point to be referenced in a module.
std::int32_t Int32
Signed integer type of 32 bits.