diff --git a/Compute.cpp b/Compute.cpp index 34cc138c..0daffac8 100644 --- a/Compute.cpp +++ b/Compute.cpp @@ -2359,14 +2359,6 @@ void printUndlist(DoubleWalkState *state, int level, TreePiece *tp){ #endif // INTERLIST_VER > 0 -void RemoteTreeBuilder::registerNode(GenericTreeNode *node){ - tp->nodeLookupTable[node->getKey()] = node; -} - -void LocalTreeBuilder::registerNode(GenericTreeNode *node){ - tp->nodeLookupTable[node->getKey()] = node; -} - bool RemoteTreeBuilder::work(GenericTreeNode *node, int level){ CkAssert(node != NULL); CkAssert(node->isValid() && !node->isCached()); @@ -2397,7 +2389,6 @@ bool RemoteTreeBuilder::work(GenericTreeNode *node, int level){ streamingProxy[node->remoteIndex].requestRemoteMoments(node->getKey(), tp->thisIndex, &opts); } } - registerNode(node); return false; } @@ -2413,7 +2404,6 @@ bool RemoteTreeBuilder::work(GenericTreeNode *node, int level){ // from the particle positions. node->boundingBox.reset(); - registerNode(node); return true; default: @@ -2486,7 +2476,6 @@ bool LocalTreeBuilder::work(GenericTreeNode *node, int level){ tp->bucketList.push_back(node); tp->numBuckets++; - registerNode(node); // deliver moments, since doneChildren() will // never be called with a bucket tp->deliverMomentsToClients(node); @@ -2495,7 +2484,6 @@ bool LocalTreeBuilder::work(GenericTreeNode *node, int level){ else if(node->getType() == Empty){ node->remoteIndex = tp->thisIndex; - registerNode(node); // deliver MomentsToClients, since remote pieces don't know its // an empty node. tp->deliverMomentsToClients(node); @@ -2510,7 +2498,6 @@ bool LocalTreeBuilder::work(GenericTreeNode *node, int level){ node->boundingBox.reset(); node->remoteIndex = tp->thisIndex; - registerNode(node); // don't deliver MomentsToClients, since we // haven't yet computed the moments for this // node: this will happen only after the moments diff --git a/Compute.h b/Compute.h index d507396c..63d12e2e 100644 --- a/Compute.h +++ b/Compute.h @@ -295,10 +295,6 @@ class RemoteTreeBuilder : public TreeNodeWorker { bool work(GenericTreeNode *node, int level); void doneChildren(GenericTreeNode *node, int level); - - private: - void registerNode(GenericTreeNode *node); - }; /// @brief Class to build the local part of the tree. Builds Internal nodes. @@ -312,9 +308,6 @@ class LocalTreeBuilder : public TreeNodeWorker { bool work(GenericTreeNode *node, int level); void doneChildren(GenericTreeNode *node, int level); - - private: - void registerNode(GenericTreeNode *node); }; /** @brief TreeNodeWorker implementation that just prints out the diff --git a/DataManager.cpp b/DataManager.cpp index 102d02b2..b1a1c1d8 100644 --- a/DataManager.cpp +++ b/DataManager.cpp @@ -201,10 +201,6 @@ void DataManager::combineLocalTrees(CkReductionMsg *msg) { } nodeTable.clear(); -#ifdef CUDA - cumNumReplicatedNodes = 0; -#endif - CkVec gtn; for(int i = 0; i < registeredTreePieces.length(); i++){ gtn.push_back(registeredTreePieces[i].root); @@ -317,9 +313,6 @@ const char *typeString(NodeType type); * to the copies in each treepiece of an identical node. */ Tree::GenericTreeNode *DataManager::buildProcessorTree(int n, Tree::GenericTreeNode **gtn) { -#ifdef CUDA - cumNumReplicatedNodes += (n-1); -#endif int nUnresolved; int pickedIndex; GenericTreeNode *pickedNode = pickNodeFromMergeList(n,gtn,nUnresolved,pickedIndex); @@ -786,22 +779,18 @@ void DataManager::serializeLocal(GenericTreeNode *node){ CkQ queue; int numTreePieces = registeredTreePieces.length(); - int numNodes = 0; int numParticles = 0; int numCachedNodes = 0; int numCachedParticles = 0; for(int i = 0; i < numTreePieces; i++){ TreePiece *tp = registeredTreePieces[i].treePiece; - numNodes += tp->getNumNodes(); numParticles += tp->getDMNumParticles(); } - numNodes -= cumNumReplicatedNodes; CkVec localMoments; CkVec localParticles; - localMoments.reserve(numNodes); localParticles.resize(numParticles); localMoments.length() = 0; diff --git a/DataManager.h b/DataManager.h index d863192a..3cbaf4b3 100644 --- a/DataManager.h +++ b/DataManager.h @@ -79,10 +79,6 @@ class DataManager : public CBase_DataManager { // holds chare array indices of registered treepieces CkVec registeredTreePieces; #ifdef CUDA - //CkVec registeredTreePieceIndices; - /// @brief counter for the number of tree nodes that are - /// replicated by TreePieces that share the same address space. - int cumNumReplicatedNodes; int treePiecesDone; int savedChunk; int treePiecesDonePrefetch; diff --git a/ParallelGravity.h b/ParallelGravity.h index b6b810c5..ab1ae13f 100644 --- a/ParallelGravity.h +++ b/ParallelGravity.h @@ -1037,11 +1037,16 @@ class TreePiece : public CBase_TreePiece { #if INTERLIST_VER > 0 GenericTreeNode *getStartAncestor(int current, int previous, GenericTreeNode *dflt); #endif - /// \brief convert a key to a node using the nodeLookupTable + /// \brief convert a key to a node using the tree + /// \param k NodeKey constructed from the path to the Node + /// \returns pointer to the Node, if found. Otherwise NULL. inline GenericTreeNode *keyToNode(const Tree::NodeKey k){ - NodeLookupType::iterator iter = nodeLookupTable.find(k); - if (iter != nodeLookupTable.end()) return iter->second; - else return NULL; + GenericTreeNode *thisNode = root; + while(thisNode != NULL && thisNode->getKey() != k) { + int iChild = thisNode->whichChild(k); + thisNode = thisNode->getChildren(iChild); + } + return thisNode; } GenericTreeNode *getBucket(int i){ @@ -1227,9 +1232,6 @@ class TreePiece : public CBase_TreePiece { int64_t nStartWrite; // Particle number at which this piece starts // to write file. - /// Map between Keys and TreeNodes, used to get a node from a key - NodeLookupType nodeLookupTable; - /// Number of nodes still missing before starting the real computation //u_int64_t prefetchWaiting; /// Array of keys that will be the root of the prefetching chunks @@ -1353,28 +1355,18 @@ class TreePiece : public CBase_TreePiece { void quiescence(); /*END DEBUGGING */ - NodeLookupType &getNodeLookupTable() { - return nodeLookupTable; - } - - int getNumNodes() { - return nodeLookupTable.size(); - } - /// delete treenodes if allocated void deleteTree() { if(pTreeNodes != NULL) { delete pTreeNodes; pTreeNodes = NULL; root = NULL; - nodeLookupTable.clear(); } else { if (root != NULL) { root->fullyDelete(); delete root; root = NULL; - nodeLookupTable.clear(); } } } @@ -1412,7 +1404,6 @@ class TreePiece : public CBase_TreePiece { * to trigger nextBucket() which will loop over all the buckets. */ void doAllBuckets(); - void reconstructNodeLookup(GenericTreeNode *node); //void rebuildSFCTree(GenericTreeNode *node,GenericTreeNode *parent,int *); public: diff --git a/TreePiece.cpp b/TreePiece.cpp index f13c326f..ede3a3a2 100644 --- a/TreePiece.cpp +++ b/TreePiece.cpp @@ -2772,7 +2772,6 @@ void TreePiece::startORBTreeBuild(CkReductionMsg* m){ if (thisIndex == 0) root->firstParticle ++; if (thisIndex == (int)numTreePieces-1) root->lastParticle --; root->particleCount = myNumParticles; - nodeLookupTable[(Tree::NodeKey)1] = root; //root->key = firstPossibleKey; root->boundingBox = boundingBox; @@ -2879,7 +2878,6 @@ void TreePiece::buildORBTree(GenericTreeNode * node, int level){ #if INTERLIST_VER > 0 child->startBucket=numBuckets; #endif - nodeLookupTable[child->getKey()] = child; if (child->getType() == NonLocal) { // find a remote index for the node int first, last; @@ -3036,7 +3034,6 @@ void TreePiece::startOctTreeBuild(CkReductionMsg* m) { if (myPlace == 0) root->firstParticle ++; if (myPlace == dm->responsibleIndex.size()-1) root->lastParticle --; root->particleCount = myNumParticles; - nodeLookupTable[(Tree::NodeKey)1] = root; root->boundingBox = boundingBox; numBuckets = 0; @@ -5796,17 +5793,6 @@ void TreePiece::pup(PUP::er& p) { } } -void TreePiece::reconstructNodeLookup(GenericTreeNode *node) { - nodeLookupTable[node->getKey()] = node; - node->particlePointer = &myParticles[node->firstParticle]; - if (node->getType() == Bucket) bucketList.push_back(node); - GenericTreeNode *child; - for (unsigned int i=0; inumChildren(); ++i) { - child = node->getChildren(i); - if (child != NULL) reconstructNodeLookup(child); - } -} - /** Check that all the particles in the tree are really in their boxes. Because the keys are made of only the first 21 out of 23 bits of the floating point representation, there can be particles that are outside