Scippy

UG

Ubiquity Generator framework

paraRacingRampUpParamSet.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 paraRacingRampUpParamSet.h
27 * @brief Base class for racing ramp-up parameter set.
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_RACING_RAMP_UP_PARAM_SET_H__
38#define __PARA_RACING_RAMP_UP_PARAM_SET_H__
39
40#include "paraComm.h"
41#ifdef UG_WITH_ZLIB
42#include "gzstream.h"
43#endif
44
45namespace UG
46{
47
48static const int RacingTerminationNotDefined = -1;
49
50///
51/// class ParaRacingRampUpParamSet
52/// (parameter set for racing ramp-up)
53///
54///
56{
57
58protected:
59
60 int terminationCriteria; ///< termination criteria of racing ramp-up : 0: number of nodes left, 1: time limit
61 ///< meaning must be defined in a derived class
62
63public:
64
65 ///
66 /// default constructor
67 ///
69 )
71 {
72 }
73
74 ///
75 /// constructor
76 ///
78 int inTerminationCriteria ///< termination criteria of racing ramp-up
79 )
80 : terminationCriteria(inTerminationCriteria)
81 {
82 }
83
84 ///
85 /// destructor
86 ///
88 )
89 {
90 }
91
92 ///
93 /// get termination criteria
94 /// @return an int value to show termination criteria
95 ///
97 )
98 {
100 }
101
102 ///
103 /// set winner rank
104 /// TODO: this function and also getWinnerRank should be removed
105 ///
106 virtual void setWinnerRank(
107 int rank
108 )
109 {
110 }
111
112
113 ///
114 /// send ParaRacingRampUpParamSet
115 /// @return always 0 (for future extensions)
116 ///
117 virtual int send(
118 ParaComm *comm, ///< communicator used
119 int destination ///< destination rank
120 ) = 0;
121
122 ///
123 /// receive ParaRacingRampUpParamSet
124 /// @return always 0 (for future extensions)
125 ///
126 virtual int receive(
127 ParaComm *comm, ///< communicator used
128 int source ///< source rank
129 ) = 0;
130
131#ifdef UG_WITH_ZLIB
132
133 ///
134 /// write to checkpoint file
135 ///
136 virtual void write(
137 gzstream::ogzstream &out ///< gzstream for output
138 ) = 0;
139
140 ///
141 /// read from checkpoint file
142 ///
143 virtual bool read(
144 ParaComm *comm, ///< communicator used
145 gzstream::igzstream &in ///< gzstream for input
146 ) = 0;
147
148#endif
149
150 ///
151 /// stringfy ParaRacingRampUpParamSet
152 /// @return string to show inside of this object
153 ///
154 virtual const std::string toString(
155 ) = 0;
156
157 ///
158 /// get strategy
159 /// @return an int value which shows strategy
160 ///
161 virtual int getStrategy() = 0;
162
163};
164
166
167}
168
169#endif // __PARA_RACING_RAMP_UP_PARAM_SET_H__
170
Base class of communicator object.
Definition: paraComm.h:102
class ParaRacingRampUpParamSet (parameter set for racing ramp-up)
int getTerminationCriteria()
get termination criteria
virtual bool read(ParaComm *comm, gzstream::igzstream &in)=0
read from checkpoint file
virtual void write(gzstream::ogzstream &out)=0
write to checkpoint file
int terminationCriteria
termination criteria of racing ramp-up : 0: number of nodes left, 1: time limit meaning must be defin...
virtual int send(ParaComm *comm, int destination)=0
send ParaRacingRampUpParamSet
virtual const std::string toString()=0
stringfy ParaRacingRampUpParamSet
virtual int receive(ParaComm *comm, int source)=0
receive ParaRacingRampUpParamSet
virtual int getStrategy()=0
get strategy
ParaRacingRampUpParamSet(int inTerminationCriteria)
constructor
virtual void setWinnerRank(int rank)
set winner rank TODO: this function and also getWinnerRank should be removed
virtual ~ParaRacingRampUpParamSet()
destructor
ParaRacingRampUpParamSet()
default constructor
static ScipParaCommTh * comm
Definition: fscip.cpp:73
Utilities for handling gzipped input and output streams.
ParaRacingRampUpParamSet * ParaRacingRampUpParamSetPtr
static const int RacingTerminationNotDefined
Base class of communicator for UG Framework.