61ParaLoadCoordinator::ParaLoadCoordinator(
63 UGS::UgsParaCommMpi *inCommUgs,
69 bool *inRacingSolversExist,
73 : nHandlers(inNHandlers),
75 racingRampUpMessageHandler(0),
76 globalSubtreeIdGen(0),
77 paraParams(inParaParamSet),
79 racingSolversExist(inRacingSolversExist),
82 computationIsInterrupted(false),
83 interruptedFromControlTerminal(false),
84 hardTimeLimitIsReached(false),
85 memoryLimitIsReached(false),
86 interruptIsRequested(false),
88 paraRacingSolverPool(0),
89 nSolvedInInterruptedRacingSolvers(-1),
90 nTasksLeftInInterruptedRacingSolvers(-1),
91 previousCheckpointTime(0.0),
94 racingWinnerParams(0),
95 racingTermination(false),
96 nSolvedRacingTermination(0),
98 paraTimer(inParaTimer),
99 paraDetTimer(inParaDetTimer),
100 osLogSolvingStatus(0),
101 osLogTasksTransfer(0),
102 osStatisticsFinalRun(0),
103 osStatisticsRacingRampUp(0),
105 terminationIssued(false)
137 std::ostringstream s;
142 << commUgs->getMySolverName() <<
"_"
157 std::cout <<
"Solving status log file cannot open : file name = " << s.str() << std::endl;
166 std::ostringstream s;
171 << commUgs->getMySolverName() <<
"_"
186 std::cout <<
"Task transfer log file cannot open : file name = " << s.str() << std::endl;
197 std::ostringstream ssfr;
202 << commUgs->getMySolverName() <<
"_"
217 std::cout <<
"Statistics file for final run cannot open : file name = " << ssfr.str() << std::endl;
309 delete paraSolverTerminationState;
346 int startRank = token[0];
382 int exitSolverRequest = 0;
435 <<
"] " << state->
toString() << std::endl;
464 <<
"] " << state->
toString() << std::endl;
Base class of Calculation state in a ParaSolver.
virtual std::string toString()=0
stringfy ParaCalculationState
Base class of communicator object.
virtual void setToken(int rank, int *token)
set received token to this communicator
virtual int getSize()=0
get number of UG processes or UG threads depending on run-time environment
virtual int send(void *bufer, int count, const int datatypeId, int dest, const int tag)=0
send function for standard ParaData types
virtual ParaSolverTerminationState * createParaSolverTerminationState()=0
create ParaSolverTerminationState object by default constructor
virtual int receive(void *bufer, int count, const int datatypeId, int source, const int tag)=0
receive function for standard ParaData types
virtual int getRank()=0
get rank of this process or this thread depending on run-time environment
class for deterministic timer
virtual void update(double value)=0
update function of the deterministic time. the deterministic time is a kind of counter
virtual double getElapsedTime()=0
getter of the deterministic time
virtual ParaInstance * getParaInstance()=0
get instance object
virtual double getEpsilon()=0
get epsilon specified
virtual const char * getProbName()=0
get problem name
ParaParamSet * paraParams
UG parameter set.
bool hardTimeLimitIsReached
indicate that hard time limit is reached or not
ParaComm * paraComm
communicator used
char lastCheckpointTimeStr[26]
lastCheckpointTimeStr[0] == ' ' means no checkpoint
virtual void terminateAllSolvers()
terminate all solvers
virtual int processTagTerminated(int source, int tag)
function to process TagTerminated message
std::mutex routineMutex
used to exclusive control of routines
bool terminationIssued
indicate termination request is issued
std::ostream * osLogTasksTransfer
ostream for task transfer info. to switch output location
virtual int processTagCompletionOfCalculation(int source, int tag)=0
function to process TagCompletionOfCalculation message
virtual void writeTransferLog(int rank, ParaCalculationState *state)
write transfer log
size_t nTerminated
counter to check if all solvers are terminated or not
virtual int processTagSolverState(int source, int tag)=0
function to process TagSolverState message
ParaSolverPool * paraSolverPool
Pools in LoadCorrdinator.
virtual void sendRampUpToAllSolvers()
notify ramp-up to all solvers
std::ofstream ofsStatisticsFinalRun
ofstream for statistics of the final run
ParaRacingSolverPool * paraRacingSolverPool
racing solver pool
virtual int processTagSolution(int source, int tag)=0
function to process TagSolution message
void sendTagToAllSolvers(const int tag)
send specified tag to all solvers
int(UG::ParaLoadCoordinator::* MessageHandlerFunctionPointer)(int, int)
ParaInitiator * paraInitiator
initiator
std::ostream * osStatisticsFinalRun
ostream for statistics of the final run
std::ofstream ofsLogTasksTransfer
ofstream for task transfer info.
virtual int processTagToken(int source, int tag)
function to process TagToken message
virtual int processTagTask(int source, int tag)=0
Message handlers.
std::ostream * osLogSolvingStatus
ostram for solving status to switch output location
virtual void writeTransferLogInRacing(int rank, ParaCalculationState *state)
write transfer log in racing
std::ofstream ofsLogSolvingStatus
ofstream for solving status
bool logTasksTransferFlag
indicate if task transfer info. is logged or not
ParaDeterministicTimer * paraDetTimer
deterministic timer used in case of deterministic mode this timer need to be created in case of deter...
virtual int processTagHardTimeLimit(int source, int tag)
function to process TagHardTimeLimit message
bool logSolvingStatusFlag
output streams and flags which indicate the output is specified or not
int nHandlers
number of valid handlers
MessageHandlerFunctionPointer * messageHandler
message handlers table for primary phase
bool computationIsInterrupted
indicate that current computation is interrupted or not
bool racingTermination
racing termination information
bool getBoolParamValue(int param)
get bool parameter value
const char * getStringParamValue(int param)
get string parameter value
virtual ParaTask * getCurrentTask(int rank)=0
get root ParaTask object of the Solver specified
virtual ParaTask * getCurrentTask(int rank)=0
get current solving ParaTask in the Solver specified by rank
virtual bool isInterruptRequested(int rank)=0
check if the Solver specified by rank is interrupt requested or not
virtual bool isTerminateRequested(int rank)=0
check if the Solver specified by rank is terminate requested or not
virtual void terminateRequested(int rank)=0
set the Solver specified by rank is terminate requested
virtual void terminated(int rank)=0
set the Solver specified by rank is terminated
virtual bool isSolverActive(int rank)=0
check if the Solver specified by rank is active or not
virtual bool isTerminated(int rank)=0
check if the Solver specified by rank is terminated or not
class ParaSolverTerminationState (Solver termination state in a ParaSolver)
int getInterruptedMode()
getter of interrupted flag
double getDeterministicTime()
getter of deterministic time
virtual std::string toString(ParaInitiator *initiator)=0
stringfy ParaSolverTerminationState object
virtual void receive(ParaComm *comm, int source, int tag)=0
receive this object
static ScipParaInitiator * paraInitiator
Utilities for handling gzipped input and output streams.
static const int TagAckCompletion
static const int TagCompletionOfCalculation
static const int TagSolution
static const int TagToken
static const int TagInterruptRequest
static const int LogTasksTransferFilePath
static const int LogSolvingStatus
static const int TagTerminated
static const int LogSolvingStatusFilePath
static const int TagTerminateRequest
static const int ParaBYTE
static const int TagRampUp
static const int TagSolverState
static const int TagHardTimeLimit
static const int Deterministic
@ RampUpPhase
ramp-up phase
static const int LogTasksTransfer
static const int StatisticsToStdout
#define PARA_COMM_CALL(paracommcall)
Base class for initial statistics collecting class.