UG

Ubiquity Generator framework

bbParaLoadCoordinatorTerminationState.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-2026 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 bbParaLoadCoordinatorTerminationState.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 __BB_PARA_LOADCOORDINATOR_TERMINATION_STATE_H__
38#define __BB_PARA_LOADCOORDINATOR_TERMINATION_STATE_H__
39
40#include <string>
41#include <cfloat>
42#include "ug/paraComm.h"
44
45#ifdef UG_WITH_ZLIB
46#include "ug/gzstream.h"
47#endif
48
49namespace UG
50{
51
52///
53/// Class for LoadCoordinator termination state
54/// which contains calculation state in a ParaLoadCoordinator
55///
57{
58public:
59
60 bool isCheckpointState; ///< indicate if this state is at checkpoint or not
61 int rank; ///< rank of this ParaLoadCoordinator
62 ///
63 /// Counters related to this ParaLoadCoordinator
64 /// TODO: The numbers should be classified depending on solvers
65 ///
66 unsigned long long nWarmStart; ///< number of warm starts (restarts)
67 unsigned long long nSent; ///< number of ParaTasks sent from LC
68 unsigned long long nReceived; ///< number of ParaTasks received from Solvers
69 unsigned long long nSentBackImmediately; ///< number of ParaNodes sent back immediately from LC
70 unsigned long long nSentBackImmediatelyAnotherNode; ///< number of ParaNodes sent back immediately after AnotherNode request from LC
71 unsigned long long nDeletedInLc; ///< number of ParaNodes deleted in LC
72 unsigned long long nDeletedByMerging; ///< number of ParaNodes deleted by merging
73 unsigned long long nFailedToSendBack; ///< number of ParaNodes failed to send back
74 unsigned long long nFailedToSendBackAnotherNode; ///< number of ParaNodes failed to send back after AnotherNode request
75 unsigned long long nMaxUsageOfNodePool; ///< maximum number of ParaNodes in ParaNodePool
76 unsigned long long nInitialP; ///< initial p value, which indicates the number of good ParaNodes try to keep in LC
77 unsigned long long mMaxCollectingNodes; ///< maximum multiplier for the number of collecting nodes
78 unsigned long long nNodesInNodePool; ///< number of nodes in ParaNodePool
79 unsigned long long nNodesLeftInAllSolvers; ///< number of nodes left in all Solvers
80 unsigned long long nNodesOutputLog; ///< count for next logging of the number of transferred ParaNodes
81 double tNodesOutputLog; ///< keep time for next logging of the number of transferred ParaNodes
82 ///
83 /// current dual bound value
84 ///
85 double globalBestDualBoundValue; ///< global best dual bound value (internal value)
86 double externalGlobalBestDualBoundValue; ///< global best dual bound value (external value)
87 ///
88 /// times of this LoadCoordinator
89 ///
90 double idleTime; ///< idle time of this LoadCoordinator
91 double runningTime; ///< this ParaLoadCoordinator running time
92 ///
93 /// times used for merging
94 ///
95 double addingNodeToMergeStructTime; ///< time when a ParaNode is added to merge struct
96 double generateMergeNodesCandidatesTime; ///< time when merge ParaNode candidates are generated
97 double regenerateMergeNodesCandidatesTime; ///< time when merge ParaNode candidates are regenerated
98 double mergeNodeTime; ///< time when ParaNode is merged
99
100
101 ///
102 /// default constructor
103 ///
105 )
107 isCheckpointState(true),
108 rank(0),
109 nWarmStart(0),
110 nSent(0),
111 nReceived(0),
114 nDeletedInLc(0),
119 nInitialP(0),
124 tNodesOutputLog(0.0),
125 globalBestDualBoundValue(-DBL_MAX),
127 idleTime(0.0),
128 runningTime(0.0),
132 mergeNodeTime(0.0)
133 {
134 }
135
136 ///
137 /// destructor
138 ///
140 )
141 {
142 }
143
144 ///
145 /// stringfy ParaCalculationState
146 /// @return string to show inside of this object
147 ///
148 std::string toString(
149 );
150
151#ifdef UG_WITH_ZLIB
152
153 ///
154 /// write to checkpoint file
155 ///
156 void write(
157 gzstream::ogzstream &out ///< gzstream for output
158 );
159
160 ///
161 /// read from checkpoint file
162 ///
163 bool read(
164 ParaComm *comm, ///< communicator used
165 gzstream::igzstream &in ///< gzstream for input
166 );
167
168#endif
169
170};
171
172}
173
174#endif // __BB_PARA_LOADCOORDINATOR_TERMINATION_STATE_H__
175
Class for LoadCoordinator termination state which contains calculation state in a ParaLoadCoordinator...
bool isCheckpointState
indicate if this state is at checkpoint or not
bool read(ParaComm *comm, gzstream::igzstream &in)
read from checkpoint file
double generateMergeNodesCandidatesTime
time when merge ParaNode candidates are generated
unsigned long long nNodesInNodePool
number of nodes in ParaNodePool
unsigned long long nDeletedByMerging
number of ParaNodes deleted by merging
unsigned long long nNodesLeftInAllSolvers
number of nodes left in all Solvers
double runningTime
this ParaLoadCoordinator running time
unsigned long long nFailedToSendBackAnotherNode
number of ParaNodes failed to send back after AnotherNode request
unsigned long long nNodesOutputLog
count for next logging of the number of transferred ParaNodes
double regenerateMergeNodesCandidatesTime
time when merge ParaNode candidates are regenerated
unsigned long long mMaxCollectingNodes
maximum multiplier for the number of collecting nodes
unsigned long long nFailedToSendBack
number of ParaNodes failed to send back
unsigned long long nWarmStart
number of warm starts (restarts)
unsigned long long nDeletedInLc
number of ParaNodes deleted in LC
double tNodesOutputLog
keep time for next logging of the number of transferred ParaNodes
double externalGlobalBestDualBoundValue
global best dual bound value (external value)
unsigned long long nMaxUsageOfNodePool
maximum number of ParaNodes in ParaNodePool
unsigned long long nSentBackImmediately
number of ParaNodes sent back immediately from LC
void write(gzstream::ogzstream &out)
write to checkpoint file
unsigned long long nSent
number of ParaTasks sent from LC
unsigned long long nInitialP
initial p value, which indicates the number of good ParaNodes try to keep in LC
unsigned long long nReceived
number of ParaTasks received from Solvers
double addingNodeToMergeStructTime
time when a ParaNode is added to merge struct
double globalBestDualBoundValue
global best dual bound value (internal value)
unsigned long long nSentBackImmediatelyAnotherNode
number of ParaNodes sent back immediately after AnotherNode request from LC
Base class of communicator object.
Definition: paraComm.h:102
Abstract interface for LoadCoordinator termination state. Holds no data; derived classes own the fiel...
static ScipParaCommTh * comm
Definition: fscip.cpp:73
Utilities for handling gzipped input and output streams.
Base class of communicator for UG Framework.
Load coordinator termination state.