Clean up
authorNikhil Jain <nikhil@illinois.edu>
Tue, 25 Oct 2011 02:53:48 +0000 (21:53 -0500)
committerNikhil Jain <nikhil@illinois.edu>
Tue, 25 Oct 2011 02:53:48 +0000 (21:53 -0500)
Request.cpp
State.cpp
State.h
Traversal_defs.h
TreePiece.cpp
Worker.cpp

index 9cb7c5c..3e15f43 100644 (file)
@@ -48,12 +48,6 @@ void Request::deliverNode(){
       traversal->topDownTraversal(firstChild+j,worker,state);
     }
 
-    /*
-    CkPrintf("(%d,%d) deliverNode bucket %lu done\n", state->ownerTreePiece->getIndex(), 
-                                                      state->ownerTreePiece->getIteration(),
-                                                      ((Node<ForceData> *)req.context)->getKey());
-    */
-
     worker->setContext(saveContext);
     if(state->decrPending()){
       worker->done();
index 89ca0c2..2e8cdcc 100644 (file)
--- a/State.cpp
+++ b/State.cpp
@@ -3,39 +3,21 @@
 #include "TreePiece.h"
 
 void State::nodeEncountered(Key bucketKey, Node<ForceData> *node){
-#ifdef VERBOSE_TRAVERSAL
-  CkPrintf("(%d,%d) %s bucket %lu encountered node %lu type %s radius %f\n", ownerTreePiece->getIndex(), ownerTreePiece->getIteration(), description.c_str(), bucketKey, node->getKey(), NodeTypeString[node->getType()].c_str(), node->data.moments.radius);
-#endif
 }
 
 void State::nodeOpened(Key bucketKey, Node<ForceData> *node){
-#ifdef VERBOSE_TRAVERSAL
-  CkPrintf("(%d,%d) %s bucket %lu opened node %lu type %s \n", ownerTreePiece->getIndex(), ownerTreePiece->getIteration(), description.c_str(), bucketKey, node->getKey(), NodeTypeString[node->getType()].c_str());
-#endif
 }
 
 void State::nodeDiscarded(Key bucketKey, Node<ForceData> *node){
-#ifdef VERBOSE_TRAVERSAL
-  CkPrintf("(%d,%d) %s bucket %lu discarding node %lu\n", ownerTreePiece->getIndex(), ownerTreePiece->getIteration(), description.c_str(), bucketKey, node->getKey());
-#endif
-
   insert(bucketKey,node->getKey());
 }
 
 void State::nodeComputed(Node<ForceData> *bucket, Key nodeKey){
-#ifdef VERBOSE_TRAVERSAL
-  string nanStr = "";
-  CkPrintf("(%d,%d) %s bucket %lu (%s) computing node %lu\n", ownerTreePiece->getIndex(), ownerTreePiece->getIteration(), description.c_str(), bucket->getKey(), nanStr.c_str(), nodeKey);
-#endif
-  insert(bucket->getKey(),nodeKey);
+ insert(bucket->getKey(),nodeKey);
 }
 
 void State::bucketComputed(Node<ForceData> *bucket, Key k){
-#ifdef VERBOSE_TRAVERSAL
-  string nanStr = "";
-  CkPrintf("(%d,%d) %s bucket %lu (%s) computing bucket %lu\n", ownerTreePiece->getIndex(), ownerTreePiece->getIteration(), description.c_str(), bucket->getKey(), nanStr.c_str(), k);
-#endif
-  insert(bucket->getKey(),k);
+ insert(bucket->getKey(),k);
 }
 
 
diff --git a/State.h b/State.h
index 10bf8ad..cb23064 100644 (file)
--- a/State.h
+++ b/State.h
@@ -27,12 +27,6 @@ struct State {
   CmiUInt8 numInteractions[3];
 #endif
 
-#ifdef CHECK_NUM_INTERACTIONS
-  map<Key,CmiUInt8> bucketNodeInteractions;
-  map<Key,CmiUInt8> bucketPartInteractions;
-#endif
-
-
   void incrPending() { pending++; }
   bool decrPending() {
     pending--;
@@ -61,9 +55,7 @@ struct State {
   }
   
   void reset(TreePiece *owner, int p, Node<ForceData> **bucketPtr){
-  //void reset(TreePiece *owner, string &id, int p, Node<ForceData> **bucketPtr){
     ownerTreePiece = owner;
-    //description = id;
     pending = p;
     current = 0;
     currentBucketPtr = bucketPtr;
@@ -80,41 +72,21 @@ struct State {
     numInteractions[0] = 0;
     numInteractions[1] = 0;
     numInteractions[2] = 0;
-#endif
-#ifdef CHECK_NUM_INTERACTIONS
-    bucketNodeInteractions.clear();
-    bucketPartInteractions.clear();
 #endif
   }
 
   void insert(Key bucketKey, Key k){
-#ifdef DEBUG_TRAVERSALS
-    Key parentKey = (k>>1);
-    set<Key>::iterator it = bucketKeys[bucketKey].find(parentKey);
-    while(it != bucketKeys[bucketKey].end()){
-      bucketKeys[bucketKey].erase(it);
-      parentKey >>= 1;
-      it = bucketKeys[bucketKey].find(parentKey);
-    }
-    bucketKeys[bucketKey].insert(parentKey);
-#endif
   }
 
   void incrPartNodeInteractions(Key bucketKey, CmiUInt8 n){
 #ifdef STATISTICS
     numInteractions[0] += n;
-#endif
-#ifdef CHECK_NUM_INTERACTIONS
-    bucketNodeInteractions[bucketKey] += n;
 #endif
   }
 
   void incrPartPartInteractions(Key bucketKey, CmiUInt8 n){
 #ifdef STATISTICS
     numInteractions[1] += n;
-#endif
-#ifdef CHECK_NUM_INTERACTIONS
-    bucketPartInteractions[bucketKey] += n;
 #endif
   }
 
index 4143141..b04d98e 100644 (file)
@@ -24,39 +24,30 @@ void Traversal<T>::preorderTraversal(Node<T> *root, CutoffWorker<T> *worker){
 template<typename T>
 void Traversal<T>::topDownTraversal_local(Node<T> *root, CutoffWorker<T> *worker){
   stack<Node<T>*> ptrStk;
-  //CkPrintf("(%d) VISIT node %ld\n", CkMyPe(), getKey());
   int ret = worker->work(root);
   if(ret == 0) return;
 
   ptrStk.push(root); 
-  //CkPrintf("(%d) PUSH node %ld\n", CkMyPe(), getKey());
 
   Node<T> *tmp[BRANCH_FACTOR];
   int numChildrenToExpand;
-  //tmp.reserve(2);
 
   while(!ptrStk.empty()){
-    //pair<Node<T>*,int> pr = ptrStk.top();
     Node<T> *t_parent = ptrStk.top();
     Node<T> *t_children = t_parent->getChildren();
     int t_numChildren = t_parent->getNumChildren();
-    //CkPrintf("(%d) POP node %ld\n", CkMyPe(), t_parent->getKey());
     ptrStk.pop();
 
-    //tmp.length() = 0;
     numChildrenToExpand = 0;
     for(int i = 0; i < t_numChildren; i++){
       Node<T> *t_node = t_children+i;
-      //CkPrintf("(%d) VISIT node %ld\n", CkMyPe(), t_node->getKey());
       ret = worker->work(t_node);
       if(ret > 0 && t_node->getNumChildren() > 0){
-        //tmp.push_back(t_node);
         tmp[numChildrenToExpand] = t_node;
         numChildrenToExpand++;
       } 
     }
     for(int i = numChildrenToExpand-1; i >= 0; i--){
-      //CkPrintf("(%d) PUSH child %d key %ld\n", CkMyPe(), i, tmp[i]->getKey());
       ptrStk.push(tmp[i]);
     }
   }
@@ -65,26 +56,20 @@ void Traversal<T>::topDownTraversal_local(Node<T> *root, CutoffWorker<T> *worker
 template<typename T>
 void Traversal<T>::topDownTraversal(Node<T> *root, CutoffWorker<T> *worker, State *state){
   stack<Node<T>*> ptrStk;
-  //CkPrintf("(%d) VISIT node %ld\n", CkMyPe(), getKey());
   int ret = worker->work(root);
   if(ret == 0) return;
 
   ptrStk.push(root); 
-  //CkPrintf("(%d) PUSH node %ld\n", CkMyPe(), getKey());
 
   Node<T> *tmp[BRANCH_FACTOR];
   int numChildrenToExpand;
-  //tmp.reserve(2);
 
   while(!ptrStk.empty()){
-    //pair<Node<T>*,int> pr = ptrStk.top();
     Node<T> *t_parent = ptrStk.top();
     Node<T> *t_children = t_parent->getChildren();
     int t_numChildren = t_parent->getNumChildren();
-    //CkPrintf("(%d) POP node %ld\n", CkMyPe(), t_parent->getKey());
     ptrStk.pop();
 
-    //tmp.length() = 0;
     numChildrenToExpand = 0;
     if(t_numChildren == 0){
       processLeaf(t_parent,worker,state);
@@ -93,16 +78,13 @@ void Traversal<T>::topDownTraversal(Node<T> *root, CutoffWorker<T> *worker, Stat
 
     for(int i = 0; i < t_numChildren; i++){
       Node<T> *t_node = t_children+i;
-      //CkPrintf("(%d) VISIT node %ld\n", CkMyPe(), t_node->getKey());
       ret = worker->work(t_node);
       if(ret > 0){
-        //tmp.push_back(t_node);
         tmp[numChildrenToExpand] = t_node;
         numChildrenToExpand++;
       }
     }
     for(int i = numChildrenToExpand-1; i >= 0; i--){
-      //CkPrintf("(%d) PUSH child %d key %ld\n", CkMyPe(), i, tmp[i]->getKey());
       ptrStk.push(tmp[i]);
     }
   }
@@ -160,7 +142,6 @@ void Traversal<T>::postorderTraversal(Node<T> *root, CutoffWorker<T> *worker){
   nstk.push(root);
 
   while(!cstk.empty()){
-    //pair<Node<T>*,int> cpair = cstk.top();
     Node<T> *c_node = cstk.top();
     Node<T> *n_node = nstk.top();
 
index e82ff52..6c70195 100644 (file)
@@ -25,7 +25,6 @@ TreePiece::TreePiece() :
   numTraversalsDone(0)
 {
   myDM = dataManagerProxy.ckLocalBranch();
-  //usesAtSync = true;
 }
 
 void TreePiece::receiveParticles(ParticleMsg *msg){
@@ -127,12 +126,10 @@ void TreePiece::doRemoteGravity(RescheduleMsg *msg){
 }
 
 void TreePiece::localGravityDone(){
-  //CkPrintf("[%d] iter %d done local gravity state bucket %d/%d\n",thisIndex,getIteration(),localTraversalState.current,myNumBuckets);
   traversalDone();
 }
 
 void TreePiece::remoteGravityDone(){ 
-  //CkPrintf("[%d] iter %d done local gravity state bucket %d/%d\n",thisIndex,getIteration(),remoteTraversalState.current,myNumBuckets);
   traversalDone();
 }
 
@@ -144,34 +141,6 @@ void TreePiece::traversalDone(){
     CmiUInt8 pn = localTraversalState.numInteractions[0]+remoteTraversalState.numInteractions[0];
     CmiUInt8 pp = localTraversalState.numInteractions[1]+remoteTraversalState.numInteractions[1];
     CmiUInt8 oc = localTraversalState.numInteractions[2]+remoteTraversalState.numInteractions[2];
-#ifdef CHECK_NUM_INTERACTIONS
-    map<Key,CmiUInt8>::iterator it;
-    for(it = localTraversalState.bucketNodeInteractions.begin(); 
-        it != localTraversalState.bucketNodeInteractions.end();
-        it++){
-      myDM->addBucketNodeInteractions(it->first,it->second);
-      //oss << "L " << it->first << " N inter " << it->second << endl;
-    }
-    for(it = localTraversalState.bucketPartInteractions.begin(); 
-        it != localTraversalState.bucketPartInteractions.end();
-        it++){
-      myDM->addBucketPartInteractions(it->first,it->second);
-      //oss << "L " << it->first << " P inter " << it->second << endl;
-    }
-    for(it = remoteTraversalState.bucketNodeInteractions.begin(); 
-        it != remoteTraversalState.bucketNodeInteractions.end();
-        it++){
-      myDM->addBucketNodeInteractions(it->first,it->second);
-      //oss << "R " << it->first << " N inter " << it->second << endl;
-    }
-    for(it = remoteTraversalState.bucketPartInteractions.begin(); 
-        it != remoteTraversalState.bucketPartInteractions.end();
-        it++){
-      myDM->addBucketPartInteractions(it->first,it->second);
-      //oss << "R " << it->first << " P inter " << it->second << endl;
-    }
-    CkPrintf("[%d] iter %d local %lu remote %lu\n", thisIndex, iteration, pn, pp);
-#endif
     dataManagerProxy[CkMyPe()].traversalsDone(pn,pp,oc);
 #else
     dataManagerProxy[CkMyPe()].traversalsDone();
@@ -197,40 +166,6 @@ void TreePiece::finishIteration(){
 }
 
 void TreePiece::checkTraversals(){
-#ifdef DEBUG_TRAVERSALS
-  map<Key,set<Key> >::iterator it;
-  for(it = localTraversalState.bucketKeys.begin(); it != localTraversalState.bucketKeys.end(); it++){
-    set<Key>::iterator iit;
-    set<Key> &remlist = it->second;
-    if(remlist.size() != 1){
-      ostringstream oss;
-      for(iit = remlist.begin(); iit != remlist.end(); iit++){
-        oss << *iit << ",";
-      }
-
-      CkPrintf("[%d] local rem bucket %lu size %d: %s\n",
-          thisIndex, it->first, remlist.size(), oss.str().c_str());
-    }
-    iit = remlist.find(Key(0));
-    CkAssert(iit != remlist.end());
-  }
-
-  for(it = remoteTraversalState.bucketKeys.begin(); it != remoteTraversalState.bucketKeys.end(); it++){
-    set<Key>::iterator iit;
-    set<Key> &remlist = it->second;
-    if(remlist.size() != 1){
-      ostringstream oss;
-      for(iit = remlist.begin(); iit != remlist.end(); iit++){
-        oss << *iit << ",";
-      }
-
-      CkPrintf("[%d] remote rem bucket %lu size %d: %s\n",
-          thisIndex, it->first, remlist.size(), oss.str().c_str());
-    }
-    iit = remlist.find(Key(0));
-    CkAssert(iit != remlist.end());
-  }
-#endif
 }
 
 void TreePiece::quiescence(){
index 94bea53..e0412ed 100644 (file)
@@ -7,7 +7,6 @@
 extern CProxy_TreePiece treePieceProxy;
 
 int ParticleFlushWorker::work(Node<NodeDescriptor> *node){
-  //CkPrintf("(%d) traverse node %lu\n", CkMyPe(), node->getKey());
   if(node->getNumChildren() > 0) return 1;
 
   dataManager->sendParticlesToTreePiece(node,leafCnt); 
@@ -16,11 +15,6 @@ int ParticleFlushWorker::work(Node<NodeDescriptor> *node){
 }
 
 int MomentsWorker::work(Node<ForceData> *node){
-  /*
-  CkPrintf("(%d) moments node %lu children %d particles %lx\n",
-            CkMyPe(), node->getKey(), 
-            node->getNumChildren(), node->getParticles());
-  */
   
   int numChildren = node->getNumChildren();
   Particle *particles = node->getParticles();
@@ -33,7 +27,6 @@ int MomentsWorker::work(Node<ForceData> *node){
     setLeafType(node);
 
     if(node->getType() == Bucket || node->getType() == EmptyBucket){
-      //CkPrintf("[%d] moments from particles key %lu\n", CkMyPe(), node->getKey());
       node->getMomentsFromParticles();
       if(parent != NULL) parent->childMomentsReady();
     }
@@ -42,7 +35,6 @@ int MomentsWorker::work(Node<ForceData> *node){
     setTypeFromChildren(node);
     // don't have moments of remote nodes yet
     if(node->getType() == Internal){ 
-      //CkPrintf("[%d] moments from children %lu\n", CkMyPe(), node->getKey());
       node->getMomentsFromChildren();
       if(parent != NULL) parent->childMomentsReady();
     }
@@ -61,7 +53,6 @@ void MomentsWorker::setLeafType(Node<ForceData> *leaf){
     if(leaf->getNumParticles() > 0) leaf->setType(Bucket);
     else leaf->setType(EmptyBucket);
 
-    //CkPrintf("(%d) bucket %d key %lu\n", CkMyPe(), buckets.length(), leaf->getKey());
     buckets.push_back(leaf);
     return;
   }
@@ -83,7 +74,6 @@ void MomentsWorker::setLeafType(Node<ForceData> *leaf){
   else do {
     curTP++;
   } while(ownerStart > peTreePieces[curTP].index);
-  // :)
   goto beg;
 }
 
@@ -193,10 +183,6 @@ int InteractionChecker::work(Node<ForceData> *node){
   if(node->getNumChildren() == 0) return 1;
 
   for(int i = 0; i < BRANCH_FACTOR; i++){
-#ifdef CHECK_NUM_INTERACTIONS
-    node->nodeInteractions += node->getChild(i)->nodeInteractions;
-    node->partInteractions += node->getChild(i)->partInteractions;
-#endif
   }
 }