Merge branch 'charm' of git://charm.cs.illinois.edu/charm into charm
authorNikhil Jain <nikhilj@bp-login1.(none)>
Tue, 8 Mar 2011 23:00:03 +0000 (17:00 -0600)
committerNikhil Jain <nikhilj@bp-login1.(none)>
Tue, 8 Mar 2011 23:00:03 +0000 (17:00 -0600)
src/ck-ldb/MetisLB.C
src/ck-ldb/ScotchLB.C
src/ck-ldb/ckgraph.h

index 964869a8362b94cd2a9f76e2a8c657298194f10e..eb57e86a47193e9d156ea5b800b450a9929e85f6 100644 (file)
@@ -65,8 +65,10 @@ void MetisLB::work(LDStats* stats)
     for(j = 0; j < ogr->vertices[i].sendToList.size(); j++) {
       vert = ogr->vertices[i].sendToList[j].getNeighborId();
       for(k = 0; k < ogr->vertices[i].recvFromList.size(); k++) {
-       if(ogr->vertices[i].recvFromList[k].getNeighborId() == vert)
+       if(ogr->vertices[i].recvFromList[k].getNeighborId() == vert) {
+         ogr->vertices[i].sendToList[j].setNumBytes(ogr->vertices[i].sendToList[j].getNumBytes() + ogr->vertices[i].recvFromList[k].getNumBytes());
          ogr->vertices[i].recvFromList.erase(ogr->vertices[i].recvFromList.begin() + k);
+        }
       }
     }
   }
index e6256e2b6bb082f2217541dfc8be6f41994eee04..f6f34fb09c1c7757d1a7d11962de25244f2545bd 100644 (file)
@@ -46,8 +46,10 @@ void ScotchLB::work(LDStats *stats) {
     for(j = 0; j < ogr->vertices[i].sendToList.size(); j++) {
       vert = ogr->vertices[i].sendToList[j].getNeighborId();
       for(k = 0; k < ogr->vertices[i].recvFromList.size(); k++) {
-       if(ogr->vertices[i].recvFromList[k].getNeighborId() == vert)
-         ogr->vertices[i].recvFromList.erase(ogr->vertices[i].recvFromList.begin() + k);
+       if(ogr->vertices[i].recvFromList[k].getNeighborId() == vert) {
+          ogr->vertices[i].sendToList[j].setNumBytes(ogr->vertices[i].sendToList[j].getNumBytes() + ogr->vertices[i].recvFromList[k].getNumBytes());
+          ogr->vertices[i].recvFromList.erase(ogr->vertices[i].recvFromList.begin() + k);
+        }
       }
     }
   }
@@ -108,12 +110,18 @@ void ScotchLB::work(LDStats *stats) {
 
   SCOTCH_graphExit (&graph);
   SCOTCH_stratExit (&strat);
+  free(verttab);
+  free(velotab);
+  free(edgetab);
+  free(edlotab);
 
   for(i = baseval; i < vertnbr; i++) {
     if(pemap[i] != ogr->vertices[i].getCurrentPe())
       ogr->vertices[i].setNewPe(pemap[i]);
   }
 
+  free(pemap);
   /** ============================== CLEANUP ================================ */
   ogr->convertDecisions(stats);
 }
index 9eb6bf61e7d151c03810be51ea7658a203a12f49..bc8875f776a17960bb99a79af3217421698a0f6a 100644 (file)
@@ -59,6 +59,7 @@ class Edge {
     inline int getNeighborId() { return id; }
     inline int getNumMsgs() { return msgs; }
     inline int getNumBytes() { return bytes; }
+    inline void setNumBytes(int _bytes) { bytes = _bytes; }
 
   private:
     int id;            // id of the neighbor = index of the neighbor vertex