Skip to content

Commit 7401d78

Browse files
Changes to fix reset
1 parent befb24b commit 7401d78

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

src/libs/ck-libs/collide/collidecharm.C

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ void CollisionAggregator::compact(void)
314314

315315
/********************* syncReductionMgr ******************/
316316
syncReductionMgr::syncReductionMgr()
317-
:thisproxy(thisgroup)
318317
{
319318
stepCount=-1;
320319
stepFinished=true;
@@ -339,10 +338,12 @@ void syncReductionMgr::startStep(int stepNo,bool withProd)
339338
stepFinished=false;
340339
localFinished=false;
341340
childrenCount=0;
342-
if (nChildren>0)
341+
if (nChildren>0) {
342+
CProxy_syncReductionMgr proxy(ckGetGroupID());
343343
for (int i=0;i<TREE_WID;i++)
344344
if (treeChildStart+i<CkNumPes())
345-
thisproxy[treeChildStart+i].childProd(stepCount);
345+
proxy[treeChildStart+i].childProd(stepCount);
346+
}
346347
if (withProd)
347348
pleaseAdvance();//Advise subclass to advance
348349
}
@@ -373,7 +374,7 @@ void syncReductionMgr::tryFinish(void) //Try to finish reduction
373374
{
374375
stepFinished=true;
375376
if (treeParent!=-1)
376-
thisproxy[treeParent].childDone(stepCount);
377+
CProxy_syncReductionMgr(ckGetGroupID())[treeParent].childDone(stepCount);
377378
else
378379
reductionFinished();
379380
}
@@ -437,7 +438,7 @@ static const char * voxName(const CkIndex3D &idx,char *buf) {
437438
collideMgr::collideMgr(const CollideGrid3d &gridMap_,
438439
const CProxy_collideClient &client_,
439440
const CProxy_collideVoxel &voxels)
440-
:thisproxy(thisgroup), voxelProxy(voxels),
441+
:voxelProxy(voxels),
441442
gridMap(gridMap_), client(client_), aggregator(gridMap,this)
442443
{
443444
steps=0;

src/libs/ck-libs/collide/collidecharm_impl.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ class CollisionAggregator {
9696
*/
9797
class syncReductionMgr : public CBase_syncReductionMgr
9898
{
99-
CProxy_syncReductionMgr thisproxy;
10099
void status(const char *msg) {
101100
CkPrintf("SRMgr pe %d> %s\n",CkMyPe(),msg);
102101
}
@@ -176,6 +175,11 @@ class collideMgr : public CBase_collideMgr
176175
collideMgr(CkMigrateMessage* m);
177176

178177
void pup(PUP::er &p) {
178+
// thisgroup is a protected member of IrrGroup. It is not saved/restored
179+
// by the migrate constructor, so we do it here. syncReductionMgr uses
180+
// CProxy_syncReductionMgr(ckGetGroupID()) at call time, which requires
181+
// thisgroup to be valid when startStep()/tryFinish() are invoked.
182+
p | thisgroup;
179183
p | thisproxy;
180184
//p | steps;
181185
p | voxelProxy;
@@ -246,6 +250,10 @@ class serialCollideClient : public collideClient {
246250
serialCollideClient(CkCallback clientCb_);
247251
serialCollideClient(CkMigrateMessage *m);
248252
void pup(PUP::er &p) {
253+
// thisgroup must be saved: collisions() uses it to construct the
254+
// reduction callback CkCallback(..., thisgroup). Without this, thisgroup
255+
// is 0 after restart and the callback targets a non-existent group.
256+
p | thisgroup;
249257
p | useCb;
250258
}
251259

0 commit comments

Comments
 (0)