Scippy

UG

Ubiquity Generator framework

ParaTask Class Referenceabstract

class ParaTask More...

#include <paraTask.h>

Inheritance diagram for ParaTask:
BbParaNode BbParaNodeMpi BbParaNodeTh

Public Member Functions

 ParaTask ()
 default constructor More...
 
 ParaTask (const ParaTask &paraTask)
 copy constructor More...
 
 ParaTask (TaskId inTaskId, TaskId inGeneratorTaskId, double inEstimatedValue, ParaDiffSubproblem *inDiffSubproblem)
 constructor More...
 
virtual ~ParaTask ()
 destructor More...
 
bool isRootTask ()
 check if root task or not More...
 
bool isSameTaskIdAs (const ParaTask &inTask)
 check if this task id is the same as argument ParaTask's task id More...
 
bool isSameParetntTaskIdAs (const ParaTask &inTask)
 check if this task's parent id is the same as that of argument ParaTask's task id More...
 
bool isSameParetntTaskSubtaskIdAs (const TaskId &inTaskId)
 check if this task's parent subtree id is the same as that of argument ParaTask's task id More...
 
bool isSameSubtaskIdAs (const ParaTask &inTask)
 check if this task's subtask id is the same as that of argument ParaTask's task id More...
 
bool isSameLcIdAs (const ParaTask &inTask)
 check if this task's global subtask id in LC is the same as that of argument ParaTask's task id More...
 
bool isSameLcIdAs (const int lcId)
 check if this task's global subtask LC id is the same as LC id of argument More...
 
bool isSameGlobalSubtaskIdInLcAs (const ParaTask &inTask)
 check if this task's global subtask id in LC is the same as that of argument ParaTask's task id More...
 
bool isSameGlobalSubtaskIdInLcAs (const int globalSubtaskIdInLc)
 check if this task's global subtask id in LC is the same as that of argument More...
 
int getLcId ()
 getter of LoadCoordinator id More...
 
int getGlobalSubtaskIdInLc ()
 getter of global subtask id in Solvers managed by LoadCoordinator More...
 
void setGlobalSubtaskId (int lcId, int subtaskId)
 setter of global subtask id More...
 
int getSolverId ()
 getter of Solver id More...
 
void setSolverId (int id)
 setter of Solver id More...
 
TaskId getTaskId ()
 getter of task id More...
 
void setTaskId (TaskId inTaskId)
 setter of task id More...
 
TaskId getGeneratorTaskId ()
 getter of generator task id More...
 
void setGeneratorTaskId (TaskId inGeneratorTaskId)
 setter of generator task id More...
 
double getEstimatedValue ()
 getter of estimated value More...
 
void setEstimatedValue (double inEstimatedValue)
 setter of estimated value More...
 
ParaDiffSubproblemgetDiffSubproblem ()
 getter of diffSubproblem More...
 
void setDiffSubproblem (ParaDiffSubproblem *inDiffSubproblem)
 setter of diffSubproblem *‍/ More...
 
ParaTaskGenealogicalPtrgetAncestor ()
 getter of ancestor More...
 
void setAncestor (ParaTaskGenealogicalPtr *inAncestor)
 setter of ancestor More...
 
void removeDescendant (TaskId removeTaskId)
 remove a descendant More...
 
bool hasDescendant ()
 check if this task has descendant or not More...
 
void addDescendant (ParaTaskGenealogicalPtr *inDescendant)
 add a descendant More...
 
virtual ParaTaskclone (ParaComm *comm)=0
 clone this ParaTask More...
 
virtual int bcast (ParaComm *comm, int root)=0
 broadcast this object More...
 
virtual int send (ParaComm *comm, int destination)=0
 send this object More...
 
virtual int receive (ParaComm *comm, int source)=0
 receive this object More...
 
virtual void write (gzstream::ogzstream &out)=0
 write to checkpoint file More...
 
virtual const std::string toString ()
 stringfy ParaTask More...
 
virtual const std::string toSimpleString ()
 stringfy ParaTask as simple string More...
 

Public Attributes

TaskId taskId
 solving task information More...
 
TaskId generatorTaskId
 subtree root task id of generator More...
 
ParaTaskGenealogicalPtrancestor
 pointer to ancestor ParaTask : This field is not transferred More...
 
std::map< TaskId, ParaTaskGenealogicalPtrPtrdescendants
 collection of pointers to descendants : This filed is not transferred More...
 

Protected Attributes

double estimatedValue
 estimate value More...
 
int diffSubproblemInfo
 1: with diffSubproblem, 0: no diffSubproblem More...
 
ParaDiffSubproblemdiffSubproblem
 difference between solving instance data and subproblem data More...
 

Detailed Description

class ParaTask

Definition at line 541 of file paraTask.h.

Constructor & Destructor Documentation

◆ ParaTask() [1/3]

ParaTask ( )

default constructor

Definition at line 565 of file paraTask.h.

◆ ParaTask() [2/3]

◆ ParaTask() [3/3]

ParaTask ( TaskId  inTaskId,
TaskId  inGeneratorTaskId,
double  inEstimatedValue,
ParaDiffSubproblem inDiffSubproblem 
)

constructor

Parameters
inTaskIdtask id
inGeneratorTaskIdgenerator task id
inEstimatedValueestimated value
inDiffSubproblempointer to ParaDiffSubproblem object

Definition at line 594 of file paraTask.h.

References ParaTask::diffSubproblem, and ParaTask::diffSubproblemInfo.

◆ ~ParaTask()

virtual ~ParaTask ( )
virtual

destructor

Definition at line 614 of file paraTask.h.

References ParaTask::diffSubproblem.

Member Function Documentation

◆ addDescendant()

void addDescendant ( ParaTaskGenealogicalPtr inDescendant)

add a descendant

Parameters
inDescendantdescendant ParaTaskGenealogicalPtr

Definition at line 939 of file paraTask.h.

References ParaTask::descendants, and ParaTaskGenealogicalPtr::getTaskId().

Referenced by BbParaLoadCoordinator::processTagTask(), and BbParaNode::~BbParaNode().

◆ bcast()

virtual int bcast ( ParaComm comm,
int  root 
)
pure virtual

broadcast this object

Returns
always 0 (for future extensions)
Parameters
commcommunicator used
rootroot rank of broadcast

Implemented in BbParaNodeMpi, BbParaNodeTh, and BbParaNode.

Referenced by BbParaSolver::restartRacing(), BbParaSolver::run(), and BbParaLoadCoordinator::run().

◆ clone()

virtual ParaTask * clone ( ParaComm comm)
pure virtual

clone this ParaTask

Returns
pointer to cloned ParaTask object
Parameters
commcommunicator used

Implemented in BbParaNodeMpi, BbParaNodeTh, and BbParaNode.

◆ getAncestor()

ParaTaskGenealogicalPtr * getAncestor ( )

getter of ancestor

Returns
ancestor ParaTaskGenealogicalPtr

Definition at line 876 of file paraTask.h.

References ParaTask::ancestor.

Referenced by BbParaSolverPool::getGoodSolverSolvingEssentialNode().

◆ getDiffSubproblem()

◆ getEstimatedValue()

double getEstimatedValue ( )

getter of estimated value

Returns
estimated value

Definition at line 834 of file paraTask.h.

References ParaTask::estimatedValue.

◆ getGeneratorTaskId()

TaskId getGeneratorTaskId ( )

getter of generator task id

Returns
generator task id

Definition at line 814 of file paraTask.h.

References ParaTask::generatorTaskId.

Referenced by ScipParaSolver::setBakSettings().

◆ getGlobalSubtaskIdInLc()

int getGlobalSubtaskIdInLc ( )

getter of global subtask id in Solvers managed by LoadCoordinator

Returns
global subtask id

Definition at line 752 of file paraTask.h.

References SubtaskId::globalSubtaskIdInLc, TaskId::subtaskId, and ParaTask::taskId.

Referenced by BbParaSolver::sendSolverState().

◆ getLcId()

int getLcId ( )

getter of LoadCoordinator id

Returns
LoadCoordinator id

Definition at line 742 of file paraTask.h.

References SubtaskId::lcId, TaskId::subtaskId, and ParaTask::taskId.

Referenced by BbParaSolver::sendSolverState().

◆ getSolverId()

int getSolverId ( )

getter of Solver id

Returns
Solver id

Definition at line 774 of file paraTask.h.

References SubtaskId::solverId, TaskId::subtaskId, and ParaTask::taskId.

◆ getTaskId()

TaskId getTaskId ( )

getter of task id

Returns
task id

Definition at line 794 of file paraTask.h.

References ParaTask::taskId.

Referenced by BbParaLoadCoordinator::processTagTask(), BbParaLoadCoordinator::sendParaTasksToIdleSolvers(), and ScipParaSolver::setBakSettings().

◆ hasDescendant()

bool hasDescendant ( )

check if this task has descendant or not

Returns
true if it has descendant

Definition at line 930 of file paraTask.h.

References ParaTask::descendants.

Referenced by BbParaSolverPool::currentSolvingNodehaeDescendant().

◆ isRootTask()

◆ isSameGlobalSubtaskIdInLcAs() [1/2]

bool isSameGlobalSubtaskIdInLcAs ( const int  globalSubtaskIdInLc)

check if this task's global subtask id in LC is the same as that of argument

Returns
true if the both are the same
Parameters
globalSubtaskIdInLcglobal subtask id in LC

Definition at line 729 of file paraTask.h.

References SubtaskId::globalSubtaskIdInLc, TaskId::subtaskId, and ParaTask::taskId.

◆ isSameGlobalSubtaskIdInLcAs() [2/2]

bool isSameGlobalSubtaskIdInLcAs ( const ParaTask inTask)

check if this task's global subtask id in LC is the same as that of argument ParaTask's task id

Returns
true if the both are the same
Parameters
inTaskParaTask

Definition at line 715 of file paraTask.h.

References SubtaskId::globalSubtaskIdInLc, TaskId::subtaskId, and ParaTask::taskId.

◆ isSameLcIdAs() [1/2]

bool isSameLcIdAs ( const int  lcId)

check if this task's global subtask LC id is the same as LC id of argument

Returns
true if the both are the same
Parameters
lcIdLC id

Definition at line 702 of file paraTask.h.

References SubtaskId::lcId, TaskId::subtaskId, and ParaTask::taskId.

◆ isSameLcIdAs() [2/2]

bool isSameLcIdAs ( const ParaTask inTask)

check if this task's global subtask id in LC is the same as that of argument ParaTask's task id

Returns
true if the both are the same
Parameters
inTaskParaTask

Definition at line 688 of file paraTask.h.

References SubtaskId::lcId, TaskId::subtaskId, and ParaTask::taskId.

◆ isSameParetntTaskIdAs()

bool isSameParetntTaskIdAs ( const ParaTask inTask)

check if this task's parent id is the same as that of argument ParaTask's task id

Returns
true if the both are the same
Parameters
inTaskParaTask

Definition at line 651 of file paraTask.h.

References ParaTask::generatorTaskId.

◆ isSameParetntTaskSubtaskIdAs()

bool isSameParetntTaskSubtaskIdAs ( const TaskId inTaskId)

check if this task's parent subtree id is the same as that of argument ParaTask's task id

Returns
true if the both are the same
Parameters
inTaskIdParaTask id

Definition at line 663 of file paraTask.h.

References ParaTask::generatorTaskId, and TaskId::subtaskId.

Referenced by BbParaLoadCoordinator::sendParaTasksToIdleSolvers().

◆ isSameSubtaskIdAs()

bool isSameSubtaskIdAs ( const ParaTask inTask)

check if this task's subtask id is the same as that of argument ParaTask's task id

Returns
true if the both are the same
Parameters
inTaskParaTask

Definition at line 675 of file paraTask.h.

References TaskId::subtaskId, and ParaTask::taskId.

◆ isSameTaskIdAs()

bool isSameTaskIdAs ( const ParaTask inTask)

check if this task id is the same as argument ParaTask's task id

Returns
true if the both are the same
Parameters
inTaskParaTask

Definition at line 639 of file paraTask.h.

References ParaTask::taskId.

◆ receive()

virtual int receive ( ParaComm comm,
int  source 
)
pure virtual

receive this object

Returns
always 0 (for future extensions)
Parameters
commcommunicator used
sourcesource rank

Implemented in BbParaNodeMpi, BbParaNodeTh, and BbParaNode.

Referenced by BbParaSolver::processTagTask().

◆ removeDescendant()

void removeDescendant ( TaskId  removeTaskId)

remove a descendant

not implemented yet

Parameters
removeTaskIdtask id to remove

Definition at line 896 of file paraTask.h.

References ParaTask::descendants, ParaTaskGenealogicalPtr::getTaskId(), UG::ParaTaskLocalPtr, THROW_LOGICAL_ERROR1, and TaskId::toString().

Referenced by BbParaNode::~BbParaNode().

◆ send()

virtual int send ( ParaComm comm,
int  destination 
)
pure virtual

send this object

Returns
always 0 (for future extensions)
Parameters
commcommunicator used
destinationdestination rank

Implemented in BbParaNodeMpi, BbParaNodeTh, and BbParaNode.

◆ setAncestor()

void setAncestor ( ParaTaskGenealogicalPtr inAncestor)

setter of ancestor

Parameters
inAncestorancestor ParaTaskGenealogicalPtr

Definition at line 885 of file paraTask.h.

References ParaTask::ancestor.

Referenced by BbParaNode::~BbParaNode().

◆ setDiffSubproblem()

void setDiffSubproblem ( ParaDiffSubproblem inDiffSubproblem)

setter of diffSubproblem *‍/

Parameters
inDiffSubproblempointer to ParaDiffSubproblem object

Definition at line 864 of file paraTask.h.

References ParaTask::diffSubproblem, and ParaTask::diffSubproblemInfo.

◆ setEstimatedValue()

void setEstimatedValue ( double  inEstimatedValue)

setter of estimated value

Parameters
inEstimatedValueestimated value

Definition at line 843 of file paraTask.h.

References ParaTask::estimatedValue.

Referenced by BbParaLoadCoordinator::restartRacing().

◆ setGeneratorTaskId()

void setGeneratorTaskId ( TaskId  inGeneratorTaskId)

setter of generator task id

Parameters
inGeneratorTaskIdgenerator task id

Definition at line 823 of file paraTask.h.

References ParaTask::generatorTaskId.

◆ setGlobalSubtaskId()

void setGlobalSubtaskId ( int  lcId,
int  subtaskId 
)

setter of global subtask id

Parameters
lcIdLoadCorrdinaor id
subtaskIdsubtask id

Definition at line 761 of file paraTask.h.

References SubtaskId::globalSubtaskIdInLc, SubtaskId::lcId, TaskId::subtaskId, and ParaTask::taskId.

Referenced by BbParaLoadCoordinator::processTagTask().

◆ setSolverId()

void setSolverId ( int  id)

setter of Solver id

Parameters
idsolver id

Definition at line 783 of file paraTask.h.

References SubtaskId::solverId, TaskId::subtaskId, and ParaTask::taskId.

◆ setTaskId()

void setTaskId ( TaskId  inTaskId)

setter of task id

Parameters
inTaskIdtask id

Definition at line 803 of file paraTask.h.

References ParaTask::taskId.

◆ toSimpleString()

virtual const std::string toSimpleString ( )
virtual

stringfy ParaTask as simple string

Returns
string to show inside of this object

Reimplemented in BbParaNode.

Definition at line 1015 of file paraTask.h.

References ParaTask::generatorTaskId, ParaTask::taskId, and TaskId::toString().

Referenced by BbParaLoadCoordinator::processTagSelfSlpitNodeCalcuationState(), BbParaLoadCoordinator::processTagSolverState(), and BbParaLoadCoordinator::writeSubtreeInfo().

◆ toString()

virtual const std::string toString ( )
virtual

stringfy ParaTask

Returns
string to show inside of this object

Reimplemented in BbParaNode.

Definition at line 996 of file paraTask.h.

References ParaTask::diffSubproblem, ParaTask::estimatedValue, ParaTask::generatorTaskId, ParaTask::taskId, TaskId::toString(), and ParaDiffSubproblem::toString().

◆ write()

virtual void write ( gzstream::ogzstream &  out)
pure virtual

write to checkpoint file

Parameters
outgzstream for output

Implemented in BbParaNode.

Member Data Documentation

◆ ancestor

pointer to ancestor ParaTask : This field is not transferred

Definition at line 551 of file paraTask.h.

Referenced by ParaTask::getAncestor(), BbParaNode::getAncestor(), ParaTask::ParaTask(), ParaTask::setAncestor(), BbParaNode::setAncestor(), and BbParaNode::~BbParaNode().

◆ descendants

◆ diffSubproblem

◆ diffSubproblemInfo

◆ estimatedValue

◆ generatorTaskId

◆ taskId