#include <ckmigratable.h>
Public Member Functions | |
CkMigratable (void) | |
CkMigratable (CkMigrateMessage *m) | |
virtual | ~CkMigratable () |
virtual void | pup (PUP::er &p) |
Pack/UnPack - tell the runtime how to serialize this class's data for migration, checkpoint, etc. | |
virtual void | CkAddThreadListeners (CthThread tid, void *msg) |
Called when a [threaded] charm entry method is created:. | |
virtual int | ckGetChareType (void) const |
Return the type of this chare, as present in _chareTable. | |
const CkArrayIndex & | ckGetArrayIndex (void) const |
CmiUInt8 | ckGetID (void) const |
void | ckStopTiming (void) |
void | ckStartTiming (void) |
LBDatabase * | getLBDB (void) const |
MetaBalancer * | getMetaBalancer (void) const |
void | ckStopTiming (void) |
void | ckStartTiming (void) |
LDObjHandle | timingBeforeCall (int *objstopped) |
for inline call | |
void | timingAfterCall (LDObjHandle objHandle, int *objstopped) |
void | ckMigrate (int toPe) |
virtual void | ckAboutToMigrate (void) |
Called by the system just before and after migration to another processor:. | |
virtual void | ckJustMigrated (void) |
void | recvLBPeriod (void *data) |
void | metaLBCallLB () |
void | clearMetaLBData (void) |
virtual void | ckJustRestored (void) |
virtual void | ckDestroy (void) |
Delete this object. | |
bool | ckInvokeEntry (int epIdx, void *msg, bool doFree) |
Execute the given entry method. | |
virtual void | ResumeFromSync (void) |
virtual void | UserSetLBLoad (void) |
void | setObjTime (double cputime) |
user define this when setLBLoad is true | |
double | getObjTime () |
void * | getObjUserData (int idx) |
Use this method to set user specified data to the lbdatabase. | |
void | AtSync (int waitForMigration=1) |
int | MigrateToPe () |
void | ReadyMigrate (bool ready) |
void | ckFinishConstruction (void) |
void | setMigratable (int migratable) |
void | setPupSize (size_t obj_pup_size) |
void | AtSync (int waitForMigration=1) |
void | setMigratable (int migratable) |
void | setPupSize (size_t obj_pup_size) |
void | ckFinishConstruction (void) |
bool | isAsyncEvacuate () |
Data Fields | |
CkArrayIndex | thisIndexMax |
Protected Member Functions | |
virtual void | CkAbort (const char *str) const |
A more verbose form of abort. | |
Protected Attributes | |
CkLocRec * | myRec |
bool | usesAtSync |
bool | usesAutoMeasure |
bool | barrierRegistered |
Private Types | |
enum | state { OFF, ON, PAUSE, DECIDED, LOAD_BALANCE } |
Private Member Functions | |
void | commonInit (void) |
void | AsyncEvacuate (bool set) |
Static Private Member Functions | |
static void | staticResumeFromSync (void *data) |
Private Attributes | |
int | thisChareType |
int | atsync_iteration |
double | prev_load |
CkMigratable::state | local_state |
bool | can_reset |
LDBarrierClient | ldBarrierHandle |
LDBarrierReceiver | ldBarrierRecvHandle |
int | prefetchObjID |
bool | isInCore |
bool | asyncEvacuate |
Friends | |
class | CkLocMgr |
int | CkArrayPrefetch_msg2ObjId (void *msg) |
Return the out-of-core objid (from CooRegisterObject) that this Converse message will access. | |
void | CkArrayPrefetch_writeToSwap (FILE *swapfile, void *objptr) |
Write this object (registered with RegisterObject) to this writable file. | |
void | CkArrayPrefetch_readFromSwap (FILE *swapfile, void *objptr) |
Read this object (registered with RegisterObject) from this readable file. |
Definition at line 4 of file ckmigratable.h.
enum CkMigratable::state [private] |
CkMigratable::CkMigratable | ( | void | ) |
Definition at line 1486 of file cklocation.C.
References commonInit().
CkMigratable::CkMigratable | ( | CkMigrateMessage * | m | ) |
Definition at line 1490 of file cklocation.C.
References commonInit().
CkMigratable::~CkMigratable | ( | ) | [virtual] |
Definition at line 1524 of file cklocation.C.
References _lb_args, MetaBalancer::AdjustCountForDeadContributor(), atsync_iteration, barrierRegistered, CkLocRec::destroy(), CkLocRec::getLBDB(), CkLocRec::getMetaBalancer(), idx2str(), isInCore, ldBarrierHandle, ldBarrierRecvHandle, CkLBArgs::metaLbOn(), myRec, prefetchObjID, LBDatabase::RemoveLocalBarrierClient(), LBDatabase::RemoveLocalBarrierReceiver(), thisIndexMax, and usesAtSync.
Referenced by CkArrayPrefetch_writeToSwap().
void CkMigratable::commonInit | ( | void | ) | [private] |
Definition at line 1455 of file cklocation.C.
References _lb_args, MetaBalancer::AdjustCountForNewContributor(), AsyncEvacuate(), atsync_iteration, barrierRegistered, can_reset, CkMigratable_initInfo::chareType, MetaBalancer::get_iteration(), CkLocRec::getIndex(), CkLocRec::getMetaBalancer(), isInCore, local_state, CkMigratable_initInfo::locRec, CkLBArgs::metaLbOn(), myRec, OFF, prefetchObjID, prev_load, thisChareType, thisIndexMax, usesAtSync, and usesAutoMeasure.
Referenced by CkMigratable().
void CkMigratable::pup | ( | PUP::er & | p | ) | [virtual] |
Pack/UnPack - tell the runtime how to serialize this class's data for migration, checkpoint, etc.
Reimplemented from Chare.
Reimplemented in ArrayElement, ArrayElemExt, Cell, Cell2D, Cell1D, Cell3D, ArmciVirtualProcessor, threadCollide, and TCharmClient1D.
Definition at line 1496 of file cklocation.C.
References CkLocRec::AsyncEvacuate(), asyncEvacuate, barrierRegistered, can_reset, ckFinishConstruction(), idx2str(), PUP::er::isPacking(), CkLocRec::isReadyMigrate(), PUP::er::isUnpacking(), myRec, p, Chare::pup(), CkLocRec::ReadyMigrate(), thisIndexMax, usesAtSync, and usesAutoMeasure.
Referenced by ArrayElement::pup().
void CkMigratable::CkAddThreadListeners | ( | CthThread | tid, | |
void * | msg | |||
) | [virtual] |
Called when a [threaded] charm entry method is created:.
This method is called before starting a [threaded] entry method.
Reimplemented from Chare.
Definition at line 1803 of file cklocation.C.
References PUP::a, Chare::CkAddThreadListeners(), CkArrayThreadListener_free(), CkArrayThreadListener_resume(), CkArrayThreadListener_suspend(), CthAddListener(), CthSetThreadID(), and thisIndexMax.
int CkMigratable::ckGetChareType | ( | void | ) | const [virtual] |
Return the type of this chare, as present in _chareTable.
Reimplemented from Chare.
Definition at line 1494 of file cklocation.C.
References thisChareType.
Referenced by CpdList_arrayElements::add(), ArrayElemExt::ArrayElemExt(), ArrayElement::ckDebugChareName(), and CkLocMgr::pupElementsFor().
const CkArrayIndex& CkMigratable::ckGetArrayIndex | ( | void | ) | const [inline] |
Definition at line 40 of file ckmigratable.h.
References CkLocRec::getIndex(), and myRec.
Referenced by CkCallback::CkCallback().
CmiUInt8 CkMigratable::ckGetID | ( | void | ) | const [inline] |
Reimplemented in ArrayElement.
Definition at line 41 of file ckmigratable.h.
References CkLocRec::getID(), and myRec.
Referenced by ArrayElement::ckDestroy(), CkArray::deleteElt(), and CkArray::eraseEltFromArrMgr().
void CkMigratable::ckStopTiming | ( | void | ) | [inline] |
Definition at line 45 of file ckmigratable.h.
References myRec, and CkLocRec::stopTiming().
Referenced by CkArrayThreadListener_suspend().
void CkMigratable::ckStartTiming | ( | void | ) | [inline] |
Definition at line 47 of file ckmigratable.h.
References myRec, and CkLocRec::startTiming().
Referenced by CkArrayThreadListener_resume().
LBDatabase* CkMigratable::getLBDB | ( | void | ) | const [inline] |
Definition at line 48 of file ckmigratable.h.
References CkLocRec::getLBDB(), and myRec.
Referenced by timingAfterCall(), and timingBeforeCall().
MetaBalancer* CkMigratable::getMetaBalancer | ( | void | ) | const [inline] |
Definition at line 49 of file ckmigratable.h.
References CkLocRec::getMetaBalancer(), and myRec.
Referenced by AtSync().
void CkMigratable::ckStopTiming | ( | void | ) | [inline] |
Definition at line 51 of file ckmigratable.h.
void CkMigratable::ckStartTiming | ( | void | ) | [inline] |
Definition at line 52 of file ckmigratable.h.
LDObjHandle CkMigratable::timingBeforeCall | ( | int * | objstopped | ) |
for inline call
Definition at line 1928 of file cklocation.C.
References getLBDB(), myRec, LBDatabase::ObjectStop(), and CkLocRec::startTiming().
void CkMigratable::timingAfterCall | ( | LDObjHandle | objHandle, | |
int * | objstopped | |||
) |
Definition at line 1941 of file cklocation.C.
References getLBDB(), myRec, LBDatabase::ObjectStart(), and CkLocRec::stopTiming().
void CkMigratable::ckMigrate | ( | int | toPe | ) | [inline] |
Definition at line 60 of file ckmigratable.h.
References CkLocRec::migrateMe(), and myRec.
void CkMigratable::ckAboutToMigrate | ( | void | ) | [virtual] |
Called by the system just before and after migration to another processor:.
Reimplemented in ArrayElement.
Definition at line 1520 of file cklocation.C.
Referenced by ElementDistributor::addLocation(), ArrayElement::ckAboutToMigrate(), CkLocMgr::emigrate(), and sendBackImmigrantRecObjs().
void CkMigratable::ckJustMigrated | ( | void | ) | [virtual] |
Reimplemented in ArrayElement, threadCollide, and TCharmClient1D.
Definition at line 1521 of file cklocation.C.
Referenced by ArrayElement::ckJustMigrated(), CkLocMgr::immigrate(), and CkLocMgr::resume().
void CkMigratable::recvLBPeriod | ( | void * | data | ) |
Definition at line 1609 of file cklocation.C.
References atsync_iteration, can_reset, Converse::CkMyPe(), DECIDED, CkLocRec::getMetaBalancer(), MetaBalancer::getPredictedLBPeriod(), idx2str(), LOAD_BALANCE, local_state, myRec, PAUSE, ResumeFromSync(), and thisIndexMax.
Referenced by CkLocMgr::informLBPeriod().
void CkMigratable::metaLBCallLB | ( | ) |
Definition at line 1638 of file cklocation.C.
References LBDatabase::AtLocalBarrier(), CkLocRec::getLBDB(), ldBarrierHandle, myRec, and usesAtSync.
Referenced by CkLocMgr::metaLBCallLB().
void CkMigratable::clearMetaLBData | ( | void | ) |
Definition at line 1600 of file cklocation.C.
References atsync_iteration, can_reset, local_state, OFF, and prev_load.
Referenced by staticResumeFromSync().
void CkMigratable::ckJustRestored | ( | void | ) | [virtual] |
Reimplemented in ArrayElement.
Definition at line 1522 of file cklocation.C.
Referenced by ArrayElement::ckJustRestored(), and CkLocMgr::restore().
void CkMigratable::ckDestroy | ( | void | ) | [virtual] |
Delete this object.
Reimplemented in ArrayElement.
Definition at line 1519 of file cklocation.C.
Referenced by CkLocation::destroyAll(), and CkLocMgr::flushLocalRecs().
Execute the given entry method.
Returns false if the element deleted itself or migrated away during execution.
Definition at line 78 of file ckmigratable.h.
References CkLocRec::invokeEntry(), and myRec.
Referenced by CkArrayBroadcaster::deliver(), and ArrayElement::recvBroadcast().
void CkMigratable::CkAbort | ( | const char * | str | ) | const [protected, virtual] |
A more verbose form of abort.
Reimplemented in ArrayElement.
Definition at line 1555 of file cklocation.C.
References _chareTable, name, and thisChareType.
Referenced by AtSync(), ArrayElement::CkAbort(), and UserSetLBLoad().
void CkMigratable::ResumeFromSync | ( | void | ) | [virtual] |
Reimplemented in ArrayElemExt, and Cell.
Definition at line 1560 of file cklocation.C.
Referenced by AtSync(), CkLocMgr::immigrate(), recvLBPeriod(), and staticResumeFromSync().
void CkMigratable::UserSetLBLoad | ( | void | ) | [virtual] |
Definition at line 1565 of file cklocation.C.
References CkAbort().
Referenced by AtSync().
void CkMigratable::setObjTime | ( | double | cputime | ) |
user define this when setLBLoad is true
Definition at line 1571 of file cklocation.C.
References myRec, and CkLocRec::setObjTime().
double CkMigratable::getObjTime | ( | ) |
Definition at line 1574 of file cklocation.C.
References CkLocRec::getObjTime(), and myRec.
void * CkMigratable::getObjUserData | ( | int | idx | ) |
Use this method to set user specified data to the lbdatabase.
Eg usage: In the application code, void *data = getObjUserData(CkpvAccess(_lb_obj_index)); *(int *) data = val;
In the loadbalancer or wherever this data is used do for (int i = 0; i < stats->n_objs; i++ ) { LDObjData &odata = stats->objData[i]; int* udata = (int *) odata.getUserData(CkpvAccess(_lb_obj_index)); }
For a complete example look at tests/charm++/load_balancing/lb_userdata_test/
Definition at line 1595 of file cklocation.C.
References CkLocRec::getObjUserData(), and myRec.
void CkMigratable::AtSync | ( | int | waitForMigration = 1 |
) |
Definition at line 1658 of file cklocation.C.
References _lb_args, _lb_psizer_on, MetaBalancer::AddLoad(), CkLocRec::AsyncMigrate(), LBDatabase::AtLocalBarrier(), atsync_iteration, can_reset, CkAbort(), ckFinishConstruction(), Converse::CkMyPe(), DECIDED, MetaBalancer::get_finished_iteration(), CkLocRec::getLBDB(), getMetaBalancer(), CkLocRec::getMetaBalancer(), CkLocRec::getObjTime(), idx2str(), ldBarrierHandle, LOAD_BALANCE, local_state, CkLBArgs::metaLbOn(), Chare::mlogData, myRec, OFF, PAUSE, prev_load, ReadyMigrate(), ResumeFromSync(), MetaBalancer::SetCharePupSize(), setPupSize(), PUP::sizer::size(), thisIndexMax, ChareMlogData::toResumeOrNot, UserSetLBLoad(), usesAtSync, usesAutoMeasure, and Chare::virtual_pup().
Referenced by ArrayElemExt::__AtSyncEntryMethod(), and Cell::goToAtSync().
int CkMigratable::MigrateToPe | ( | ) | [inline] |
Definition at line 96 of file ckmigratable.h.
References CkLocRec::MigrateToPe(), and myRec.
void CkMigratable::staticResumeFromSync | ( | void * | data | ) | [static, private] |
Definition at line 1748 of file cklocation.C.
References _lb_args, clearMetaLBData(), idx2str(), CkLBArgs::metaLbOn(), Chare::mlogData, ChareMlogData::resumeCount, ResumeFromSync(), thisIndexMax, and ChareMlogData::toResumeOrNot.
Referenced by ckFinishConstruction().
void CkMigratable::ReadyMigrate | ( | bool | ready | ) |
Definition at line 1739 of file cklocation.C.
References myRec, and CkLocRec::ReadyMigrate().
Referenced by AtSync().
void CkMigratable::ckFinishConstruction | ( | void | ) |
Definition at line 1643 of file cklocation.C.
References LBDatabase::AddLocalBarrierClient(), LBDatabase::AddLocalBarrierReceiver(), barrierRegistered, CkLocRec::getLBDB(), idx2str(), ldBarrierHandle, ldBarrierRecvHandle, myRec, CkLocRec::setMeasure(), staticResumeFromSync(), thisIndexMax, usesAtSync, and usesAutoMeasure.
Referenced by CkLocMgr::addElement(), AtSync(), and pup().
void CkMigratable::setMigratable | ( | int | migratable | ) |
Definition at line 1770 of file cklocation.C.
References myRec, and CkLocRec::setMigratable().
void CkMigratable::setPupSize | ( | size_t | obj_pup_size | ) |
Definition at line 1775 of file cklocation.C.
References myRec, and CkLocRec::setPupSize().
Referenced by AtSync().
void CkMigratable::AtSync | ( | int | waitForMigration = 1 |
) | [inline] |
Definition at line 106 of file ckmigratable.h.
References ResumeFromSync().
void CkMigratable::setMigratable | ( | int | migratable | ) | [inline] |
Definition at line 107 of file ckmigratable.h.
void CkMigratable::setPupSize | ( | size_t | obj_pup_size | ) | [inline] |
Definition at line 108 of file ckmigratable.h.
void CkMigratable::ckFinishConstruction | ( | void | ) | [inline] |
Definition at line 110 of file ckmigratable.h.
void CkMigratable::AsyncEvacuate | ( | bool | set | ) | [inline, private] |
Definition at line 126 of file ckmigratable.h.
References asyncEvacuate, CkLocRec::AsyncEvacuate(), and myRec.
Referenced by commonInit().
bool CkMigratable::isAsyncEvacuate | ( | ) | [inline] |
friend class CkLocMgr [friend] |
int CkArrayPrefetch_msg2ObjId | ( | void * | msg | ) | [friend] |
Return the out-of-core objid (from CooRegisterObject) that this Converse message will access.
If the message will not access an object, return -1.
Definition at line 1382 of file cklocation.C.
void CkArrayPrefetch_writeToSwap | ( | FILE * | swapfile, | |
void * | objptr | |||
) | [friend] |
Write this object (registered with RegisterObject) to this writable file.
Definition at line 1392 of file cklocation.C.
void CkArrayPrefetch_readFromSwap | ( | FILE * | swapfile, | |
void * | objptr | |||
) | [friend] |
Read this object (registered with RegisterObject) from this readable file.
Definition at line 1409 of file cklocation.C.
CkLocRec* CkMigratable::myRec [protected] |
Definition at line 6 of file ckmigratable.h.
Referenced by AsyncEvacuate(), AtSync(), CkArrayPrefetch_readFromSwap(), ckFinishConstruction(), ckGetArrayIndex(), ckGetID(), ckInvokeEntry(), ckMigrate(), ckStartTiming(), ckStopTiming(), commonInit(), getLBDB(), getMetaBalancer(), getObjTime(), getObjUserData(), ArrayElement::inmem_checkpoint(), CkMemCheckPT::inmem_restore(), metaLBCallLB(), MigrateToPe(), pup(), ReadyMigrate(), recvLBPeriod(), setMigratable(), setObjTime(), setPupSize(), timingAfterCall(), timingBeforeCall(), and ~CkMigratable().
int CkMigratable::thisChareType [private] |
Definition at line 8 of file ckmigratable.h.
Referenced by CkAbort(), CkArrayPrefetch_readFromSwap(), ckGetChareType(), and commonInit().
int CkMigratable::atsync_iteration [private] |
Definition at line 9 of file ckmigratable.h.
Referenced by AtSync(), clearMetaLBData(), commonInit(), recvLBPeriod(), and ~CkMigratable().
double CkMigratable::prev_load [private] |
Definition at line 10 of file ckmigratable.h.
Referenced by AtSync(), clearMetaLBData(), and commonInit().
CkMigratable::state CkMigratable::local_state [private] |
Referenced by AtSync(), clearMetaLBData(), commonInit(), and recvLBPeriod().
bool CkMigratable::can_reset [private] |
Definition at line 18 of file ckmigratable.h.
Referenced by AtSync(), clearMetaLBData(), commonInit(), pup(), and recvLBPeriod().
bool CkMigratable::usesAtSync [protected] |
Definition at line 20 of file ckmigratable.h.
Referenced by ArrayElemExt::ArrayElemExt(), AtSync(), ckFinishConstruction(), commonInit(), Cell::init_cell(), metaLBCallLB(), pup(), and ~CkMigratable().
bool CkMigratable::usesAutoMeasure [protected] |
Definition at line 21 of file ckmigratable.h.
Referenced by AtSync(), ckFinishConstruction(), commonInit(), and pup().
bool CkMigratable::barrierRegistered [protected] |
Definition at line 22 of file ckmigratable.h.
Referenced by ckFinishConstruction(), commonInit(), pup(), and ~CkMigratable().
LDBarrierClient CkMigratable::ldBarrierHandle [private] |
Definition at line 25 of file ckmigratable.h.
Referenced by AtSync(), ckFinishConstruction(), metaLBCallLB(), and ~CkMigratable().
Definition at line 26 of file ckmigratable.h.
Referenced by ckFinishConstruction(), and ~CkMigratable().
CkArrayIndex CkMigratable::thisIndexMax |
Definition at line 28 of file ckmigratable.h.
Referenced by ArrayElemExt::__entryMethod(), ArrayElemExt::ArrayElemExt(), AtSync(), ArrayElement::CkAbort(), CkAddThreadListeners(), ArrayElement::ckDebugChareID(), ArrayElement::ckDebugChareName(), ckFinishConstruction(), commonInit(), idx2str(), ArrayElement::init_checkpt(), ArrayElement::inmem_checkpoint(), liveVizDeposit(), pup(), recvLBPeriod(), staticResumeFromSync(), taskGraphArray::taskGraphArray(), taskGraphArray::tryToSolve(), and ~CkMigratable().
int CkMigratable::prefetchObjID [private] |
Definition at line 119 of file ckmigratable.h.
Referenced by CkLocMgr::addElementToRec(), CkArrayPrefetch_msg2ObjId(), commonInit(), CkLocMgr::emigrate(), and ~CkMigratable().
bool CkMigratable::isInCore [private] |
Definition at line 120 of file ckmigratable.h.
Referenced by commonInit(), CkLocMgr::emigrate(), and ~CkMigratable().
bool CkMigratable::asyncEvacuate [private] |
Definition at line 125 of file ckmigratable.h.
Referenced by AsyncEvacuate(), isAsyncEvacuate(), and pup().