// mainchare LBDBInit::LBDBInit(CkArgMsg *m) { #if CMK_LBDB_ON _lbdb = CProxy_LBDatabase::ckNew(); // runtime specified load balancer if (lbRegistry.runtime_lbs.size() > 0) { for (int i=0; i<lbRegistry.runtime_lbs.size(); i++) { const char *balancer = lbRegistry.runtime_lbs[i]; createLoadBalancer(balancer); } } else if (lbRegistry.compile_lbs.size() > 0) { for (int i=0; i<lbRegistry.compile_lbs.size(); i++) { const char* balancer = lbRegistry.compile_lbs[i]; createLoadBalancer(balancer); } } else { // NullLB is the default when none of above lb created // note user may create his own load balancer in his code manually like // in NAMD, but never mind NullLB can disable itself if there is // a non NULL LB. createLoadBalancer("NullLB"); } // simulation mode if (LBSimulation::doSimulation) { CmiPrintf("Charm++> Entering Load Balancer Simulation Mode ... \n"); CProxy_LBDatabase(_lbdb).ckLocalBranch()->StartLB(); } #endif delete m; }
NullLB::~NullLB() { // the LBDatabase object may have been deleted. theLbdb = CProxy_LBDatabase(_lbdb).ckLocalBranch(); if (theLbdb) { theLbdb->RemoveLocalBarrierReceiver(receiver); theLbdb->RemoveStartLBFn((LDStartLBFn)(staticStartLB)); } }
void BaseLB::initLB(const CkLBOptions &opt) { seqno = opt.getSeqNo(); CkpvAccess(numLoadBalancers) ++; /* if (CkpvAccess(numLoadBalancers) - CkpvAccess(hasNullLB) > 1) CmiAbort("Error: try to create more than one load balancer strategies!"); */ theLbdb = CProxy_LBDatabase(_lbdb).ckLocalBranch(); lbname = "Unknown"; // register this load balancer to LBDatabase at the sequence number theLbdb->addLoadbalancer(this, seqno); }
HybridBaseLB::~HybridBaseLB() { #if CMK_LBDB_ON theLbdb = CProxy_LBDatabase(_lbdb).ckLocalBranch(); if (theLbdb) { theLbdb->getLBDB()-> RemoveNotifyMigrated(notifier); //theLbdb-> // RemoveStartLBFn((LDStartLBFn)(staticStartLB)); } delete tree; #endif }
CentralLB::~CentralLB() { #if CMK_LBDB_ON delete [] statsMsgsList; delete statsData; theLbdb = CProxy_LBDatabase(_lbdb).ckLocalBranch(); if (theLbdb) { theLbdb->getLBDB()-> RemoveNotifyMigrated(notifier); theLbdb-> RemoveStartLBFn((LDStartLBFn)(staticStartLB)); } #endif }
WSLB::~WSLB() { #if CMK_LBDB_ON theLbdb = CProxy_LBDatabase(_lbdb).ckLocalBranch(); if (theLbdb) { theLbdb->getLBDB()-> RemoveNotifyMigrated(notifier); //theLbdb-> // RemoveStartLBFn((LDStartLBFn)(staticStartLB)); } if (statsMsgsList) delete [] statsMsgsList; if (statsDataList) delete [] statsDataList; if (neighbor_pes) delete [] neighbor_pes; if (mig_msgs) delete [] mig_msgs; #endif }