Example #1
0
// handle GroupTable and data
void CkPupGroupData(PUP::er &p, CmiBool create)
{
	int numGroups, i;

	if (!p.isUnpacking()) {
	  numGroups = CkpvAccess(_groupIDTable)->size();
	}
	p|numGroups;
	if (p.isUnpacking()) {
	  if(CkMyPe()==0)  
            CkpvAccess(_numGroups) = numGroups+1; 
          else 
	    CkpvAccess(_numGroups) = 1;
	}
	DEBCHK("[%d] CkPupGroupData %s: numGroups = %d\n", CkMyPe(),p.typeString(),numGroups);

	GroupInfo *tmpInfo = new GroupInfo [numGroups];
	if (!p.isUnpacking()) {
	  for(i=0;i<numGroups;i++) {
		tmpInfo[i].gID = (*CkpvAccess(_groupIDTable))[i];
		TableEntry ent = CkpvAccess(_groupTable)->find(tmpInfo[i].gID);
		tmpInfo[i].MigCtor = _chareTable[ent.getcIdx()]->migCtor;
		tmpInfo[i].DefCtor = _chareTable[ent.getcIdx()]->defCtor;
		strncpy(tmpInfo[i].name,_chareTable[ent.getcIdx()]->name,255);
		//CkPrintf("[%d] CkPupGroupData: %s group %s \n", CkMyPe(), p.typeString(), tmpInfo[i].name);

		if(tmpInfo[i].MigCtor==-1) {
			char buf[512];
			sprintf(buf,"Group %s needs a migration constructor and PUP'er routine for restart.\n", tmpInfo[i].name);
			CkAbort(buf);
		}
	  }
  	}
	for (i=0; i<numGroups; i++) p|tmpInfo[i];

	for(i=0;i<numGroups;i++) 
	{
	  CkGroupID gID = tmpInfo[i].gID;
	  if (p.isUnpacking()) {
	    //CkpvAccess(_groupIDTable)->push_back(gID);
	    int eIdx = tmpInfo[i].MigCtor;
	    // error checking
	    if (eIdx == -1) {
	      CkPrintf("[%d] ERROR> Group %s's migration constructor is not defined!\n", CkMyPe(), tmpInfo[i].name); CkAbort("Abort");
	    }
	    void *m = CkAllocSysMsg();
	    envelope* env = UsrToEnv((CkMessage *)m);
		if(create)
		    CkCreateLocalGroup(gID, eIdx, env);
	  }   // end of unPacking
	  IrrGroup *gobj = CkpvAccess(_groupTable)->find(gID).getObj();
	  // if using migration constructor, you'd better have a pup
	  	if(!create)
			gobj->mlogData->teamRecoveryFlag = 1;
          gobj->pup(p);
         // CkPrintf("Group PUP'ed: gid = %d, name = %s\n",gobj->ckGetGroupID().idx, tmpInfo[i].name);
	}
	delete [] tmpInfo;
}
Example #2
0
// handle NodeGroupTable and data
void CkPupNodeGroupData(PUP::er &p, CmiBool create)
{
	int numNodeGroups, i;
	if (!p.isUnpacking()) {
	  numNodeGroups = CksvAccess(_nodeGroupIDTable).size();
	}
	p|numNodeGroups;
	if (p.isUnpacking()) {
	  if(CkMyPe()==0){ CksvAccess(_numNodeGroups) = numNodeGroups+1; }
	  else { CksvAccess(_numNodeGroups) = 1; }
	}
	if(CkMyPe() == 3)
	CkPrintf("[%d] CkPupNodeGroupData %s: numNodeGroups = %d\n",CkMyPe(),p.typeString(),numNodeGroups);

	GroupInfo *tmpInfo = new GroupInfo [numNodeGroups];
	if (!p.isUnpacking()) {
	  for(i=0;i<numNodeGroups;i++) {
		tmpInfo[i].gID = CksvAccess(_nodeGroupIDTable)[i];
		TableEntry ent2 = CksvAccess(_nodeGroupTable)->find(tmpInfo[i].gID);
		tmpInfo[i].MigCtor = _chareTable[ent2.getcIdx()]->migCtor;
		if(tmpInfo[i].MigCtor==-1) {
			char buf[512];
			sprintf(buf,"NodeGroup %s either need a migration constructor and\n\
				     declared as [migratable] in .ci to be able to checkpoint.",\
				     _chareTable[ent2.getcIdx()]->name);
			CkAbort(buf);
		}
	  }
	}
	for (i=0; i<numNodeGroups; i++) p|tmpInfo[i];
	for (i=0;i<numNodeGroups;i++) {
		CkGroupID gID = tmpInfo[i].gID;
		if (p.isUnpacking()) {
			//CksvAccess(_nodeGroupIDTable).push_back(gID);
			int eIdx = tmpInfo[i].MigCtor;
			void *m = CkAllocSysMsg();
			envelope* env = UsrToEnv((CkMessage *)m);
			if(create){
				CkCreateLocalNodeGroup(gID, eIdx, env);
			}
		}
		TableEntry ent2 = CksvAccess(_nodeGroupTable)->find(gID);
		IrrGroup *obj = ent2.getObj();
		obj->pup(p);
		if(CkMyPe() == 3) CkPrintf("Nodegroup PUP'ed: gid = %d, name = %s\n",
			obj->ckGetGroupID().idx,
			_chareTable[ent2.getcIdx()]->name);
	}
	delete [] tmpInfo;
}
Example #3
0
// handle plain non-migratable chare
void CkPupChareData(PUP::er &p)
{
  int i, n;
  if (!p.isUnpacking()) n = CkpvAccess(chare_objs).size();
  p|n;
  for (i=0; i<n; i++) {
        int chare_type;
	if (!p.isUnpacking()) {
		chare_type = CkpvAccess(chare_types)[i];
	}
	p | chare_type;
	if (p.isUnpacking()) {
		int migCtor = _chareTable[chare_type]->migCtor;
		if(migCtor==-1) {
			char buf[512];
			sprintf(buf,"Chare %s needs a migration constructor and PUP'er routine for restart.\n", _chareTable[chare_type]->name);
			CkAbort(buf);
		}
	        void *m = CkAllocSysMsg();
	        envelope* env = UsrToEnv((CkMessage *)m);
		CkCreateLocalChare(migCtor, env);
		CkFreeSysMsg(m);
	}
	Chare *obj = (Chare*)CkpvAccess(chare_objs)[i];
	obj->pup(p);
  }

  if (!p.isUnpacking()) n = CkpvAccess(vidblocks).size();
  p|n;
  for (i=0; i<n; i++) {
	VidBlock *v;
	if (p.isUnpacking()) {
		v = new VidBlock();
		CkpvAccess(vidblocks).push_back(v);
	}
	else
		v = CkpvAccess(vidblocks)[i];
	v->pup(p);
  }
}
Example #4
0
void NullLB::AtSync()
{
  // tried to reset the database so it doesn't waste memory
  // if nobody else is here, the stat collection is not even turned on
  // so I should not have to clear loads.
//  theLbdb->ClearLoads();
  
  // disable the batsyncer if no balancer exists
  // theLbdb->SetLBPeriod(1e10);

#if ! NULLLB_CONVERSE
  // prevent this charm message from being seen by QD
  // so that the QD detection works
  CpvAccess(_qd)->create(-1);
  thisProxy[CkMyPe()].migrationsDone();
#else
  // send converse message to escape the QD detection
  envelope *env = UsrToEnv(CkAllocSysMsg());
  CmiSetHandler(env, _migDoneHandle);
  CmiSyncSendAndFree(CkMyPe(), env->getTotalsize(), (char *)env);
#endif
}