Fixed a bug in creating charm SMP node-aware spanning tree. The bug is that
authorChao Mei <chaomei2@illinois.edu>
Wed, 10 Nov 2010 00:40:23 +0000 (18:40 -0600)
committerChao Mei <chaomei2@illinois.edu>
Wed, 10 Nov 2010 00:40:23 +0000 (18:40 -0600)
when all remote procs are on the same charm SMP node, the parent proc
will have multiple remote children from those procs.

src/util/treeStrategy_topoUnaware.h

index aecd7c10066c99518ec5c680ed50bcfc2556e882..b4edb7da8d6b5287f0e464807c948c5cb5387639 100644 (file)
@@ -76,13 +76,19 @@ namespace impl {
                        }
                }
                int totalNodes = nodesMap.size();
+               //check whether the building of this tree is for procs on remote SMP nodes.
+               //NOW: just use the condition whether the "parent" nid is same with (firstVtx+1)
+               int pnid = CmiNodeOf(topo::getProcID(*firstVtx));
+               int fnid = CmiNodeOf(topo::getProcID(*(firstVtx+1)));
+               int forRemoteNodes = (pnid != fnid);
        #else
                //in non-SMP case, just to fake there's no SMP nodes so the work flow of spanning tree 
                //creation is correct
                int totalNodes = 0;
+               int forRemoteNodes=0;
        #endif
                
-               if(totalNodes <= 1){
+               if(totalNodes <= 1 && !forRemoteNodes){
                        /// Compute the number of vertices in each branch
                        const int numDescendants = std::distance(firstVtx,beyondLastVtx) - 1;
                        int numInSubTree = numDescendants / maxBranches;