Scippy

UG

Ubiquity Generator framework

scipParaLoadCoordinator.cpp
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 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 paraLoadCoordinator.cpp
27  * @brief Load coordinator.
28  * @author Yuji Shinano
29  *
30  *
31  *
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #ifdef _MSC_VER
37 #include <functional>
38 #else
39 #include <unistd.h>
40 #endif
41 #include <cmath>
42 #include <ctime>
43 #include <cfloat>
44 #include <cstdio>
45 #include <cerrno>
46 #include <cstring>
47 #include <climits>
48 #include <algorithm>
49 #include <iomanip>
50 
51 #ifdef UG_WITH_ZLIB
52 #include "ug/gzstream.h"
53 #endif
54 #include "scipParaInitialStat.h"
56 
57 using namespace UG;
58 using namespace ParaSCIP;
59 
60 ScipParaLoadCoordinator::ScipParaLoadCoordinator(
61 #ifdef UG_WITH_UGS
62  UGS::UgsParaCommMpi *inCommUgs,
63 #endif
64  int inNhanders, ///< number of valid message handlers
65  ParaComm *inComm,
66  ParaParamSet *inParaParamSet,
67  ParaInitiator *inParaInitiator,
68  bool *inRacingSolversExist,
69  ParaTimer *inParaTimer,
70  ParaDeterministicTimer *inParaDetTimer
71  )
73 #ifdef UG_WITH_UGS
74  inCommUgs,
75 #endif
76  inNhanders,
77  inComm,
78  inParaParamSet,
79  inParaInitiator,
80  inRacingSolversExist,
81  inParaTimer,
82  inParaDetTimer
83  )
84 {
85 
86  // std::cout << "ScipParaLoadCoordinator constructor" << std::endl;
87 
89 
90  /** register message handlers */
92 
93 #if SCIP_APIVERSION < 101
95  {
96  std::cout << "*** Self-Split ramp-up (RampUpPhaseProcess = 3) cannot work with this version of SCIP ***" << std::endl;
97  exit(1);
98  }
99 #endif
100 
101 }
102 
103 int
105  int source,
106  int tag
107  )
108 {
109  DEF_SCIP_PARA_COMM( scipParaComm, paraComm );
110 
111  ScipParaInitialStat *initialStat = dynamic_cast<ScipParaInitialStat *>(scipParaComm->createParaInitialStat());
112  initialStat->receive(paraComm, source);
113  if( maxDepthInWinnerSolverNodes < initialStat->getMaxDepth() )
114  {
115  maxDepthInWinnerSolverNodes = initialStat->getMaxDepth();
116  }
117  dynamic_cast<BbParaInitiator *>(paraInitiator)->accumulateInitialStat(initialStat);
118  delete initialStat;
119  return 0;
120 }
121 
MessageHandlerFunctionPointer * messageHandler
message handlers table for primary phase
int(ScipParaLoadCoordinator::* ScipMessageHandlerFunctionPointer)(int, int)
ParaInitiator * paraInitiator
initiator
int maxDepthInWinnerSolverNodes
maximum depth of open nodes in the winner solver tree
Class for initiator.
Definition: paraInitiator.h:62
class for deterministic timer
virtual void receive(ParaComm *comm, int source)=0
receive function for ParaInitialStat object
int processTagInitialStat(int source, int tag)
Message handlers.
Class for initiator.
ParaParamSet * paraParams
UG parameter set.
ParaComm * paraComm
communicator used
class ParaParamSet
Definition: paraParamSet.h:850
static const int RampUpPhaseProcess
static const int TagInitialStat
int getIntParamValue(int param)
for int parameters
Class for LoadCoordinator.
class ParaTimer
Definition: paraTimer.h:48
ParaInitialStat extension for SCIP solver.
Base class of communicator object.
Definition: paraComm.h:101
#define DEF_SCIP_PARA_COMM(scip_para_comm, comm)