Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/ck-core/ck.C
Original file line number Diff line number Diff line change
Expand Up @@ -640,16 +640,17 @@ void CkCallstackPop(Chare *obj) {
_ckStartTiming(); // resume timing of the previous obj
}

#if CMK_LBDB_ON

CkLocRec *CkActiveLocRec(void) {
#if CMK_LBDB_ON
auto *obj = CkActiveObj();
if (obj && obj->ckInitialized) {
return obj->getCkLocRec();
} else {
return nullptr;
}
#endif
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function CkActiveLocRec has no return statement when CMK_LBDB_ON is disabled, which will cause undefined behavior. Add an explicit return statement for the disabled case, such as return nullptr; after the #endif.

Suggested change
#endif
#endif
return nullptr;

Copilot uses AI. Check for mistakes.
}
#endif

/******************** Basic support *****************/
void CkDeliverMessageFree(int epIdx,void *msg,void *obj)
Expand Down
2 changes: 0 additions & 2 deletions src/ck-core/ck.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,7 @@ class CkCoreState {

CkpvExtern(CkCoreState *, _coreState);

#if CMK_LBDB_ON
CkLocRec *CkActiveLocRec(void);
#endif // CMK_LBDB_ON

void CpdHandleLBMessage(LBMigrateMsg **msg);
void CkMessageWatcherInit(char **argv,CkCoreState *ck);
Expand Down
6 changes: 3 additions & 3 deletions src/ck-core/cklocrec.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class CkLocRec {
CmiUInt8 id;
bool *deletedMarker; /// Set this if we're deleted during processing
bool running; /// True when inside a startTiming/stopTiming pair
CkSyncBarrier* syncBarrier;
LDObjHandle ldHandle;
#if CMK_LBDB_ON
bool asyncMigrate; /// if readyMove is inited
bool readyMigrate; /// status whether it is ready to migrate
bool enable_measure;
int nextPe; /// next migration dest processor
CkSyncBarrier* syncBarrier;
LBManager *lbmgr;
MetaBalancer *the_metalb;
LDObjHandle ldHandle;
#endif

public:
Expand Down Expand Up @@ -63,7 +63,6 @@ class CkLocRec {
public:
inline LBManager *getLBMgr(void) const {return lbmgr;}
inline MetaBalancer *getMetaBalancer(void) const {return the_metalb;}
inline const LDObjHandle& getLdHandle() const{ return ldHandle; }
static void staticMigrate(LDObjHandle h, int dest);
static void staticMetaLBResumeWaitingChares(LDObjHandle h, int lb_ideal_period);
static void staticMetaLBCallLBOnChares(LDObjHandle h);
Expand All @@ -80,6 +79,7 @@ class CkLocRec {
#else
void AsyncMigrate(bool use){};
#endif
inline const LDObjHandle& getLdHandle() const{ return ldHandle; }
};

#endif // CK_LOC_REC_H
Expand Down
2 changes: 1 addition & 1 deletion src/ck-core/ckmigratable.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class CkMigratable : public Chare {
void setMigratable(int migratable) { }
void setPupSize(size_t obj_pup_size) { }
public:
void ckFinishConstruction(int epoch) { }
void ckFinishConstruction(int epoch = -1) { }
#endif

#if CMK_OUT_OF_CORE
Expand Down
9 changes: 4 additions & 5 deletions src/ck-ldb/LBObj.C
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
/*@{*/

#include <charm++.h>

#if CMK_LBDB_ON

#include "LBObj.h"
#include "LBOM.h"

#if CMK_LBDB_ON

/*************************************************************
* LBObj Object-data Code
*************************************************************/
Expand All @@ -30,6 +29,8 @@ void LBObj::Clear(void)
#endif
}

#endif

void LBObj::IncrementTime(LBRealType walltime, LBRealType cputime)
{
data.wallTime += walltime;
Expand All @@ -42,6 +43,4 @@ void LBObj::IncrementTime(LBRealType walltime, LBRealType cputime)
#endif
}

#endif

/*@}*/
Loading