Scippy

UG

Ubiquity Generator framework

ScipParaCommMpi Class Reference

#include <scipParaCommMpi.h>

+ Inheritance diagram for ScipParaCommMpi:

Public Member Functions

 ScipParaCommMpi ()
 
 ~ScipParaCommMpi ()
 
void init (int argc, char **argv)
 
void lockInterruptMsg ()
 lock interrupt message monitor to synchronize with the monitor thread More...
 
void unlockInterruptMsg ()
 unlock interrupt message monitor to synchronize with the monitor thread More...
 
UG::ParaDiffSubproblemcreateParaDiffSubproblem ()
 
UG::ParaInitialStatcreateParaInitialStat ()
 
UG::ParaRacingRampUpParamSetcreateParaRacingRampUpParamSet ()
 
UG::ParaInstancecreateParaInstance ()
 
UG::ParaSolutioncreateParaSolution ()
 
UG::ParaParamSetcreateParaParamSet ()
 
ScipParaInstancecreateScipParaInstance (SCIP *scip, int method)
 
ScipParaSolutioncreateScipParaSolution (ScipParaSolver *solver, SCIP_Real objval, int inNvars, SCIP_VAR **vars, SCIP_Real *vals)
 
ScipParaSolutioncreateScipParaSolution (SCIP_Real objval, int inNvars, int *inIndicesAmongSolvers, SCIP_Real *vals)
 
ScipParaDiffSubproblemcreateScipParaDiffSubproblem (SCIP *scip, ScipParaSolver *scipParaSolver, int nNewBranchVars, SCIP_VAR **newBranchVars, SCIP_Real *newBranchBounds, SCIP_BOUNDTYPE *newBoundTypes, int nAddedConss, SCIP_CONS **addedConss)
 
ScipParaInitialStatcreateScipParaInitialStat (SCIP *scip)
 
ScipParaInitialStatcreateScipParaInitialStat (int inMaxDepth, int inMaxTotalDepth, int inNVarBranchStatsDown, int inNVarBranchStatsUp, int *inIdxLBranchStatsVarsDown, int *inNVarBranchingDown, int *inIdxLBranchStatsVarsUp, int *inNVarBranchingUp, SCIP_Real *inDownpscost, SCIP_Real *inDownvsids, SCIP_Real *inDownconflen, SCIP_Real *inDowninfer, SCIP_Real *inDowncutoff, SCIP_Real *inUppscost, SCIP_Real *inUpvsids, SCIP_Real *inUpconflen, SCIP_Real *inUpinfer, SCIP_Real *inUpcutoff)
 
ScipParaRacingRampUpParamSetcreateScipParaRacingRampUpParamSet (int inTerminationCriteria, int inNNodesLeft, double inTimeLimit, int inScipRacingParamSeed, int inPermuteProbSeed, int inGenerateBranchOrderSeed, ScipDiffParamSet *inScipDiffParamSet)
 
ScipDiffParamSetcreateScipDiffParamSet ()
 
ScipDiffParamSetcreateScipDiffParamSet (SCIP *scip)
 
- Public Member Functions inherited from BbParaCommMpi
 BbParaCommMpi ()
 default constructor of ParaCommMpi More...
 
 BbParaCommMpi (MPI_Comm comm)
 constructor of ParaCommMpi with MPI communicator More...
 
virtual ~BbParaCommMpi ()
 destructor of this communicator More...
 
virtual ParaCalculationStatecreateParaCalculationState ()
 create ParaCalculationState object by default constructor More...
 
virtual ParaCalculationStatecreateParaCalculationState (double compTime, double rootTime, int nSolved, int nSent, int nImprovedIncumbent, int terminationState, int nSolvedWithNoPreprocesses, int nSimplexIterRoot, double averageSimplexIter, int nTransferredLocalCuts, int minTransferredLocalCuts, int maxTransferredLocalCuts, int nTransferredBendersCuts, int minTransferredBendersCuts, int maxTransferredBendersCuts, int nRestarts, double minIisum, double maxIisum, int minNii, int maxNii, double dualBound, int nSelfSplitNodesLeft)
 create ParaCalculationState object More...
 
virtual ParaTaskcreateParaTask ()
 create ParaNode object by default constructor More...
 
virtual ParaTaskcreateParaNode (TaskId inNodeId, TaskId inGeneratorNodeId, int inDepth, double inDualBoundValue, double inOriginalDualBoundValue, double inEstimatedValue, ParaDiffSubproblem *inDiffSubproblem)
 create ParaNode object More...
 
virtual ParaSolverStatecreateParaSolverState ()
 create ParaSolverState object by default constructor More...
 
virtual ParaSolverStatecreateParaSolverState (int racingStage, unsigned int notificationId, int lcId, int globalSubtreeId, long long nodesSolved, int nodesLeft, double bestDualBoundValue, double globalBestPrimalBoundValue, double detTime, double averageDualBoundGain)
 create ParaSolverState object More...
 
virtual ParaSolverTerminationStatecreateParaSolverTerminationState ()
 create ParaSolverTerminationState object by default constructor More...
 
virtual ParaSolverTerminationStatecreateParaSolverTerminationState (int interrupted, int rank, int totalNSolved, int minNSolved, int maxNSolved, int totalNSent, int totalNImprovedIncumbent, int nParaNodesReceived, int nParaNodesSolved, int nParaNodesSolvedAtRoot, int nParaNodesSolvedAtPreCheck, int nTransferredLocalCutsFromSolver, int minTransferredLocalCutsFromSolver, int maxTransferredLocalCutsFromSolver, int nTransferredBendersCutsFromSolver, int minTransferredBendersCutsFromSolver, int maxTransferredBendersCutsFromSolver, int nTotalRestarts, int minRestarts, int maxRestarts, int nTightened, int nTightenedInt, int calcTerminationState, double runningTime, double idleTimeToFirstParaNode, double idleTimeBetweenParaNodes, double iddleTimeAfterLastParaNode, double idleTimeToWaitNotificationId, double idleTimeToWaitAckCompletion, double idleTimeToWaitToken, double totalRootNodeTime, double minRootNodeTime, double maxRootNodeTime, double detTime)
 create ParaSolverTerminationState object More...
 
- Public Member Functions inherited from ParaCommMpi
 ParaCommMpi ()
 default constructor of ParaCommMpi More...
 
 ParaCommMpi (MPI_Comm comm)
 constructor of ParaCommMpi with MPI communicator More...
 
virtual ~ParaCommMpi ()
 destructor of this communicator More...
 
MPI_Comm & getMpiComm ()
 getter of MPI_Comm More...
 
double getStartTime ()
 get start time of this communicator More...
 
int getRank ()
 get rank of caller's thread More...
 
int getSize ()
 get size of this communicator, which indicates how many threads in a UG process More...
 
int getNumOfMessagesWaitingToSend (int dest=-1)
 get size of the messageQueueTable More...
 
void lcInit (ParaParamSet *paraParamSet)
 initializer for LoadCoordinator More...
 
void solverInit (ParaParamSet *paraParamSet)
 initializer for Solvers More...
 
void abort ()
 abort. How it works sometimes depends on communicator used More...
 
virtual bool waitTerminatedMessage ()
 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 *inToken)
 set received token to this communicator More...
 
virtual void lockApp ()
 lock UG application to synchronize with other threads More...
 
virtual void unlockApp ()
 unlock UG application to synchronize with other threads More...
 
ParaTimercreateParaTimer ()
 create ParaTimer object More...
 
int bcast (void *buffer, int count, const int datatypeId, int root)
 broadcast function for standard ParaData types More...
 
virtual int send (void *bufer, int count, const int datatypeId, int dest, const int tag)
 send function for standard ParaData types More...
 
int iSend (void *bufer, int count, const int datatypeId, int dest, const int tag, MPI_Request *req)
 send function for standard ParaData types More...
 
int receive (void *bufer, int count, const int datatypeId, int source, const int tag)
 receive function for standard ParaData types More...
 
void waitSpecTagFromSpecSource (const int source, const int tag, int *receivedTag)
 wait function for a specific tag from a specific source coming from More...
 
bool probe (int *source, int *tag)
 probe function which waits a new message More...
 
bool iProbe (int *source, int *tag)
 iProbe function which checks if a new message is arrived or not More...
 
int ubcast (void *buffer, int count, MPI_Datatype datatype, int root)
 User type bcast for created data type. More...
 
int usend (void *bufer, int count, MPI_Datatype datatype, int dest, int tag)
 User type send for created data type. More...
 
int iUsend (void *bufer, int count, MPI_Datatype datatype, int dest, int tag, MPI_Request *req)
 User type send for created data type. More...
 
int ureceive (void *bufer, int count, MPI_Datatype datatype, int source, int tag)
 User type receive for created data type. More...
 
int testAllIsends ()
 
void waitAllIsends ()
 
- Public Member Functions inherited from ParaComm
 ParaComm ()
 default constructor of ParaComm More...
 
virtual ~ParaComm ()
 destructor of ParaComm More...
 
virtual void setLocalRank (int inRank)
 
virtual void lockApp (char const *f, int l)
 lock UG application to synchronize with other threads (for debug) More...
 
virtual void unlockApp (char const *f, int l)
 unlock UG application to synchronize with other threads (for debug) More...
 

Protected Member Functions

bool tagStringTableIsSetUpCoorectly ()
 check if tag string table (for debugging) set up correctly More...
 
const char * getTagString (int tag)
 get Tag string for debugging More...
 

Static Protected Attributes

static const char * tagStringTable []
 tag name string table More...
 
- Static Protected Attributes inherited from BbParaCommMpi
static MPI_Datatype datatypes [TYPE_LIST_SIZE]
 data type mapping table to MPI data type More...
 
static const char * tagStringTable []
 table for tag name string More...
 
- Static Protected Attributes inherited from ParaCommMpi
static MPI_Datatype datatypes [TYPE_LIST_SIZE]
 data type mapping table to MPI data type More...
 
static const char * tagStringTable []
 table for tag name string More...
 

Private Attributes

std::mutex interruptMsgMonitorLockMutex
 mutex for interrupt message monitor More...
 

Additional Inherited Members

- Public Attributes inherited from ParaCommMpi
std::deque< ParaIsendRequest * > iSendRequestDeque
 
- Protected Attributes inherited from BbParaCommMpi
pthread_mutex_t tokenAccessLock
 mutex for pthread thread More...
 
- Protected Attributes inherited from ParaCommMpi
MPI_Comm myComm
 MPI communicator. More...
 
int myCommSize
 communicator size : number of processes joined in this system More...
 
int myRank
 rank of this process More...
 
int namelen
 length of this process name More...
 
char procName [MPI_MAX_PROCESSOR_NAME]
 process name More...
 
bool tagTraceFlag
 indicate if tags are traced or not More...
 
std::ofstream ofs
 output file stream for tag trace More...
 
std::ostream * tos
 output file stream for tag trace to change file name More...
 
double startTime
 start time of this communicator More...
 
int token [2]
 index 0: token index 1: token color -1: green > 0: yellow ( termination origin solver number ) -2: red ( means the solver can terminate ) More...
 
pthread_mutex_t tokenAccessLock
 mutex for pthread thread More...
 
std::mutex applicationLockMutex
 mutex for applications More...
 

Detailed Description

Definition at line 57 of file scipParaCommMpi.h.

Constructor & Destructor Documentation

◆ ScipParaCommMpi()

Definition at line 98 of file scipParaCommMpi.h.

◆ ~ScipParaCommMpi()

Definition at line 100 of file scipParaCommMpi.h.

Member Function Documentation

◆ createParaDiffSubproblem()

UG::ParaDiffSubproblem * createParaDiffSubproblem ( )
virtual

Reimplemented from ParaComm.

Definition at line 97 of file scipParaCommMpi.cpp.

Referenced by ScipParaCommMpi::unlockInterruptMsg().

◆ createParaInitialStat()

UG::ParaInitialStat * createParaInitialStat ( )

Definition at line 104 of file scipParaCommMpi.cpp.

Referenced by ScipParaCommMpi::unlockInterruptMsg().

◆ createParaInstance()

UG::ParaInstance * createParaInstance ( )
virtual

Implements ParaComm.

Definition at line 118 of file scipParaCommMpi.cpp.

Referenced by main(), and ScipParaCommMpi::unlockInterruptMsg().

◆ createParaParamSet()

UG::ParaParamSet * createParaParamSet ( )
virtual

Implements ParaComm.

Definition at line 153 of file scipParaCommMpi.cpp.

Referenced by main(), and ScipParaCommMpi::unlockInterruptMsg().

◆ createParaRacingRampUpParamSet()

UG::ParaRacingRampUpParamSet * createParaRacingRampUpParamSet ( )
virtual

Reimplemented from BbParaCommMpi.

Definition at line 111 of file scipParaCommMpi.cpp.

Referenced by ScipParaCommMpi::unlockInterruptMsg().

◆ createParaSolution()

UG::ParaSolution * createParaSolution ( )
virtual

Implements ParaComm.

Definition at line 125 of file scipParaCommMpi.cpp.

Referenced by ScipParaCommMpi::unlockInterruptMsg().

◆ createScipDiffParamSet() [1/2]

ScipDiffParamSet * createScipDiffParamSet ( )

Definition at line 271 of file scipParaCommMpi.cpp.

Referenced by ScipParaCommMpi::unlockInterruptMsg().

◆ createScipDiffParamSet() [2/2]

ScipDiffParamSet * createScipDiffParamSet ( SCIP *  scip)

Definition at line 277 of file scipParaCommMpi.cpp.

◆ createScipParaDiffSubproblem()

ScipParaDiffSubproblem * createScipParaDiffSubproblem ( SCIP *  scip,
ScipParaSolver scipParaSolver,
int  nNewBranchVars,
SCIP_VAR **  newBranchVars,
SCIP_Real *  newBranchBounds,
SCIP_BOUNDTYPE *  newBoundTypes,
int  nAddedConss,
SCIP_CONS **  addedConss 
)

Definition at line 171 of file scipParaCommMpi.cpp.

Referenced by ScipParaCommMpi::unlockInterruptMsg().

◆ createScipParaInitialStat() [1/2]

ScipParaInitialStat * createScipParaInitialStat ( SCIP *  scip)

Definition at line 195 of file scipParaCommMpi.cpp.

Referenced by ScipParaCommMpi::unlockInterruptMsg().

◆ createScipParaInitialStat() [2/2]

ScipParaInitialStat * createScipParaInitialStat ( int  inMaxDepth,
int  inMaxTotalDepth,
int  inNVarBranchStatsDown,
int  inNVarBranchStatsUp,
int *  inIdxLBranchStatsVarsDown,
int *  inNVarBranchingDown,
int *  inIdxLBranchStatsVarsUp,
int *  inNVarBranchingUp,
SCIP_Real *  inDownpscost,
SCIP_Real *  inDownvsids,
SCIP_Real *  inDownconflen,
SCIP_Real *  inDowninfer,
SCIP_Real *  inDowncutoff,
SCIP_Real *  inUppscost,
SCIP_Real *  inUpvsids,
SCIP_Real *  inUpconflen,
SCIP_Real *  inUpinfer,
SCIP_Real *  inUpcutoff 
)

Definition at line 205 of file scipParaCommMpi.cpp.

◆ createScipParaInstance()

ScipParaInstance * createScipParaInstance ( SCIP *  scip,
int  method 
)

Definition at line 132 of file scipParaCommMpi.cpp.

Referenced by ScipParaCommMpi::unlockInterruptMsg().

◆ createScipParaRacingRampUpParamSet()

ScipParaRacingRampUpParamSet * createScipParaRacingRampUpParamSet ( int  inTerminationCriteria,
int  inNNodesLeft,
double  inTimeLimit,
int  inScipRacingParamSeed,
int  inPermuteProbSeed,
int  inGenerateBranchOrderSeed,
ScipDiffParamSet inScipDiffParamSet 
)

Definition at line 249 of file scipParaCommMpi.cpp.

Referenced by ScipParaCommMpi::unlockInterruptMsg().

◆ createScipParaSolution() [1/2]

ScipParaSolution * createScipParaSolution ( ScipParaSolver solver,
SCIP_Real  objval,
int  inNvars,
SCIP_VAR **  vars,
SCIP_Real *  vals 
)

Definition at line 141 of file scipParaCommMpi.cpp.

Referenced by ScipParaCommMpi::unlockInterruptMsg().

◆ createScipParaSolution() [2/2]

ScipParaSolution * createScipParaSolution ( SCIP_Real  objval,
int  inNvars,
int *  inIndicesAmongSolvers,
SCIP_Real *  vals 
)

Definition at line 160 of file scipParaCommMpi.cpp.

◆ getTagString()

const char * getTagString ( int  tag)
protectedvirtual

get Tag string for debugging

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

Reimplemented from BbParaCommMpi.

Definition at line 78 of file scipParaCommMpi.cpp.

References ParaSCIP::getTagString(), ParaSCIP::TAG_SCIP_FIRST, and ScipParaCommMpi::tagStringTable.

◆ init()

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

Reimplemented from ParaCommMpi.

Definition at line 101 of file scipParaCommMpi.h.

References ParaCommMpi::init(), MPI_CALL, ParaCommMpi::myComm, ParaCommMpi::myCommSize, and ParaCommMpi::myRank.

Referenced by main().

◆ lockInterruptMsg()

void lockInterruptMsg ( )

lock interrupt message monitor to synchronize with the monitor thread

Definition at line 129 of file scipParaCommMpi.h.

◆ tagStringTableIsSetUpCoorectly()

bool tagStringTableIsSetUpCoorectly ( )
protectedvirtual

check if tag string table (for debugging) set up correctly

Returns
true if tag string table is set up correctly, false otherwise

Reimplemented from BbParaCommMpi.

Definition at line 71 of file scipParaCommMpi.cpp.

References ScipParaCommMpi::tagStringTable.

◆ unlockInterruptMsg()

Member Data Documentation

◆ interruptMsgMonitorLockMutex

std::mutex interruptMsgMonitorLockMutex
private

mutex for interrupt message monitor

Definition at line 60 of file scipParaCommMpi.h.

◆ tagStringTable

const char * tagStringTable
staticprotected
Initial value:
= {
TAG_STR(TagInitialStat1),
TAG_STR(TagSolverDiffParamSet1),
TAG_STR(TagDiffSubproblem1),
TAG_STR(TagDiffSubproblem2),
TAG_STR(TagDiffSubproblem3),
TAG_STR(TagDiffSubproblem4),
TAG_STR(TagDiffSubproblem5),
TAG_STR(TagDiffSubproblem6),
TAG_STR(TagDiffSubproblem7),
TAG_STR(TagDiffSubproblem8),
TAG_STR(TagDiffSubproblem9),
TAG_STR(TagDiffSubproblem10),
TAG_STR(TagDiffSubproblem11),
TAG_STR(TagDiffSubproblem12),
TAG_STR(TagDiffSubproblem13),
TAG_STR(TagDiffSubproblem14),
}

tag name string table

Definition at line 64 of file scipParaCommMpi.h.

Referenced by ScipParaCommMpi::getTagString(), and ScipParaCommMpi::tagStringTableIsSetUpCoorectly().