Fix the potential problem in neighbor seed balancer, which is that when converse...
authorYanhua Yanhua <sun51@illinois.edu>
Thu, 29 Jul 2010 21:00:35 +0000 (16:00 -0500)
committerYanhua Yanhua <sun51@illinois.edu>
Thu, 29 Jul 2010 21:00:35 +0000 (16:00 -0500)
src/ck-core/init.C
src/conv-ldb/cldb.neighbor.c

index 7fd598cc02077ee635494d5c8c341ea29e312153..904764d052457135aed42fcd626d8fbe56f7723d 100644 (file)
@@ -1213,7 +1213,7 @@ void _initCharm(int unused_argc, char **argv)
         }
         CmiInitCPUTopology(argv);
     }
-    //CldCallback();
+    CldCallback();
 #if CMK_BLUEGENE_CHARM && CMK_CHARMDEBUG
       // Register the BG handler for CCS. Notice that this is put into a variable shared by
       // the whole real processor. This because converse needs to find it. We check that all
index 2dfb5ffcb85b0e3e2b641ded47b332b3092fd966..bb98d9991768daa437caec620c2dca3074ddcf9c 100644 (file)
@@ -44,6 +44,8 @@ CpvStaticDeclare(int, MinProc);
 CpvStaticDeclare(int, Mindex);
 CpvStaticDeclare(int, start);
 
+CpvStaticDeclare(int, topologyReady);
+
 void LoadNotifyFn(int l)
 {
   CldProcInfo  cldData = CpvAccess(CldData);
@@ -190,20 +192,17 @@ int CldMinAvg()
 {
   int sum=0, i;
 
+
   int nNeighbors = CpvAccess(numNeighbors);
   
+  if(CpvAccess(topologyReady) == 0 || nNeighbors == 0)
+      return CmiMyPe();
 #ifdef YHDEBUG
   CmiPrintf("Line 196 processor %d, numNeighbor=%d\n", CmiMyPe(), nNeighbors);
 #endif
   if (CpvAccess(start) == -1)
     CpvAccess(start) = CmiMyPe() % nNeighbors;
 
-#if 0
-    /* update load from neighbors for multicore */
-  for (i=0; i<nNeighbors; i++) {
-    CpvAccess(neighbors)[i].load = CldLoadRank(CpvAccess(neighbors)[i].pe);
-  }
-#endif
   CpvAccess(MinProc) = CpvAccess(neighbors)[CpvAccess(start)].pe;
   CpvAccess(MinLoad) = CpvAccess(neighbors)[CpvAccess(start)].load;
   sum = CpvAccess(neighbors)[CpvAccess(start)].load;
@@ -684,12 +683,6 @@ void CldGraphModuleInit(char **argv)
     else fclose(fp);
     CldReadNeighborData();
 #endif
-    CldComputeNeighborData();
-#if CMK_MULTICORE
-    CmiNodeBarrier();
-#endif
-    CldBalancePeriod(NULL, CmiWallTimer());
-
 
   }
 
@@ -710,6 +703,7 @@ void CldGraphModuleInit(char **argv)
 void CldCallback()
 {
     CldComputeNeighborData();
+    CpvAccess(topologyReady) = 1;
 #if CMK_MULTICORE
     CmiNodeBarrier();
 #endif
@@ -723,9 +717,11 @@ void CldModuleInit(char **argv)
   CpvInitialize(int, CldRelocatedMessages);
   CpvInitialize(int, CldLoadBalanceMessages);
   CpvInitialize(int, CldMessageChunks);
+  CpvInitialize(int, topologyReady);
   CpvAccess(CldHandlerIndex) = CmiRegisterHandler(CldHandler);
   CpvAccess(CldRelocatedMessages) = CpvAccess(CldLoadBalanceMessages) = 
   CpvAccess(CldMessageChunks) = 0;
+  CpvAccess(topologyReady) = 0;
 
   CldModuleGeneralInit(argv);
   CldGraphModuleInit(argv);