Skip to content

Commit 3b9e082

Browse files
committed
Changes for load balancing support using reconverse
1 parent dba0437 commit 3b9e082

31 files changed

+173
-155
lines changed

src/ck-core/ck.C

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ clients, including the rest of Charm++, are actually C++.
1212

1313
#include "pathHistory.h"
1414

15-
#if CMK_LBDB_ON
15+
#if 1
1616
#include "LBManager.h"
17-
#endif // CMK_LBDB_ON
17+
#endif // 1
1818

1919
#ifndef CMK_CHARE_USE_PTR
2020
#include <map>
@@ -598,14 +598,14 @@ inline Chare *_popObj(void) {
598598
}
599599

600600
inline void _ckStartTiming(void) {
601-
#if CMK_LBDB_ON
601+
#if 1
602602
auto *active = CkActiveLocRec();
603603
if (active) active->startTiming();
604604
#endif
605605
}
606606

607607
inline void _ckStopTiming(void) {
608-
#if CMK_LBDB_ON
608+
#if 1
609609
auto *active = CkActiveLocRec();
610610
if (active) active->stopTiming();
611611
#endif
@@ -919,6 +919,8 @@ static CkGroupID _groupCreate(envelope *env)
919919
groupNum.idx = CkpvAccess(_numGroups)++;
920920
else
921921
groupNum.idx = _getGroupIdx(CkNumPes(),CkMyPe(),CkpvAccess(_numGroups)++);
922+
printf("Created group %d\n", groupNum.idx);
923+
fflush(stdout);
922924
_createGroup(groupNum, env);
923925
return groupNum;
924926
}

src/ck-core/ckarray.C

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,7 +1871,7 @@ void CkArray::recvMsg(CkArrayMessage* msg, CmiUInt8 id, CkDeliver_t type, int op
18711871

18721872
void CkArray::recordSend(const CmiUInt8 id, const unsigned int bytes, int pe, const int opts)
18731873
{
1874-
#if CMK_LBDB_ON
1874+
#if 1
18751875
if (!(opts & CK_MSG_LB_NOTRACE) && locMgr->getLBMgr()->CollectingCommStats())
18761876
{
18771877
// LB deals in IDs with collection information only when CMK_GLOBAL_LOCATION_UPDATE
@@ -1901,7 +1901,7 @@ void CkArray::sendToPe(CkArrayMessage* msg, int pe, CkDeliver_t type, int opts)
19011901
// queuing infrastructure
19021902
if (pe != CkMyPe() || type == CkDeliver_queue)
19031903
{
1904-
#if CMK_LBDB_ON
1904+
#if 1
19051905
// Track message sends if the LB framework is collecting comm stats
19061906
if (msg->array_hops() == 0 && !(opts & CK_MSG_LB_NOTRACE) &&
19071907
locMgr->getLBMgr()->CollectingCommStats())
@@ -1943,7 +1943,7 @@ void CkArray::sendToPe(CkArrayMessage* msg, int pe, CkDeliver_t type, int opts)
19431943
demandCreateElement(idx, ctor);
19441944
}
19451945
}
1946-
#if CMK_LBDB_ON
1946+
#if 1
19471947
// This ensures that communication is tracked even for inline sends
19481948
if (msg->array_hops() == 0 && !(opts & CK_MSG_LB_NOTRACE) &&
19491949
locMgr->getLBMgr()->CollectingCommStats())

src/ck-core/cklocation.C

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
#include <stdarg.h>
2424
#include <vector>
2525

26-
#if CMK_LBDB_ON
26+
#if 1
2727
# include "LBManager.h"
2828
# include "MetaBalancer.h"
2929
# if CMK_GLOBAL_LOCATION_UPDATE
3030
# include "BaseLB.h"
3131
# include "init.h"
3232
# endif
3333
CkpvExtern(int, _lb_obj_index); // for lbdb user data for obj index
34-
#endif // CMK_LBDB_ON
34+
#endif // 1
3535

3636
CpvExtern(std::vector<NcpyOperationInfo*>, newZCPupGets); // used for ZC Pup
3737
#ifndef CMK_CHARE_USE_PTR
@@ -78,7 +78,7 @@ bool useNodeBlkMapping;
7878
/// unlocated array elements
7979
int _messageBufferingThreshold;
8080

81-
#if CMK_LBDB_ON
81+
#if 1
8282

8383
# if CMK_GLOBAL_LOCATION_UPDATE
8484
void UpdateLocation(MigrateInfo& migData)
@@ -1723,7 +1723,7 @@ void CkMigratable::commonInit(void)
17231723
prev_load = 0.0;
17241724
can_reset = false;
17251725

1726-
#if CMK_LBDB_ON
1726+
#if 1
17271727
if (_lb_args.metaLbOn())
17281728
{
17291729
atsync_iteration = myRec->getMetaBalancer()->get_iteration();
@@ -1750,7 +1750,7 @@ void CkMigratable::pup(PUP::er& p)
17501750
p | can_reset;
17511751
p | usesAutoMeasure;
17521752

1753-
#if CMK_LBDB_ON
1753+
#if 1
17541754
bool readyMigrate = false;
17551755
if (p.isPacking())
17561756
readyMigrate = myRec->isReadyMigrate();
@@ -1795,7 +1795,7 @@ CkMigratable::~CkMigratable()
17951795
prefetchObjID = -1;
17961796
}
17971797
#endif
1798-
#if CMK_LBDB_ON
1798+
#if 1
17991799
if (barrierRegistered)
18001800
{
18011801
DEBL((AA "Removing barrier for element %s\n" AB, idx2str(thisIndexMax)));
@@ -1832,7 +1832,7 @@ void CkMigratable::UserSetLBLoad()
18321832
CkAbort("::UserSetLBLoad() not defined for this array element!\n");
18331833
}
18341834

1835-
#if CMK_LBDB_ON // For load balancing:
1835+
#if 1 // For load balancing:
18361836
// user can call this helper function to set obj load (for model-based lb)
18371837
void CkMigratable::setObjTime(double cputime) { myRec->setObjTime(cputime); }
18381838
double CkMigratable::getObjTime() { return myRec->getObjTime(); }
@@ -2079,7 +2079,7 @@ CkLocRec::CkLocRec(CkLocMgr* mgr, bool fromMigration, bool ignoreArrival,
20792079
const CkArrayIndex& idx_, CmiUInt8 id_)
20802080
: myLocMgr(mgr), idx(idx_), id(id_), deletedMarker(NULL), running(false)
20812081
{
2082-
#if CMK_LBDB_ON
2082+
#if 1
20832083
DEBL((AA "Registering element %s with load balancer\n" AB, idx2str(idx)));
20842084
nextPe = -1;
20852085
asyncMigrate = false;
@@ -2109,7 +2109,7 @@ CkLocRec::~CkLocRec()
21092109
{
21102110
if (deletedMarker != NULL)
21112111
*deletedMarker = true;
2112-
#if CMK_LBDB_ON
2112+
#if 1
21132113
stopTiming();
21142114
DEBL((AA "Unregistering element %s from load balancer\n" AB, idx2str(idx)));
21152115
lbmgr->UnregisterObj(ldHandle);
@@ -2122,7 +2122,7 @@ void CkLocRec::migrateMe(int toPe) // Leaving this processor
21222122
myLocMgr->emigrate(this, toPe);
21232123
}
21242124

2125-
#if CMK_LBDB_ON
2125+
#if 1
21262126
void CkLocRec::startTiming(int ignore_running)
21272127
{
21282128
if (!ignore_running)
@@ -2196,7 +2196,7 @@ bool CkLocRec::invokeEntry(CkMigratable* obj, void* msg, int epIdx, bool doFree)
21962196
}
21972197
}
21982198
#endif
2199-
#if CMK_LBDB_ON
2199+
#if 1
22002200
if (!isDeleted)
22012201
checkBufferedMigration(); // check if should migrate
22022202
#endif
@@ -2206,7 +2206,7 @@ bool CkLocRec::invokeEntry(CkMigratable* obj, void* msg, int epIdx, bool doFree)
22062206
return true;
22072207
}
22082208

2209-
#if CMK_LBDB_ON
2209+
#if 1
22102210

22112211
void CkLocRec::staticMetaLBResumeWaitingChares(LDObjHandle h, int lb_ideal_period)
22122212
{
@@ -2433,7 +2433,7 @@ CkLocMgr::CkLocMgr(CkArrayOptions opts)
24332433
compressor = ck::FixedArrayIndexCompressor::make(bounds);
24342434

24352435
// Find and register with the load balancer
2436-
#if CMK_LBDB_ON
2436+
#if 1
24372437
lbmgrID = _lbmgr;
24382438
metalbID = _metalb;
24392439
initLB(lbmgrID, metalbID);
@@ -2448,7 +2448,7 @@ CkLocMgr::CkLocMgr(CkMigrateMessage* m)
24482448

24492449
CkLocMgr::~CkLocMgr()
24502450
{
2451-
#if CMK_LBDB_ON
2451+
#if 1
24522452
syncBarrier->removeBeginReceiver(lbBarrierBeginReceiver);
24532453
syncBarrier->removeEndReceiver(lbBarrierEndReceiver);
24542454
lbmgr->UnregisterOM(myLBHandle);
@@ -2489,7 +2489,7 @@ void CkLocMgr::pup(PUP::er& p)
24892489
compressor = ck::FixedArrayIndexCompressor::make(bounds);
24902490
}
24912491

2492-
#if CMK_LBDB_ON
2492+
#if 1
24932493
p | lbmgrID;
24942494
p | metalbID;
24952495
if (p.isUnpacking())
@@ -2997,7 +2997,7 @@ void CkLocMgr::emigrate(CkLocRec* rec, int toPe)
29972997
// Allocate and pack into message
29982998
CkArrayElementMigrateMessage* msg = new (bufSize, 0)
29992999
CkArrayElementMigrateMessage(idx, id,
3000-
#if CMK_LBDB_ON
3000+
#if 1
30013001
rec->isAsyncMigrate(),
30023002
#else
30033003
false,
@@ -3032,7 +3032,7 @@ void CkLocMgr::emigrate(CkLocRec* rec, int toPe)
30323032
cache->recordEmigration(id, toPe);
30333033
informHome(idx, toPe);
30343034

3035-
#if !CMK_LBDB_ON && CMK_GLOBAL_LOCATION_UPDATE
3035+
#if !1 && CMK_GLOBAL_LOCATION_UPDATE
30363036
DEBM((AA "Global location update. idx %s "
30373037
"assigned to %d \n" AB,
30383038
idx2str(idx), toPe));
@@ -3042,7 +3042,7 @@ void CkLocMgr::emigrate(CkLocRec* rec, int toPe)
30423042
CK_MAGICNUMBER_CHECK
30433043
}
30443044

3045-
#if CMK_LBDB_ON
3045+
#if 1
30463046
void CkLocMgr::informLBPeriod(CkLocRec* rec, int lb_ideal_period)
30473047
{
30483048
callMethod(rec, &CkMigratable::recvLBPeriod, (void*)&lb_ideal_period);
@@ -3216,13 +3216,13 @@ unsigned int CkLocMgr::numLocalElements()
32163216

32173217
/********************* LocMgr: LOAD BALANCE ****************/
32183218

3219-
#if !CMK_LBDB_ON
3219+
#if !1
32203220
// Empty versions of all load balancer calls
32213221
void CkLocMgr::startInserting(void) {}
32223222
void CkLocMgr::doneInserting(void) {}
32233223
#endif
32243224

3225-
#if CMK_LBDB_ON
3225+
#if 1
32263226
void CkLocMgr::initLB(CkGroupID lbmgrID_, CkGroupID metalbID_)
32273227
{ // Find and register with the load balancer
32283228
lbmgr = (LBManager*)CkLocalBranch(lbmgrID_);

src/ck-core/cklocation.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CkArrayMessage : public CkMessage
4646
};
4747

4848
/* Utility */
49-
//#if CMK_LBDB_ON
49+
//#if 1
5050
#include "LBManager.h"
5151
#include "MetaBalancer.h"
5252
//#endif
@@ -465,7 +465,7 @@ class CkLocMgr : public IrrGroup
465465
void callMethod(CkLocRec* rec, CkMigratable_voidfn_arg_t fn, void*);
466466
void callMethod(CkLocRec* rec, CkMigratable_voidfn_t fn);
467467

468-
#if CMK_LBDB_ON
468+
#if 1
469469
CkGroupID lbmgrID;
470470
CkGroupID metalbID;
471471
CkSyncBarrier* syncBarrier;
@@ -680,7 +680,7 @@ class CkLocMgr : public IrrGroup
680680
void informLBPeriod(CkLocRec* rec, int lb_ideal_period);
681681
void metaLBCallLB(CkLocRec* rec);
682682

683-
#if CMK_LBDB_ON
683+
#if 1
684684
LBManager* getLBMgr(void) const { return lbmgr; }
685685
MetaBalancer* getMetaBalancer(void) const { return the_metalb; }
686686
const LDOMHandle& getOMHandle(void) const { return myLBHandle; }

src/ck-core/ckmemcheckpoint.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ public:
864864
// restore the bitmap vector for LB
865865
void CkMemCheckPT::resetLB(int diepe)
866866
{
867-
#if CMK_LBDB_ON
867+
#if 1
868868
int i;
869869
std::vector<char> bitmap;
870870
// set processor available bitmap

src/ck-core/ckmigratable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class CkMigratable : public Chare {
9494

9595
void ReadyMigrate(bool ready);
9696
//void ckFinishConstruction(int epoch = -1);
97-
void ckFinishConstruction(int epoch = -1) { } //reconverse
97+
void ckFinishConstruction(int epoch = -1); //reconverse
9898
void setMigratable(int migratable);
9999
void setPupSize(size_t obj_pup_size);
100100
#else

src/ck-core/ckmulticast.C

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ mCastEntry::mCastEntry (mCastEntry *old):
282282
parentGrp = old->parentGrp;
283283
allElem = old->allElem;
284284
allGrpElem = old->allGrpElem;
285-
#if CMK_LBDB_ON
285+
#if 1
286286
allObjKeys = old->allObjKeys;
287287
#endif
288288
pe = old->pe;
@@ -311,7 +311,7 @@ void CkMulticastMgr::setSection(CkSectionInfo &_id, CkArrayID aid, CkArrayIndex
311311
entry->allObjKeys.reserve(n);
312312
for (int i=0; i<n; i++) {
313313
entry->allElem[i] = al[i];
314-
#if CMK_LBDB_ON
314+
#if 1
315315
CmiUInt8 _key;
316316
if(CProxy_ArrayBase(aid).ckLocMgr()->lookupID(al[i], _key))
317317
entry->allObjKeys.push_back(_key);
@@ -350,7 +350,7 @@ void CkMulticastMgr::setSection(CProxySection_ArrayElement &proxy)
350350
entry->allObjKeys.reserve(proxy.ckGetNumElements());
351351
for (int i=0; i<proxy.ckGetNumElements(); i++) {
352352
entry->allElem[i] = al[i];
353-
#if CMK_LBDB_ON
353+
#if 1
354354
CmiUInt8 _key;
355355
if(CProxy_ArrayBase(aid).ckLocMgr()->lookupID(al[i], _key))
356356
entry->allObjKeys.push_back(_key);
@@ -407,7 +407,7 @@ void CkMulticastMgr::prepareCookie(mCastEntry *entry, CkSectionID &sid, const Ck
407407
entry->allObjKeys.reserve(count);
408408
for (int i=0; i<count; i++) {
409409
entry->allElem[i] = al[i];
410-
#if CMK_LBDB_ON
410+
#if 1
411411
CmiUInt8 _key;
412412
if(CProxy_ArrayBase(aid).ckLocMgr()->lookupID(al[i], _key))
413413
entry->allObjKeys.push_back(_key);
@@ -931,7 +931,7 @@ void CkMulticastMgr::sendToSection(CkDelegateData *pd,int ep,void *m, CkSectionI
931931
s.get_val() = entry;
932932
}
933933

934-
#if CMK_LBDB_ON
934+
#if 1
935935
if(!entry->isGrpSec()){
936936
// fixme: running obj?
937937
envelope *env = UsrToEnv(msg);

src/ck-ldb/BaseLB.C

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "BaseLB.h"
88
#include "LBSimulation.h"
99

10-
#if CMK_LBDB_ON
10+
#if 1
1111

1212
void BaseLB::initLB(const CkLBOptions &opt) {
1313
seqno = opt.getSeqNo();
@@ -44,14 +44,14 @@ void BaseLB::flushStates() {}
4444

4545
void BaseLB::turnOn()
4646
{
47-
#if CMK_LBDB_ON
47+
#if 1
4848
lbmgr->TurnOnStartLBFn(startLbFnHdl);
4949
#endif
5050
}
5151

5252
void BaseLB::turnOff()
5353
{
54-
#if CMK_LBDB_ON
54+
#if 1
5555
lbmgr->TurnOffStartLBFn(startLbFnHdl);
5656
#endif
5757
}
@@ -168,7 +168,7 @@ void BaseLB::LDStats::deleteCommHash() {
168168

169169
int BaseLB::LDStats::getHash(const CmiUInt8 &oid, const LDOMid &mid)
170170
{
171-
#if CMK_LBDB_ON
171+
#if 1
172172
CmiAssert(hashSize > 0);
173173
int hash = ObjKey(oid, hashSize);
174174

@@ -215,7 +215,7 @@ void BaseLB::LDStats::clearCommHash() {
215215

216216
void BaseLB::LDStats::computeNonlocalComm(int &nmsgs, int &nbytes)
217217
{
218-
#if CMK_LBDB_ON
218+
#if 1
219219
nmsgs = 0;
220220
nbytes = 0;
221221

@@ -295,7 +295,7 @@ void BaseLB::LDStats::normalize_speed() {
295295

296296
void BaseLB::LDStats::print()
297297
{
298-
#if CMK_LBDB_ON
298+
#if 1
299299
int i = 0;
300300
CkPrintf("------------- Processor Data: %zu -------------\n", procs.size());
301301
for (const auto& proc : procs)

src/ck-ldb/BaseLB.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ class LBVectorMigrateMsg : public CMessage_LBVectorMigrateMsg {
272272
// sequence ticket,
273273
// AllocateFooLB(): allocate the class instead of a BOC
274274
// static void lbinit(): an init call for charm module registration
275-
#if CMK_LBDB_ON
275+
#if 1
276276

277277
# define CreateLBFunc_Def(x, str) \
278278
CMK_DEPRECATED_MSG("Use LBRegisterBalancer() instead of CreateLBFunc_Def()") \

0 commit comments

Comments
 (0)