Scippy

UG

Ubiquity Generator framework

paraLoadCoordinatorTerminationState.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and software framework */
4/* UG --- Ubquity Generator Framework */
5/* */
6/* Copyright Written by Yuji Shinano <shinano@zib.de>, */
7/* Copyright (C) 2021-2024 by Zuse Institute Berlin, */
8/* licensed under LGPL version 3 or later. */
9/* Commercial licenses are available through <licenses@zib.de> */
10/* */
11/* This code is free software; you can redistribute it and/or */
12/* modify it under the terms of the GNU Lesser General Public License */
13/* as published by the Free Software Foundation; either version 3 */
14/* of the License, or (at your option) any later version. */
15/* */
16/* This program is distributed in the hope that it will be useful, */
17/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19/* GNU Lesser General Public License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
23/* */
24/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25
26/**@file paraLoadCoordinatorTerminationState.h
27 * @brief Load coordinator termination state.
28 * @author Yuji Shinano
29 *
30 *
31 *
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36
37#ifndef __PARA_LOADCOORDINATOR_TERMINATION_STATE_H__
38#define __PARA_LOADCOORDINATOR_TERMINATION_STATE_H__
39
40#include <string>
41#include <cfloat>
42#include "paraComm.h"
43
44#ifdef UG_WITH_ZLIB
45#include "gzstream.h"
46#endif
47
48namespace UG
49{
50
51///
52/// Class for LoadCoordinator termination state
53/// which contains calculation state in a ParaLoadCoordinator
54///
56{
57public:
58
59 bool isCheckpointState; ///< indicate if this state is at checkpoint or not
60 int rank; ///< rank of this ParaLoadCoordinator
61 ///
62 /// Counters related to this ParaLoadCoordinator
63 /// TODO: The numbers should be classified depending on solvers
64 ///
65 unsigned long long nWarmStart; ///< number of warm starts (restarts)
66 unsigned long long nSent; ///< number of ParaTasks sent from LC
67 unsigned long long nReceived; ///< number of ParaTasks received from Solvers
68 ///
69 /// times of this LoadCoordinator
70 ///
71 double idleTime; ///< idle time of this LoadCoordinator
72 double runningTime; ///< this ParaLoadCoordinator running time
73
74 ///
75 /// default constructor
76 ///
78 )
79 : isCheckpointState(true),
80 rank(0),
81 nWarmStart(0),
82 nSent(0),
83 nReceived(0),
84 idleTime(0.0),
85 runningTime(0.0)
86 {
87 }
88
89 ///
90 /// destructor
91 ///
93 )
94 {
95 }
96
97 ///
98 /// stringfy ParaCalculationState
99 /// @return string to show inside of this object
100 ///
101 virtual std::string toString(
102 ) = 0;
103
104#ifdef UG_WITH_ZLIB
105
106 ///
107 /// write to checkpoint file
108 ///
109 virtual void write(
110 gzstream::ogzstream &out ///< gzstream for output
111 ) = 0;
112
113 ///
114 /// read from checkpoint file
115 ///
116 virtual bool read(
117 ParaComm *comm, ///< communicator used
118 gzstream::igzstream &in ///< gzstream for input
119 ) = 0;
120
121#endif
122
123};
124
125}
126
127#endif // __PARA_LOADCOORDINATOR_TERMINATION_STATE_H__
128
Base class of communicator object.
Definition: paraComm.h:102
Class for LoadCoordinator termination state which contains calculation state in a ParaLoadCoordinator...
bool isCheckpointState
indicate if this state is at checkpoint or not
virtual bool read(ParaComm *comm, gzstream::igzstream &in)=0
read from checkpoint file
double runningTime
this ParaLoadCoordinator running time
virtual void write(gzstream::ogzstream &out)=0
write to checkpoint file
double idleTime
idle time of this LoadCoordinator
unsigned long long nWarmStart
number of warm starts (restarts)
unsigned long long nSent
number of ParaTasks sent from LC
unsigned long long nReceived
number of ParaTasks received from Solvers
virtual std::string toString()=0
stringfy ParaCalculationState
static ScipParaCommTh * comm
Definition: fscip.cpp:73
Utilities for handling gzipped input and output streams.
Base class of communicator for UG Framework.