Scippy

UG

Ubiquity Generator framework

ParaComm Class Referenceabstract

Base class of communicator object. More...

#include <paraComm.h>

Inheritance diagram for ParaComm:
ParaCommCPP11 ParaCommMpi ParaCommPth BbParaCommCPP11 BbParaCommMpi BbParaCommPth ScipParaCommTh ScipParaCommMpi

Public Member Functions

 ParaComm ()
 default constructor of ParaComm More...
 
virtual ~ParaComm ()
 destructor of ParaComm More...
 
virtual void init (int argc, char **argv)=0
 initializer of this object More...
 
virtual int getRank ()=0
 get rank of this process or this thread depending on run-time environment More...
 
virtual int getSize ()=0
 get number of UG processes or UG threads depending on run-time environment More...
 
virtual int getNumOfMessagesWaitingToSend (int dest)=0
 get size of the messageQueueTable More...
 
virtual void lcInit (ParaParamSet *paraParamSet)=0
 special initializer when this object is used in LoadCoordinator More...
 
virtual void solverInit (ParaParamSet *paraParamSet)=0
 special initializer when this object is used in Solver More...
 
virtual void setLocalRank (int inRank)
 
virtual void abort ()=0
 abort function for this communicator (how to abort depends on which library used for communication) More...
 
virtual bool waitTerminatedMessage ()=0
 function to wait Terminated message (This function is not used currently) More...
 
virtual bool waitToken (int rank)
 wait token when UG runs with deterministic mode More...
 
virtual void passToken (int rank)
 pass token to from the rank to the next More...
 
virtual bool passTermToken (int rank)
 pass termination token from the rank to the next More...
 
virtual void setToken (int rank, int *token)
 set received token to this communicator More...
 
virtual void lockApp ()=0
 lock UG application to synchronize with other threads More...
 
virtual void lockApp (char const *f, int l)
 lock UG application to synchronize with other threads (for debug) More...
 
virtual void unlockApp ()=0
 unlock UG application to synchronize with other threads More...
 
virtual void unlockApp (char const *f, int l)
 unlock UG application to synchronize with other threads (for debug) More...
 
virtual ParaCalculationStatecreateParaCalculationState ()=0
 transfer object factory More...
 
virtual ParaRacingRampUpParamSetcreateParaRacingRampUpParamSet ()=0
 create ParaRacingRampUpParamSet object More...
 
virtual ParaTaskcreateParaTask ()=0
 create ParaTask object by default constructor More...
 
virtual ParaParamSetcreateParaParamSet ()=0
 create ParaParamSet object More...
 
virtual ParaSolverStatecreateParaSolverState ()=0
 create ParaSolverState object by default constructor More...
 
virtual ParaSolverTerminationStatecreateParaSolverTerminationState ()=0
 create ParaSolverTerminationState object by default constructor More...
 
virtual ParaTimercreateParaTimer ()=0
 create ParaTimer object More...
 
virtual ParaInstancecreateParaInstance ()=0
 create ParaInstance object by default constructor More...
 
virtual ParaSolutioncreateParaSolution ()=0
 create ParaSolution object by default constructor More...
 
virtual ParaDiffSubproblemcreateParaDiffSubproblem ()
 create ParaDiffSubproblem object by default constructor More...
 
virtual int bcast (void *buffer, int count, const int datatypeId, int root)=0
 Some action need to be taken for fault tolerant, when the functions return. So, they rerun status value. More...
 
virtual int send (void *bufer, int count, const int datatypeId, int dest, const int tag)=0
 send function for standard ParaData types More...
 
virtual int receive (void *bufer, int count, const int datatypeId, int source, const int tag)=0
 receive function for standard ParaData types More...
 
virtual void waitSpecTagFromSpecSource (const int source, const int tag, int *receivedTag)=0
 wait function for a specific tag from a specific source coming from More...
 
virtual bool probe (int *source, int *tag)=0
 No need to take action for fault tolerant, when the functions return. So, they do not rerun status value. More...
 
virtual bool iProbe (int *source, int *tag)=0
 iProbe function which checks if a new message is arrived or not More...
 
virtual const char * getTagString (int tag)=0
 get Tag string for debugging More...
 

Detailed Description

Base class of communicator object.

Definition at line 101 of file paraComm.h.

Constructor & Destructor Documentation

◆ ParaComm()

ParaComm ( )

default constructor of ParaComm

Definition at line 108 of file paraComm.h.

◆ ~ParaComm()

virtual ~ParaComm ( )
virtual

destructor of ParaComm

Definition at line 116 of file paraComm.h.

Member Function Documentation

◆ abort()

virtual void abort ( )
pure virtual

abort function for this communicator (how to abort depends on which library used for communication)

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

◆ bcast()

virtual int bcast ( void *  buffer,
int  count,
const int  datatypeId,
int  root 
)
pure virtual

Some action need to be taken for fault tolerant, when the functions return. So, they rerun status value.

broadcast function for standard ParaData types

Returns
always 0 (for future extensions)
Parameters
bufferpoint to the head of sending message
countthe number of data in the message
datatypeIddata type in the message
rootroot rank for broadcasting

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Referenced by ScipParaInitiator::init(), ScipParaSolver::ScipParaSolver(), and ScipParaInitiator::sendSolverInitializationMessage().

◆ createParaCalculationState()

◆ createParaDiffSubproblem()

virtual ParaDiffSubproblem * createParaDiffSubproblem ( )
virtual

create ParaDiffSubproblem object by default constructor

Returns
pointer to ParaDiffSubproblem object

Reimplemented in ScipParaCommMpi, and ScipParaCommTh.

Definition at line 332 of file paraComm.h.

References THROW_LOGICAL_ERROR1.

◆ createParaInstance()

virtual ParaInstance * createParaInstance ( )
pure virtual

create ParaInstance object by default constructor

Returns
pointer to ParaInstance object

Implemented in ScipParaCommMpi, and ScipParaCommTh.

Referenced by ScipParaSolver::reinitialize().

◆ createParaParamSet()

virtual ParaParamSet * createParaParamSet ( )
pure virtual

create ParaParamSet object

Returns
pointer to ParaParamSet object

Implemented in ScipParaCommMpi, and ScipParaCommTh.

◆ createParaRacingRampUpParamSet()

virtual ParaRacingRampUpParamSet * createParaRacingRampUpParamSet ( )
pure virtual

◆ createParaSolution()

virtual ParaSolution * createParaSolution ( )
pure virtual

◆ createParaSolverState()

virtual ParaSolverState * createParaSolverState ( )
pure virtual

◆ createParaSolverTerminationState()

◆ createParaTask()

◆ createParaTimer()

virtual ParaTimer * createParaTimer ( )
pure virtual

create ParaTimer object

Returns
pointer to ParaTimer object

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Referenced by ParaSolver::ParaSolver().

◆ getNumOfMessagesWaitingToSend()

virtual int getNumOfMessagesWaitingToSend ( int  dest)
pure virtual

get size of the messageQueueTable

Returns
the size of the messageQueueTable
Parameters
destdestination of message

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

◆ getRank()

◆ getSize()

◆ getTagString()

virtual const char * getTagString ( int  tag)
pure virtual

get Tag string for debugging

Returns
string which shows Tag
Parameters
tagtag to be converted to string

Implemented in ParaCommCPP11, ParaCommMpi, ParaCommPth, BbParaCommCPP11, BbParaCommMpi, BbParaCommPth, ScipParaCommMpi, and ScipParaCommTh.

◆ init()

virtual void init ( int  argc,
char **  argv 
)
pure virtual

initializer of this object

Parameters
argcnumber of arguments
argvpointers to the arguments

Implemented in ParaCommCPP11, ParaCommMpi, ParaCommPth, and ScipParaCommMpi.

◆ iProbe()

virtual bool iProbe ( int *  source,
int *  tag 
)
pure virtual

iProbe function which checks if a new message is arrived or not

Returns
true when a new message exists
Parameters
sourcesource rank of the message arrived
tagtag of the message arrived

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Referenced by BbParaSolver::iReceiveMessages().

◆ lcInit()

virtual void lcInit ( ParaParamSet paraParamSet)
pure virtual

special initializer when this object is used in LoadCoordinator

Parameters
paraParamSetUG parameter set

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

◆ lockApp() [1/2]

virtual void lockApp ( )
pure virtual

lock UG application to synchronize with other threads

Implemented in ParaCommCPP11, ParaCommMpi, ParaCommPth, and ParaCommMpi.

Referenced by ParaComm::lockApp(), ScipParaSolver::ScipParaSolver(), and ScipParaInitiator::tryToSetIncumbentSolution().

◆ lockApp() [2/2]

virtual void lockApp ( char const *  f,
int  l 
)
virtual

lock UG application to synchronize with other threads (for debug)

Parameters
fstring to indicate what is locked
la number to show something

Reimplemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Definition at line 238 of file paraComm.h.

References ParaComm::lockApp().

◆ passTermToken()

virtual bool passTermToken ( int  rank)
virtual

pass termination token from the rank to the next

Returns
true, when the termination token is passed from this rank, false otherwise
Parameters
rankfrom this rank, the termination token is passed

Reimplemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Definition at line 211 of file paraComm.h.

Referenced by ScipParaSolver::~ScipParaSolver().

◆ passToken()

virtual void passToken ( int  rank)
virtual

pass token to from the rank to the next

Parameters
rankfrom this rank, the token is passed

Reimplemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Definition at line 201 of file paraComm.h.

Referenced by BbParaSolver::passToken().

◆ probe()

virtual bool probe ( int *  source,
int *  tag 
)
pure virtual

No need to take action for fault tolerant, when the functions return. So, they do not rerun status value.

probe function which waits a new message

Returns
always true
Parameters
sourcesource rank of the message arrived
tagtag of the message arrived

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Referenced by BbParaSolver::receiveNewTaskAndReactivate(), BbParaLoadCoordinator::restartInRampDownPhase(), BbParaLoadCoordinator::run(), BbParaSolver::sendCompletionOfCalculation(), and BbParaLoadCoordinator::~BbParaLoadCoordinator().

◆ receive()

virtual int receive ( void *  bufer,
int  count,
const int  datatypeId,
int  source,
const int  tag 
)
pure virtual

receive function for standard ParaData types

Returns
always 0 (for future extensions)
Parameters
buferpoint to the head of receiving message
countthe number of data in the message
datatypeIddata type in the message
sourcesource of the message coming from
tagtag of the message

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Referenced by BbParaSolver::iReceiveMessages(), ScipParaSolver::lbBoundTightened(), BbParaLoadCoordinator::processTagAllowToBeInCollectingMode(), BbParaLoadCoordinator::processTagAnotherNodeRequest(), BbParaSolver::processTagBreaking(), BbParaSolver::processTagCollectAllNodes(), BbParaSolver::processTagCutOffValue(), BbParaSolver::processTagGivenGapIsReached(), BbParaSolver::processTagGlobalBestDualBoundValueAtWarmStart(), ParaLoadCoordinator::processTagHardTimeLimit(), BbParaSolver::processTagInCollectingMode(), BbParaSolver::processTagIncumbentValue(), BbParaSolver::processTagInterruptRequest(), BbParaSolver::processTagKeepRacing(), BbParaLoadCoordinator::processTagLbBoundTightened(), BbParaSolver::processTagLCBestBoundValue(), BbParaSolver::processTagLightWeightRootNodeProcess(), BbParaSolver::processTagNoNodes(), BbParaSolver::processTagNoTestDualBoundGain(), BbParaSolver::processTagNotificationId(), BbParaSolver::processTagNoWaitModeSend(), BbParaSolver::processTagOutCollectingMode(), BbParaSolver::processTagRampUp(), BbParaSolver::processTagRestart(), BbParaSolver::processTagRetryRampUp(), BbParaLoadCoordinator::processTagSelfSplitFinished(), BbParaSolver::processTagTaskReceived(), BbParaSolver::processTagTerminateRequest(), BbParaSolver::processTagTerminateSolvingToRestart(), BbParaSolver::processTagTestDualBoundGain(), ParaLoadCoordinator::processTagToken(), BbParaSolver::processTagToken(), BbParaLoadCoordinator::processTagUbBoundTightened(), BbParaSolver::processTagWinner(), ScipParaSolver::ubBoundTightened(), and BbParaSolver::waitAckCompletion().

◆ send()

virtual int send ( void *  bufer,
int  count,
const int  datatypeId,
int  dest,
const int  tag 
)
pure virtual

send function for standard ParaData types

Returns
always 0 (for future extensions)
Parameters
buferpoint to the head of sending message
countthe number of data in the message
datatypeIddata type in the message
destdestination to send the message
tagtag of this message

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Referenced by BbParaSolverPool::activateSolver(), BbParaSolverPool::enforcedSwitchOutCollectingMode(), BbParaLoadCoordinator::newRacing(), BbParaSolver::notifySelfSplitFinished(), BbParaLoadCoordinator::processRacingRampUpTagCompletionOfCalculation(), BbParaLoadCoordinator::processRacingRampUpTagSolverState(), BbParaLoadCoordinator::processTagAnotherNodeRequest(), BbParaLoadCoordinator::processTagCompletionOfCalculation(), BbParaLoadCoordinator::processTagLbBoundTightened(), BbParaLoadCoordinator::processTagSelfSlpitNodeCalcuationState(), BbParaLoadCoordinator::processTagSelfSplitTermStateForInterruption(), BbParaLoadCoordinator::processTagSolverState(), BbParaLoadCoordinator::processTagTask(), ParaLoadCoordinator::processTagTerminated(), BbParaLoadCoordinator::processTagTermStateForInterruption(), ParaLoadCoordinator::processTagToken(), BbParaLoadCoordinator::processTagUbBoundTightened(), BbParaLoadCoordinator::restartInRampDownPhase(), BbParaLoadCoordinator::run(), ScipParaObjCommPointHdlr::scip_exec(), BbParaSolver::sendAnotherNodeRequest(), BbParaLoadCoordinator::sendCutOffValue(), BbParaLoadCoordinator::sendIncumbentValue(), BbParaLoadCoordinator::sendInterruptRequest(), BbParaLoadCoordinator::sendParaTasksToIdleSolvers(), ParaLoadCoordinator::sendRampUpToAllSolvers(), BbParaLoadCoordinator::sendRetryRampUpToAllSolvers(), BbParaSolverPool::sendSwitchOutCollectingModeIfNecessary(), ParaLoadCoordinator::sendTagToAllSolvers(), BbParaSolverPoolForMinimization::switchInCollectingMode(), BbParaSolverPool::switchInCollectingToSolver(), BbParaSolverPool::switchOutCollectingMode(), ParaLoadCoordinator::terminateAllSolvers(), BbParaLoadCoordinator::terminateAllSolvers(), BbParaSolverPoolForMinimization::updateSolverStatus(), and BbParaLoadCoordinator::warmStart().

◆ setLocalRank()

virtual void setLocalRank ( int  inRank)
virtual

Reimplemented in ParaCommCPP11.

Definition at line 166 of file paraComm.h.

Referenced by ScipParaInterruptMsgMonitor::run().

◆ setToken()

virtual void setToken ( int  rank,
int *  token 
)
virtual

set received token to this communicator

Parameters
rankrank to set the token
tokentoken to be set

Reimplemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Definition at line 221 of file paraComm.h.

Referenced by ParaLoadCoordinator::processTagToken(), and BbParaSolver::processTagToken().

◆ solverInit()

virtual void solverInit ( ParaParamSet paraParamSet)
pure virtual

special initializer when this object is used in Solver

Parameters
paraParamSetUG parameter set

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

◆ unlockApp() [1/2]

virtual void unlockApp ( )
pure virtual

unlock UG application to synchronize with other threads

Implemented in ParaCommCPP11, ParaCommMpi, ParaCommPth, and ParaCommMpi.

Referenced by ScipParaSolver::ScipParaSolver(), ScipParaInitiator::tryToSetIncumbentSolution(), and ParaComm::unlockApp().

◆ unlockApp() [2/2]

virtual void unlockApp ( char const *  f,
int  l 
)
virtual

unlock UG application to synchronize with other threads (for debug)

Parameters
fstring to indicate what is locked
la number to show something

Reimplemented in ParaCommCPP11, and ParaCommMpi.

Definition at line 253 of file paraComm.h.

References ParaComm::unlockApp().

◆ waitSpecTagFromSpecSource()

virtual void waitSpecTagFromSpecSource ( const int  source,
const int  tag,
int *  receivedTag 
)
pure virtual

wait function for a specific tag from a specific source coming from

Parameters
sourcesource rank which the message should come from
tagtag which the message should wait
receivedTagtag of the message which is arrived

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Referenced by BbParaSolver::sendParaNode(), BbParaSolver::waitAckCompletion(), and BbParaSolver::waitNotificationIdMessage().

◆ waitTerminatedMessage()

virtual bool waitTerminatedMessage ( )
pure virtual

function to wait Terminated message (This function is not used currently)

Returns
true when MPI communication is used, false when thread communication used

Implemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

◆ waitToken()

virtual bool waitToken ( int  rank)
virtual

wait token when UG runs with deterministic mode

Returns
true, when token is arrived to the rank
Parameters
rankrank to check if token is arrived

Reimplemented in ParaCommCPP11, ParaCommMpi, and ParaCommPth.

Definition at line 191 of file paraComm.h.

Referenced by BbParaSolver::waitToken().