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-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 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
57using namespace UG;
58using namespace ParaSCIP;
59
60ScipParaLoadCoordinator::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
103int
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 {
116 }
117 dynamic_cast<BbParaInitiator *>(paraInitiator)->accumulateInitialStat(initialStat);
118 delete initialStat;
119 return 0;
120}
121
int processTagInitialStat(int source, int tag)
Message handlers.
int(ScipParaLoadCoordinator::* ScipMessageHandlerFunctionPointer)(int, int)
Class for initiator.
Class for LoadCoordinator.
int maxDepthInWinnerSolverNodes
maximum depth of open nodes in the winner solver tree
Base class of communicator object.
Definition: paraComm.h:102
class for deterministic timer
virtual void receive(ParaComm *comm, int source)=0
receive function for ParaInitialStat object
Class for initiator.
Definition: paraInitiator.h:63
ParaParamSet * paraParams
UG parameter set.
ParaComm * paraComm
communicator used
ParaInitiator * paraInitiator
initiator
MessageHandlerFunctionPointer * messageHandler
message handlers table for primary phase
class ParaParamSet
Definition: paraParamSet.h:850
int getIntParamValue(int param)
get int parameter value
class ParaTimer
Definition: paraTimer.h:49
Utilities for handling gzipped input and output streams.
static const int TagInitialStat
static const int RampUpPhaseProcess
#define DEF_SCIP_PARA_COMM(scip_para_comm, comm)
ParaInitialStat extension for SCIP solver.