Modified global location update scheme to use migration data sent
authorLukasz Wesolowski <wesolwsk@illinois.edu>
Wed, 19 Sep 2012 04:20:24 +0000 (23:20 -0500)
committerLukasz Wesolowski <wesolwsk@illinois.edu>
Wed, 19 Sep 2012 04:23:25 +0000 (23:23 -0500)
by the load balancer.

src/ck-core/cklocation.C
src/ck-ldb/CentralLB.C
src/ck-ldb/lbdb.h

index d36d428a72a13cd8a7ab916c5c05db7bd223e6bd..ecd3dc6936a32ef33ee3b26c51ca367c5be4010f 100644 (file)
@@ -18,6 +18,9 @@
 
 #if CMK_LBDB_ON
 #include "LBDatabase.h"
+#if CMK_GLOBAL_LOCATION_UPDATE
+#include "BaseLB.h"
+#endif
 #endif // CMK_LBDB_ON
 
 #if CMK_GRID_QUEUE_AVAILABLE
@@ -82,8 +85,32 @@ LDObjid idx2LDObjid(const CkArrayIndex &idx)
         r.id[j]+=circleShift(data[i],22+11*i*(j+1))+
           circleShift(data[i],21-9*i*(j+1));
   }
+
+#if CMK_GLOBAL_LOCATION_UPDATE
+  r.dimension = idx.dimension;
+  r.nInts = idx.nInts; 
+#endif
+
   return r;
 }
+
+#if CMK_GLOBAL_LOCATION_UPDATE
+void UpdateLocation(MigrateInfo& migData) {
+
+  CkArrayIndex idx; 
+  idx.dimension = migData.obj.id.dimension; 
+  idx.nInts = migData.obj.id.nInts; 
+
+  for (int i = 0; i < idx.nInts; i++) {
+    idx.data()[i] = migData.obj.id.id[i];    
+  }
+
+  CkLocMgr *localLocMgr = 
+    (CkLocMgr *) CkLocalBranch(migData.obj.omhandle.id.id); 
+  localLocMgr->updateLocation(idx, migData.to_pe); 
+}
+#endif
+
 #endif
 
 /*********************** Array Messages ************************/
@@ -1881,7 +1908,9 @@ CkLocMgr::CkLocMgr(CkGroupID mapID_,CkGroupID lbdbID_,CkArrayIndex& numInitial)
        firstFree=localLen=0;
        duringMigration=CmiFalse;
        nSprings=0;
+#if !CMK_GLOBAL_LOCATION_UPDATE
        CcdCallOnConditionKeepOnPE(CcdPERIODIC_1minute,staticSpringCleaning,(void *)this, CkMyPe());
+#endif
 
 //Register with the map object
        mapID=mapID_;
@@ -1904,7 +1933,9 @@ CkLocMgr::CkLocMgr(CkMigrateMessage* m)
        firstFree=localLen=0;
        duringMigration=CmiFalse;
        nSprings=0;
+#if !CMK_GLOBAL_LOCATION_UPDATE
        CcdCallOnConditionKeepOnPE(CcdPERIODIC_1minute,staticSpringCleaning,(void *)this, CkMyPe());
+#endif
        hashImmLock = CmiCreateImmediateLock();
 }
 
@@ -2432,6 +2463,7 @@ CmiBool CkLocMgr::demandCreateElement(CkArrayMessage *msg,int onPe,CkDeliver_t t
 //This message took several hops to reach us-- fix it
 void CkLocMgr::multiHop(CkArrayMessage *msg)
 {
+
        CK_MAGICNUMBER_CHECK
        int srcPe=msg->array_getSrcPe();
        if (srcPe==CkMyPe())
@@ -2687,10 +2719,12 @@ void CkLocMgr::emigrate(CkLocRec_local *rec,int toPe)
        inform(idx,toPe);
 //#if (!defined(_FAULT_MLOG_) && !defined(_FAULT_CAUSAL_))    
 //#if !defined(_FAULT_MLOG_)    
+#if !CMK_GLOBAL_LOCATION_UPDATE
        informHome(idx,toPe);
+#endif
 //#endif
 
-#if CMK_GLOBAL_LOCATION_UPDATE
+#if !CMK_LDB_ON && CMK_GLOBAL_LOCATION_UPDATE
         DEBM((AA"Global location update. idx %s " 
               "assigned to %d \n"AB,idx2str(idx),toPe));
         thisProxy.updateLocation(idx, toPe);                        
index d847e124b2ed31a966359c3c602b12e6516057cf..3c216822fa78a2329ddc8d5db4e52613497fee52 100644 (file)
@@ -34,6 +34,10 @@ extern void sendDummyMigrationCounts(int *);
 CpvExtern(void *, CkGridObject);
 #endif
 
+#if CMK_GLOBAL_LOCATION_UPDATE      
+extern void UpdateLocation(MigrateInfo& migData); 
+#endif
+
 CkGroupID loadbalancer;
 int * lb_ptr;
 int load_balancer_created;
@@ -842,6 +846,12 @@ void CentralLB::ProcessReceiveMigration(CkReductionMsg  *msg)
       if (!move.async_arrival) migrates_expected++;
       else future_migrates_expected++;
     }
+    else {
+#if CMK_GLOBAL_LOCATION_UPDATE      
+      UpdateLocation(move); 
+#endif
+    }
+
   }
   DEBUGF(("[%d] in ReceiveMigration %d moves expected: %d future expected: %d\n",CkMyPe(),m->n_moves, migrates_expected, future_migrates_expected));
   // if (_lb_debug) CkPrintf("[%d] expecting %d objects migrating.\n", CkMyPe(), migrates_expected);
index cb1f7a199acbc7b7bf7303c6fb7b869c3e597233..dc304fd5a4b54b4983430555467d5fa834e0f29f 100644 (file)
@@ -65,6 +65,10 @@ typedef struct {
 
 typedef struct _LDObjid {
   int id[OBJ_ID_SZ];
+#if CMK_GLOBAL_LOCATION_UPDATE
+  short dimension; 
+  short nInts;
+#endif
   CmiBool operator==(const struct _LDObjid& objid) const {
     for (int i=0; i<OBJ_ID_SZ; i++) if (id[i] != objid.id[i]) return CmiFalse;
     return CmiTrue;
@@ -363,6 +367,10 @@ PUPmarshall(LDOMid)
 
 inline void LDObjid::pup(PUP::er &p) {
   for (int i=0; i<OBJ_ID_SZ; i++) p|id[i];
+#if CMK_GLOBAL_LOCATION_UPDATE
+  p|dimension;
+  p|nInts;
+#endif
 }
 PUPmarshall(LDObjid)