Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

ProxyMgr Class Reference

#include <ProxyMgr.h>

Inheritance diagram for ProxyMgr:

BOCclass List of all members.

Public Member Functions

 ProxyMgr ()
 ~ProxyMgr ()
void removeProxies (void)
void removeUnusedProxies (void)
void createProxies (void)
void createProxy (PatchID pid)
void removeProxy (PatchID pid)
void registerProxy (PatchID pid)
void recvRegisterProxy (RegisterProxyMsg *)
void unregisterProxy (PatchID pid)
void recvUnregisterProxy (UnregisterProxyMsg *)
void setSendSpanning ()
int getSendSpanning ()
void setRecvSpanning ()
int getRecvSpanning ()
void buildProxySpanningTree ()
void sendSpanningTrees ()
void sendSpanningTreeToHomePatch (int pid, int *tree, int n)
void recvSpanningTreeOnHomePatch (int pid, int *tree, int n)
void sendSpanningTree (ProxySpanningTreeMsg *)
void recvSpanningTree (ProxySpanningTreeMsg *)
void sendNodeAwareSpanningTreeToHomePatch (int pid, proxyTreeNode *tree, int n)
void recvNodeAwareSpanningTreeOnHomePatch (ProxyNodeAwareSpanningTreeMsg *msg)
void sendNodeAwareSpanningTree (ProxyNodeAwareSpanningTreeMsg *)
void recvNodeAwareSpanningTree (ProxyNodeAwareSpanningTreeMsg *)
void recvNodeAwareSTParent (int patch, int parent)
void buildProxySpanningTree2 ()
void sendProxies (int pid, int *list, int n)
void recvProxies (int pid, int *list, int n)
void buildSpanningTree0 ()
void sendResults (ProxyResultVarsizeMsg *)
void recvResults (ProxyResultVarsizeMsg *)
void sendResults (ProxyResultMsg *)
void recvResults (ProxyResultMsg *)
void sendResults (ProxyCombinedResultMsg *)
void recvResults (ProxyCombinedResultMsg *)
void recvImmediateResults (ProxyCombinedResultMsg *)
void sendProxyData (ProxyDataMsg *, int, int *)
void recvImmediateProxyData (ProxyDataMsg *)
void recvProxyData (ProxyDataMsg *)
void sendProxyAll (ProxyDataMsg *, int, int *)
void recvImmediateProxyAll (ProxyDataMsg *)
void recvProxyAll (ProxyDataMsg *)
int numProxies ()
ProxyTreegetPtree ()

Static Public Member Functions

ProxyMgrObject ()

Static Public Attributes

int nodecount = 0

Constructor & Destructor Documentation

ProxyMgr::ProxyMgr  ) 
 

Definition at line 369 of file ProxyMgr.C.

References NAMD_bug().

00369                    { 
00370   if (CkpvAccess(ProxyMgr_instance)) {
00371     NAMD_bug("Tried to create ProxyMgr twice.");
00372   }
00373   CkpvAccess(ProxyMgr_instance) = this;
00374 }

ProxyMgr::~ProxyMgr  ) 
 

Definition at line 376 of file ProxyMgr.C.

References removeProxies().

00376                     { 
00377   removeProxies();
00378   CkpvAccess(ProxyMgr_instance) = NULL;
00379 }


Member Function Documentation

void ProxyMgr::buildProxySpanningTree  ) 
 

Definition at line 562 of file ProxyMgr.C.

References HomePatch::buildSpanningTree(), PatchMap::homePatch(), PatchMap::homePatchIDList(), iINFO(), iout, PatchMap::Object(), PatchIDList, proxyRecvSpanning, proxySendSpanning, and ResizeArray< Elem >::size().

Referenced by Node::startup().

00563 {
00564   PatchIDList pids;
00565   if (!CkMyPe()) iout << iINFO << "Building spanning tree ... send: " << proxySendSpanning << " recv: " << proxyRecvSpanning << "\n" << endi;
00566   PatchMap::Object()->homePatchIDList(pids);
00567   for (int i=0; i<pids.size(); i++) {
00568     HomePatch *home = PatchMap::Object()->homePatch(pids[i]);
00569     if (home == NULL) CkPrintf("ERROR: homepatch NULL\n");
00570 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00571     home->buildNodeAwareSpanningTree();
00572 #else
00573     home->buildSpanningTree();
00574 #endif
00575   }
00576 }

void ProxyMgr::buildProxySpanningTree2  ) 
 

Definition at line 579 of file ProxyMgr.C.

References PatchMap::homePatch(), PatchMap::homePatchIDList(), PatchMap::Object(), PatchIDList, HomePatch::sendProxies(), and ResizeArray< Elem >::size().

Referenced by ComputeMgr::updateLocalComputes5().

00580 {
00581   PatchIDList pids;
00582   PatchMap::Object()->homePatchIDList(pids);
00583   for (int i=0; i<pids.size(); i++) {
00584     HomePatch *home = PatchMap::Object()->homePatch(pids[i]);
00585     if (home == NULL) CkPrintf("ERROR: homepatch NULL\n");
00586     home->sendProxies();
00587   }
00588 }

void ProxyMgr::buildSpanningTree0  ) 
 

Definition at line 940 of file ProxyMgr.C.

References ResizeArray< Elem >::find(), MAX_INTERNODE, PatchMap::node(), NodeIDList, noInterNode(), PatchMap::numPatches(), PatchMap::Object(), processCpuLoad(), ProxyTree::proxylist, proxySpanDim, ResizeArray< Elem >::resize(), ResizeArray< Elem >::setall(), ResizeArray< Elem >::size(), ProxyTree::sizes, and ProxyTree::trees.

Referenced by Rebalancer::createSpanningTree(), and recvProxies().

00941 {
00942   int i;
00943 
00944   processCpuLoad();
00945 
00946   int *numPatchesOnNode = new int[CkNumPes()];
00947   int numNodesWithPatches = 0;
00948   for (i=0; i<CkNumPes(); i++) numPatchesOnNode[i] = 0;
00949   int numPatches = PatchMap::Object()->numPatches();
00950   for (i=0; i<numPatches; i++) {
00951     int node = PatchMap::Object()->node(i);
00952     numPatchesOnNode[node]++;
00953     if (numPatchesOnNode[node] == 1)
00954       numNodesWithPatches ++;
00955   }
00956   int patchNodesLast =
00957     ( numNodesWithPatches < ( 0.7 * CkNumPes() ) );
00958   int *ntrees = new int[CkNumPes()];
00959   for (i=0; i<CkNumPes(); i++) ntrees[i] = 0;
00960   if (ptree.trees == NULL) ptree.trees = new NodeIDList[numPatches];
00961   for (int pid=0; pid<numPatches; pid++) 
00962   {
00963     int numProxies = ptree.proxylist[pid].size();
00964     if (numProxies == 0) {
00965       CkPrintf ("This is sheer evil!\n\n");
00966       //ProxyMgr::Object()->sendSpanningTreeToHomePatch(pid, NULL, 0);
00967       return;
00968     }
00969     NodeIDList &tree = ptree.trees[pid];   // spanning tree
00970     NodeIDList oldtree = tree;
00971     tree.resize(numProxies+1);
00972     tree.setall(-1);
00973     tree[0] = PatchMap::Object()->node(pid);
00974     int s=1, e=numProxies;
00975     int nNonPatch = 0;
00976     int treesize = 1;
00977     int pp;
00978 
00979     // keep tree persistent for non-intermediate nodes
00980     for (pp=0; pp<numProxies; pp++) {
00981       int p = ptree.proxylist[pid][pp];
00982       int oldindex = oldtree.find(p);
00983       if (oldindex != -1 && oldindex <= numProxies) {
00984         int isIntermediate = (oldindex*proxySpanDim+1 <= numProxies);
00985         if (!isIntermediate) {
00986           tree[oldindex] = p;
00987         }
00988         else if (ntrees[p] < MAX_INTERNODE) {
00989           tree[oldindex] = p;
00990           ntrees[p] ++;
00991         }
00992       }
00993     }
00994 
00995     for (pp=0; pp<numProxies; pp++) {
00996       int p = ptree.proxylist[pid][pp];              // processor number
00997       if (tree.find(p) != -1) continue;        // already used
00998       treesize++;
00999       if (patchNodesLast && numPatchesOnNode[p] ) {
01000         while (tree[e] != -1) { e--; if (e==-1) e = numProxies; }
01001         tree[e] = p;
01002         int isIntermediate = (e*proxySpanDim+1 <= numProxies);
01003         if (isIntermediate) ntrees[p]++;
01004       }
01005       else {
01006         while (tree[s] != -1) { s++; if (s==numProxies+1) s = 1; }
01007         int isIntermediate = (s*proxySpanDim+1 <= numProxies);
01008         if (isIntermediate && (ntrees[p] >= MAX_INTERNODE || noInterNode(p))) {   // TOO MANY INTERMEDIATE TREES
01009         //if (isIntermediate && ntrees[p] >= MAX_INTERNODE)    // TOO MANY INTERMEDIATE TREES
01010           while (tree[e] != -1) { e--; if (e==-1) e = numProxies; }
01011           tree[e] = p;
01012           isIntermediate = (e*proxySpanDim+1 <= numProxies);
01013           if (isIntermediate) ntrees[p]++;
01014         }
01015         else {
01016           tree[s] = p;
01017           nNonPatch++;
01018           if (isIntermediate) ntrees[p]++;
01019         }
01020       }
01021     }
01022     // send homepatch's proxy tree
01023     if(ptree.sizes)
01024       ptree.sizes[pid] = treesize;
01025     //ProxyMgr::Object()->sendSpanningTreeToHomePatch(pid, &tree[0], treesize);
01026   }
01027   /*for (i=0; i<CkNumPes(); i++) {
01028     if (ntrees[i] > MAX_INTERNODE) iout << "Processor " << i << "has (guess) " << ntrees[i] << " intermediate nodes." << endi;
01029   }*/
01030   delete [] ntrees;
01031   delete [] numPatchesOnNode;
01032 }

void ProxyMgr::createProxies void   ) 
 

Definition at line 430 of file ProxyMgr.C.

References UniqueSet< Elem >::add(), PatchMap::basePatchIDList(), ComputeMap::isPatchBased(), j, ComputeMap::node(), PatchMap::node(), ComputeMap::numComputes(), PatchMap::numPatches(), ComputeMap::numPids(), ComputeMap::Object(), PatchMap::Object(), PatchID, PatchIDList, ComputeMap::pid(), PatchMap::registerPatch(), removeProxies(), ResizeArray< Elem >::size(), and PatchMap::upstreamNeighbors().

Referenced by Node::startup().

00431 {
00432   // Delete the old proxies.
00433   removeProxies();
00434 
00435   PatchMap *patchMap = PatchMap::Object();
00436   int numPatches = patchMap->numPatches();
00437   int myNode = CkMyPe();
00438   enum PatchFlag { Unknown, Home, NeedProxy };
00439   int *patchFlag = new int[numPatches]; 
00440   int i, j;
00441 
00442   // Note all home patches.
00443   for ( i = 0; i < numPatches; ++i )
00444   {
00445     patchFlag[i] = ( patchMap->node(i) == myNode ) ? Home : Unknown;
00446   }
00447 
00448   // Add all upstream neighbors.
00449   PatchID neighbors[PatchMap::MaxOneAway];
00450   PatchIDList basepids;
00451   patchMap->basePatchIDList(myNode,basepids);
00452   for ( i = 0; i < basepids.size(); ++i )
00453   {
00454     if ( patchMap->node(basepids[i]) != myNode ) {
00455         patchFlag[basepids[i]] = NeedProxy;
00456     }
00457     int numNeighbors = patchMap->upstreamNeighbors(basepids[i],neighbors);
00458     for ( j = 0; j < numNeighbors; ++j )
00459     {
00460       if ( ! patchFlag[neighbors[j]] ) {
00461         patchFlag[neighbors[j]] = NeedProxy;
00462       }
00463     }
00464   }
00465 
00466   // Check all patch-based compute objects.
00467   ComputeMap *computeMap = ComputeMap::Object();
00468   int nc = computeMap->numComputes();
00469   for ( i = 0; i < nc; ++i )
00470   {
00471     if ( computeMap->node(i) != myNode || !computeMap->isPatchBased(i) ) 
00472       continue;
00473     int numPid = computeMap->numPids(i);
00474     for ( j = 0; j < numPid; ++j )
00475     {
00476       int pid = computeMap->pid(i,j);
00477       if ( ! patchFlag[pid] ) {
00478         patchFlag[pid] = NeedProxy;
00479       }
00480     }
00481   }
00482   
00483   // Create proxy list
00484   for ( i = 0; i < numPatches; ++i ) {
00485     if ( patchFlag[i] == NeedProxy )
00486     { // create proxy patch
00487       ProxyPatch *proxy = new ProxyPatch(i);
00488       proxySet.add(ProxyElem(i, proxy));
00489       patchMap->registerPatch(i, proxy);
00490     }
00491   }
00492   delete[] patchFlag;
00493 }

void ProxyMgr::createProxy PatchID  pid  ) 
 

Definition at line 496 of file ProxyMgr.C.

References UniqueSet< Elem >::add(), DebugM, Patch::getPatchID(), PatchMap::Object(), PatchMap::patch(), and PatchMap::registerPatch().

Referenced by ComputeMgr::updateLocalComputes().

00496                                  {
00497   Patch *p = PatchMap::Object()->patch(pid);
00498   if (!p) {
00499      DebugM(4,"createProxy("<<pid<<")\n");
00500      ProxyPatch *proxy = new ProxyPatch(pid);
00501      proxySet.add(ProxyElem(pid,proxy));
00502      PatchMap::Object()->registerPatch(pid,proxy);
00503   }
00504   else {
00505      DebugM(4,"createProxy("<<pid<<") found " << p->getPatchID() << "\n");
00506   }
00507     
00508 }

ProxyTree & ProxyMgr::getPtree  ) 
 

Definition at line 398 of file ProxyMgr.C.

Referenced by Rebalancer::createSpanningTree(), Rebalancer::decrSTLoad(), and Rebalancer::incrSTLoad().

00398                               {
00399   return ptree;
00400 }

int ProxyMgr::getRecvSpanning  ) 
 

Definition at line 394 of file ProxyMgr.C.

00394                               {
00395   return proxyRecvSpanning;
00396 }

int ProxyMgr::getSendSpanning  ) 
 

Definition at line 386 of file ProxyMgr.C.

00386                               {
00387   return proxySendSpanning;
00388 }

int ProxyMgr::numProxies  )  [inline]
 

Definition at line 323 of file ProxyMgr.h.

References UniqueSet< Elem >::size().

Referenced by Sync::openSync().

00323 { return proxySet.size(); }

ProxyMgr* ProxyMgr::Object  )  [inline, static]
 

Definition at line 321 of file ProxyMgr.h.

Referenced by Rebalancer::createSpanningTree(), Rebalancer::decrSTLoad(), Rebalancer::incrSTLoad(), Sync::openSync(), HomePatch::positionsReady(), ProxyPatch::ProxyPatch(), recvImmediateProxyAll(), recvImmediateProxyData(), recvNodeAwareSpanningTree(), recvSpanningTree(), WorkDistrib::saveMaps(), WorkDistrib::sendMaps(), HomePatch::sendProxies(), HomePatch::sendSpanningTree(), sendSpanningTrees(), Node::startup(), ComputeMgr::updateLocalComputes5(), and ProxyPatch::~ProxyPatch().

00321 { return CkpvAccess(ProxyMgr_instance); }

void ProxyMgr::recvImmediateProxyAll ProxyDataMsg  ) 
 

Definition at line 1567 of file ProxyMgr.C.

References ProxyPatch::getSpanningTreeChild(), ProxyPatch::getSpanningTreeNChild(), Object(), PatchMap::Object(), ProxyDataMsg::patch, PatchMap::patch(), proxySendSpanning, recvProxyAll(), and sendProxyAll().

01567                                                  {
01568   ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01569   #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01570   DebugFileTrace *dft = DebugFileTrace::Object();
01571   dft->openTrace();
01572   dft->writeTrace("PMgr::recvImmPAll for patch[%d]\n", msg->patch);
01573   CmiAssert(proxy!=NULL);
01574   dft->writeTrace("PMgr::recvImmPAll assertion OK for patch[%d]\n", msg->patch);
01575   dft->closeTrace();
01576   #endif
01577   if (proxySendSpanning == 1) {
01578     // copy the message and send to spanning children
01579     int *pids = (int*)alloca(proxy->getSpanningTreeNChild()*sizeof(int));
01580     int npid = proxy->getSpanningTreeChild(pids);
01581     if (npid) {
01582         ProxyDataMsg *newmsg = (ProxyDataMsg *)CkCopyMsg((void **)&msg);      
01583       ProxyMgr::Object()->sendProxyAll(newmsg,npid,pids);
01584     }
01585   }
01586   /* send to self via EP method to preserve priority */
01587   CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01588   cp[CkMyPe()].recvProxyAll(msg);
01589 }

void ProxyMgr::recvImmediateProxyData ProxyDataMsg  ) 
 

Definition at line 1472 of file ProxyMgr.C.

References ProxyPatch::getSpanningTreeChild(), ProxyPatch::getSpanningTreeNChild(), Object(), PatchMap::Object(), ProxyDataMsg::patch, PatchMap::patch(), proxySendSpanning, recvProxyData(), and sendProxyData().

01472                                                   {
01473   ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);  
01474   if (proxySendSpanning == 1) {
01475     // copy the message and send to spanning children
01476     int *pids = (int*)alloca(proxy->getSpanningTreeNChild()*sizeof(int));
01477     int npid = proxy->getSpanningTreeChild(pids);
01478     if (npid) {        
01479         ProxyDataMsg *newmsg = (ProxyDataMsg *)CkCopyMsg((void **)&msg);     
01480 
01481         ProxyMgr::Object()->sendProxyData(newmsg,npid,pids);
01482       #if 0
01483       //ChaoMei: buggy code??? the spanning tree doesn't always have 2 levels
01484       //At the second level of the tree immediate messages are not needed
01485       CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01486       cp.recvProxyData(newmsg,npid,pids);
01487       #endif
01488     }
01489   }
01490   /* send to self via EP method to preserve priority */
01491   CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01492   cp[CkMyPe()].recvProxyData(msg);
01493 }

void ProxyMgr::recvImmediateResults ProxyCombinedResultMsg  ) 
 

Definition at line 1389 of file ProxyMgr.C.

References ProxyPatch::depositCombinedResultMsg(), ProxyPatch::getSpanningTreeParent(), PatchMap::homePatch(), PatchMap::Object(), PatchMap::patch(), and ProxyCombinedResultMsg::patch.

01389                                                                {
01390   HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
01391   if (home) {
01392     CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01393     cp[CkMyPe()].recvResults(msg);
01394   }
01395   else {
01396     ProxyPatch *patch = (ProxyPatch *)PatchMap::Object()->patch(msg->patch);
01397     ProxyCombinedResultMsg *cMsg = patch->depositCombinedResultMsg(msg);
01398     if (cMsg) {
01399       CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01400       cp[patch->getSpanningTreeParent()].recvImmediateResults(cMsg);
01401     }
01402   }
01403 }

void ProxyMgr::recvNodeAwareSpanningTree ProxyNodeAwareSpanningTreeMsg  ) 
 

Definition at line 1156 of file ProxyMgr.C.

References ResizeArray< Elem >::add(), ProxyNodeAwareSpanningTreeMsg::allPes, PatchMap::homePatch(), ResizeArray< Elem >::item(), j, nodecount, ProxyNodeAwareSpanningTreeMsg::numNodesWithProxies, ProxyNodeAwareSpanningTreeMsg::numPesOfNode, Object(), PatchMap::Object(), PatchMap::patch(), ProxyNodeAwareSpanningTreeMsg::patch, ProxyNodeAwareSpanningTreeMsg::printOut(), ProxyNodeAwareSpanningTreeMsg::procID, proxySpanDim, NodeProxyMgr::registerPatch(), sendNodeAwareSpanningTree(), ProxyPatch::setSpanningTree(), and ResizeArray< Elem >::size().

01156                                                                           {
01157 
01158     #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01159     DebugFileTrace *dft = DebugFileTrace::Object();
01160     dft->openTrace();
01161     dft->writeTrace("PMgr::recvST0 for patch[%d] with #nodes=%d\n", msg->patch, msg->numNodesWithProxies);
01162     dft->closeTrace();
01163     msg->printOut("PMgr::recvST");
01164     #endif
01165 
01166     //This function is divided into three parts. The tree root is msg->allPes[0]
01167     //1. set up its own immediate childrens
01168     int treesize = msg->numNodesWithProxies;    
01169     int iNChild = 0; //number of internal children
01170     int eNChild = 0; //number of external children
01171     if(treesize>0){
01172         iNChild = (msg->numPesOfNode[0]-1); //exclude the root itself
01173         eNChild = (proxySpanDim>(treesize-1))?(treesize-1):proxySpanDim;
01174     }
01175     int numChild = iNChild + eNChild;
01176     if(numChild==0){
01177         ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01178         proxy->setSpanningTree(msg->procID, NULL, 0);
01179         #ifdef USE_NODEPATCHMGR
01180         //set up proxyInfo inside NodeProxyMgr
01181         if(!PatchMap::Object()->homePatch(msg->patch)){
01182             //only when this processor contains a proxy patch of "msg->patch"
01183             //is the patch registeration in NodeProxyMgr needed,
01184             //and itself needs to be registered
01185             CProxy_NodeProxyMgr pm(CkpvAccess(BOCclass_group).nodeProxyMgr);
01186             NodeProxyMgr *npm = pm[CkMyNode()].ckLocalBranch();        
01187             npm->registerPatch(msg->patch, msg->numPesOfNode[0], msg->allPes);            
01188         }
01189         //set children in terms of node ids
01190         proxy->setSTNodeChildren(0, NULL);       
01191         #endif
01192         return;
01193     }
01194 
01195     nodecount++;
01196     //if (nodecount > MAX_INTERNODE) 
01197     //  iout << "Processor " << CkMyPe() << "has (actual) " << nodecount << " intermediate nodes." << endi;
01198 
01199     if(!PatchMap::Object()->homePatch(msg->patch)){
01200         //the home patch of this spanning tree has been already set up for its childrens
01201         ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01202         int *children = (int*)alloca(numChild*sizeof(int));
01203         //add external children
01204         int *p = msg->allPes + msg->numPesOfNode[0];
01205         for(int i=0; i<eNChild; i++) {
01206             children[i] = *p;
01207             p += msg->numPesOfNode[i+1];
01208         }
01209         //add internal children
01210         for(int i=eNChild, j=1; i<numChild; i++, j++) {
01211             children[i] = msg->allPes[j]; 
01212         }
01213         proxy->setSpanningTree(msg->procID, children, numChild);
01214 
01215         #ifdef USE_NODEPATCHMGR
01216         //set up proxyInfo inside NodeProxyMgr
01217         CProxy_NodeProxyMgr pm(CkpvAccess(BOCclass_group).nodeProxyMgr);
01218         NodeProxyMgr *npm = pm[CkMyNode()].ckLocalBranch();        
01219         npm->registerPatch(msg->patch, msg->numPesOfNode[0], msg->allPes);        
01220 
01221         //set children in terms of node ids
01222         int nodeChildren[eNChild+1];
01223         p = msg->allPes + msg->numPesOfNode[0];
01224         for(int i=0; i<eNChild; i++) {
01225             nodeChildren[i] = CkNodeOf(*p);
01226             p += msg->numPesOfNode[i+1];
01227         }
01228         //the last entry always stores the node id that contains this proxy
01229         nodeChildren[eNChild] = CkNodeOf(msg->allPes[0]);
01230         proxy->setSTNodeChildren(eNChild+1, nodeChildren);
01231         #endif
01232     }
01233 
01234     //2. send msgs for the tree to external children proxies
01235     if(eNChild > 0) {
01236         ResizeArray<int> *exTreeChildSize = new ResizeArray<int>[eNChild];
01237         ResizeArray<int *> *exTreeChildPtr = new ResizeArray<int *>[eNChild];    
01238     
01239         int nodesToCnt = 1; //the number of children each root (current root's 
01240                             //immedidate external nodes) has in each level
01241         int pos = 1; //track the iteration over msg->numPesOfNode and skip the current root
01242         int *pePtr = msg->allPes + msg->numPesOfNode[0];
01243         int done = 0;
01244         while(!done) {
01245             for(int childID=0; childID<eNChild;childID++) {
01246                 //iterate nodes on each level
01247                 for(int i=0; i<nodesToCnt; i++) {
01248                     int cursize = msg->numPesOfNode[pos];
01249                     exTreeChildSize[childID].add(cursize);
01250                     exTreeChildPtr[childID].add(pePtr);
01251                     pos++;
01252                     pePtr += cursize; 
01253                     if(pos==msg->numNodesWithProxies) {
01254                         done = 1;
01255                         break;
01256                     }
01257                 }
01258                 if(done) break;                         
01259             }
01260             nodesToCnt *= proxySpanDim;
01261         }
01262           
01263         for(int i=0; i<eNChild; i++) {                
01264             ResizeArray<int> *allSizes = &exTreeChildSize[i];
01265             ResizeArray<int *> *allPtrs = &exTreeChildPtr[i];
01266             int totalNodes = allSizes->size();
01267             int totalPes = 0;
01268             for(int j=0; j<totalNodes; j++) totalPes += allSizes->item(j);
01269             ProxyNodeAwareSpanningTreeMsg *cmsg = new(totalNodes, totalPes, 0) ProxyNodeAwareSpanningTreeMsg;
01270             cmsg->patch = msg->patch;
01271             cmsg->procID = CkMyPe();
01272             cmsg->numNodesWithProxies = totalNodes;
01273             int *pAllPes = cmsg->allPes;
01274             for(int j=0; j<totalNodes; j++) {
01275                 int numPes = allSizes->item(j);
01276                 cmsg->numPesOfNode[j] = numPes;
01277                 memcpy(pAllPes, allPtrs->item(j), sizeof(int)*numPes);
01278                 pAllPes += numPes;
01279             }
01280             #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01281             cmsg->printOut("sndExtChi:");
01282             #endif
01283             ProxyMgr::Object()->sendNodeAwareSpanningTree(cmsg);
01284         }    
01285         
01286         delete [] exTreeChildSize;
01287         delete [] exTreeChildPtr;  
01288     }
01289 
01290     //3. send msgs for the tree to the children proxies within the same (physical) node
01291     CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01292     for(int i=0; i<iNChild; i++) {
01293         int pe = msg->allPes[i+1]; //excluding the root procID at allPes[0]
01294         #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01295         DebugFileTrace *dft = DebugFileTrace::Object();
01296         dft->openTrace();
01297         dft->writeTrace("Preparing send a msg to internal children for patch[%d] from proc %d to proc %d\n", 
01298                      msg->patch, CkMyPe(), pe);
01299         dft->closeTrace();
01300         #endif
01301         cp[pe].recvNodeAwareSTParent(msg->patch, CkMyPe());
01302     }    
01303 
01304     delete msg;
01305 }

void ProxyMgr::recvNodeAwareSpanningTreeOnHomePatch ProxyNodeAwareSpanningTreeMsg msg  ) 
 

Definition at line 1075 of file ProxyMgr.C.

References PatchMap::homePatch(), PatchMap::Object(), ProxyNodeAwareSpanningTreeMsg::patch, and HomePatch::recvNodeAwareSpanningTree().

01076 {
01077   HomePatch *p = PatchMap::Object()->homePatch(msg->patch);
01078   p->recvNodeAwareSpanningTree(msg);
01079   delete msg;
01080 }

void ProxyMgr::recvNodeAwareSTParent int  patch,
int  parent
 

Definition at line 1307 of file ProxyMgr.C.

References PatchMap::Object(), PatchMap::patch(), and ProxyPatch::setSpanningTree().

01307                                                          {
01308 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01309     DebugFileTrace *dft = DebugFileTrace::Object();
01310     dft->openTrace();
01311     dft->writeTrace("PMgr::recvSTParent: for ProxyPatch[%d], parent is %d\n", patch, parent);
01312     dft->closeTrace();
01313 #endif
01314     ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(patch);
01315     CmiAssert(proxy!=NULL);
01316     proxy->setSpanningTree(parent, NULL, 0);
01317 }

void ProxyMgr::recvProxies int  pid,
int *  list,
int  n
 

Definition at line 604 of file ProxyMgr.C.

References buildSpanningTree0(), NodeIDList, PatchMap::numPatches(), PatchMap::Object(), ProxyTree::proxylist, ProxyTree::proxyMsgCount, ResizeArray< Elem >::resize(), and sendSpanningTrees().

00605 {
00606   int nPatches = PatchMap::Object()->numPatches();
00607   if (ptree.proxylist == NULL)
00608     ptree.proxylist = new NodeIDList[nPatches];
00609   ptree.proxylist[pid].resize(n);
00610   for (int i=0; i<n; i++)
00611     ptree.proxylist[pid][i] = list[i];
00612   ptree.proxyMsgCount ++;
00613   if (ptree.proxyMsgCount == nPatches) {
00614     ptree.proxyMsgCount = 0;
00615     // building and sending of trees is done in two steps now
00616     // so that the building step can be shifted to the load balancer
00617 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00618     buildNodeAwareSpanningTree0();
00619 #else
00620     buildSpanningTree0();    
00621 #endif
00622     sendSpanningTrees();
00623   }
00624 }

void ProxyMgr::recvProxyAll ProxyDataMsg  ) 
 

Definition at line 1550 of file ProxyMgr.C.

References PatchMap::Object(), ProxyDataMsg::patch, PatchMap::patch(), proxySendSpanning, and ProxyPatch::receiveAll().

Referenced by recvImmediateProxyAll().

01550                                         {
01551 //Chao Mei: hack for QD in case of SMP with immediate msg
01552 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR) && (CMK_SMP) && defined(NAMDSRC_IMMQD_HACK)
01553     if(proxySendSpanning && msg->isFromImmMsgCall){
01554 //    CkPrintf("qdcreate called on pe[%d]\n", CkMyPe());
01555 //    fflush(stdout);
01556         //To compensate for the counter loss for message creation
01557         //inside the process of immediate message on comm thread
01558         CkpvAccess(_qd)->create();
01559     }
01560 #endif
01561 
01562   ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01563   proxy->receiveAll(msg); // deleted in ProxyPatch::receiveAtoms()
01564 }

void ProxyMgr::recvProxyData ProxyDataMsg  ) 
 

Definition at line 1456 of file ProxyMgr.C.

References PatchMap::Object(), ProxyDataMsg::patch, PatchMap::patch(), proxySendSpanning, and ProxyPatch::receiveData().

Referenced by recvImmediateProxyData().

01456                                          {
01457 //Chao Mei: hack for QD in case of SMP with immediate msg
01458 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR) && (CMK_SMP) && defined(NAMDSRC_IMMQD_HACK)
01459     if(proxySendSpanning && msg->isFromImmMsgCall){
01460 //    CkPrintf("qdcreate called on pe[%d]\n", CkMyPe());
01461 //    fflush(stdout);
01462         //To compensate for the counter loss for message creation
01463         //inside the process of immediate message on comm thread
01464         CkpvAccess(_qd)->create();
01465     }
01466 #endif
01467   ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01468   proxy->receiveData(msg); // deleted in ProxyPatch::receiveAtoms()
01469 }

void ProxyMgr::recvRegisterProxy RegisterProxyMsg  ) 
 

Definition at line 536 of file ProxyMgr.C.

References PatchMap::homePatch(), PatchMap::Object(), RegisterProxyMsg::patch, and HomePatch::registerProxy().

00536                                                  {
00537   HomePatch *homePatch = PatchMap::Object()->homePatch(msg->patch);
00538   homePatch->registerProxy(msg); // message deleted in registerProxy()
00539 }

void ProxyMgr::recvResults ProxyCombinedResultMsg  ) 
 

Definition at line 1367 of file ProxyMgr.C.

References PatchMap::homePatch(), NAMD_bug(), PatchMap::Object(), ProxyCombinedResultMsg::patch, proxyRecvSpanning, and HomePatch::receiveResults().

01367                                                  {
01368 //Chao Mei: hack for QD in case of SMP with immediate msg
01369 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR) && (CMK_SMP) && defined(NAMDSRC_IMMQD_HACK)
01370     if(proxyRecvSpanning && msg->isFromImmMsgCall){
01371 //    CkPrintf("qdcreate called on pe[%d]\n", CkMyPe());
01372 //    fflush(stdout);
01373         //To compensate for the counter loss for message creation
01374         //inside the process of immediate message on comm thread
01375         CkpvAccess(_qd)->create();
01376     }
01377 #endif
01378 
01379   HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
01380   if (home) {
01381     //printf("Home got a message\n");
01382     home->receiveResults(msg); // delete done in HomePatch::receiveResults()
01383   }
01384   else {
01385     NAMD_bug("ProxyMgr should receive result message on home processor");
01386   }
01387 }

void ProxyMgr::recvResults ProxyResultMsg  ) 
 

Definition at line 1336 of file ProxyMgr.C.

References PatchMap::homePatch(), PatchMap::Object(), ProxyResultMsg::patch, and HomePatch::receiveResults().

01336                                               {
01337   HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
01338   home->receiveResults(msg); // delete done in HomePatch::receiveResults()
01339 }

void ProxyMgr::recvResults ProxyResultVarsizeMsg  ) 
 

Definition at line 1325 of file ProxyMgr.C.

References PatchMap::homePatch(), PatchMap::Object(), ProxyResultVarsizeMsg::patch, and HomePatch::receiveResults().

01325                                                      {
01326     HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
01327     home->receiveResults(msg); // delete done in HomePatch::receiveResults()
01328 }

void ProxyMgr::recvSpanningTree ProxySpanningTreeMsg  ) 
 

Definition at line 1103 of file ProxyMgr.C.

References ResizeArray< Elem >::add(), PatchMap::homePatch(), j, ProxySpanningTreeMsg::node, nodecount, NodeIDList, Object(), PatchMap::Object(), ProxySpanningTreeMsg::patch, PatchMap::patch(), sendSpanningTree(), ProxyPatch::setSpanningTree(), ResizeArray< Elem >::size(), and ProxySpanningTreeMsg::tree.

01103                                                     {
01104   int size = msg->tree.size();
01105   int child[proxySpanDim];
01106   int nChild = 0;
01107   int i;
01108   ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01109   for (i=0; i<proxySpanDim; i++) {
01110     if (size > i+1) { child[i] = msg->tree[i+1]; nChild++; }
01111   }
01112   if (!PatchMap::Object()->homePatch(msg->patch)) {
01113     proxy->setSpanningTree(msg->node, child, nChild);
01114   }
01115 
01116   // build subtree and pass down
01117   if (nChild == 0) return;
01118 
01119   nodecount ++;
01120   //if (nodecount > MAX_INTERNODE) 
01121   //  iout << "Processor " << CkMyPe() << "has (actual) " << nodecount << " intermediate nodes." << endi;
01122 
01123 //CkPrintf("[%d] %d:(%d) %d %d %d %d %d\n", CkMyPe(), msg->patch, size, msg->tree[0], msg->tree[1], msg->tree[2], msg->tree[3], msg->tree[4]);
01124   NodeIDList *tree = new NodeIDList[proxySpanDim];
01125   int level = 1, index=1;
01126   int done = 0;
01127   while (!done) {
01128     for (int n=0; n<nChild; n++) {
01129       if (done) break;
01130       for (int j=0; j<level; j++) {
01131        if (index >= size) { done = 1; break; }
01132        tree[n].add(msg->tree[index]);
01133        index++;
01134       }
01135     }
01136     level *=proxySpanDim;
01137   }
01138 
01139   ProxyMgr *proxyMgr = ProxyMgr::Object();
01140   for (i=0; i<proxySpanDim; i++) {
01141     if (tree[i].size()) {
01142       ProxySpanningTreeMsg *cmsg = new ProxySpanningTreeMsg;
01143       cmsg->patch = msg->patch;
01144       cmsg->node = CkMyPe();
01145       cmsg->tree = tree[i];
01146       proxyMgr->sendSpanningTree(cmsg);
01147     }
01148   }
01149 
01150   delete [] tree;
01151   delete msg;
01152 }

void ProxyMgr::recvSpanningTreeOnHomePatch int  pid,
int *  tree,
int  n
 

Definition at line 1062 of file ProxyMgr.C.

References PatchMap::homePatch(), PatchMap::Object(), and HomePatch::recvSpanningTree().

Referenced by sendSpanningTreeToHomePatch().

01063 {
01064   HomePatch *p = PatchMap::Object()->homePatch(pid);
01065   p->recvSpanningTree(tree, n);
01066 }

void ProxyMgr::recvUnregisterProxy UnregisterProxyMsg  ) 
 

Definition at line 556 of file ProxyMgr.C.

References PatchMap::homePatch(), PatchMap::Object(), UnregisterProxyMsg::patch, and HomePatch::unregisterProxy().

00556                                                      {
00557   HomePatch *homePatch = PatchMap::Object()->homePatch(msg->patch);
00558   homePatch->unregisterProxy(msg); // message deleted in registerProxy()
00559 }

void ProxyMgr::registerProxy PatchID  pid  ) 
 

Definition at line 522 of file ProxyMgr.C.

References RegisterProxyMsg::node, PatchMap::node(), NodeID, PatchMap::Object(), and RegisterProxyMsg::patch.

Referenced by ProxyPatch::ProxyPatch().

00522                                    {
00523   // determine which node gets message
00524   NodeID node = PatchMap::Object()->node(pid);
00525 
00526   RegisterProxyMsg *msg = new RegisterProxyMsg;
00527 
00528   msg->node=CkMyPe();
00529   msg->patch = pid;
00530 
00531   CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
00532   cp[node].recvRegisterProxy(msg);
00533 }

void ProxyMgr::removeProxies void   ) 
 

Definition at line 402 of file ProxyMgr.C.

References UniqueSetIter< T >::begin(), UniqueSet< Elem >::clear(), UniqueSetIter< T >::end(), and ProxySetIter.

Referenced by createProxies(), and ~ProxyMgr().

00403 {
00404   ProxySetIter pi(proxySet);
00405   for ( pi = pi.begin(); pi != pi.end(); pi++)
00406   {
00407     delete pi->proxyPatch;
00408   }
00409   proxySet.clear();
00410 }

void ProxyMgr::removeProxy PatchID  pid  ) 
 

Definition at line 511 of file ProxyMgr.C.

References UniqueSet< Elem >::del(), UniqueSet< Elem >::find(), PatchMap::Object(), ProxyElem::proxyPatch, and PatchMap::unregisterPatch().

Referenced by removeUnusedProxies().

00511                                  {
00512   ProxyElem *p = proxySet.find(ProxyElem(pid));
00513   if (p) { 
00514     PatchMap::Object()->unregisterPatch(pid,p->proxyPatch);
00515     delete p->proxyPatch;
00516     proxySet.del(ProxyElem(pid));
00517     // iout << iINFO << "Removing unused proxy " << pid << " on " << iPE << ".\n" << endi;
00518   }
00519 }

void ProxyMgr::removeUnusedProxies void   ) 
 

Definition at line 412 of file ProxyMgr.C.

References ResizeArray< Elem >::add(), ResizeArray< Elem >::begin(), UniqueSetIter< T >::begin(), ResizeArray< Elem >::end(), UniqueSetIter< T >::end(), PatchID, ProxySetIter, and removeProxy().

Referenced by ComputeMgr::updateLocalComputes3().

00413 {
00414   ResizeArray<PatchID> toDelete;
00415   ProxySetIter pi(proxySet);
00416   for ( pi = pi.begin(); pi != pi.end(); pi++)
00417   {
00418     if ( pi->proxyPatch->getNumComputes() == 0 ) {
00419       toDelete.add(pi->patchID);
00420       //fprintf(stderr, "Proxy Deleted Patch %d Proc %d", pi->patchID, CkMyPe());
00421     }
00422   }
00423   PatchID *pidi = toDelete.begin();
00424   for ( ; pidi != toDelete.end(); ++pidi ) {
00425     removeProxy(*pidi);
00426   }
00427 }

void ProxyMgr::sendNodeAwareSpanningTree ProxyNodeAwareSpanningTreeMsg  ) 
 

Definition at line 1088 of file ProxyMgr.C.

References ProxyNodeAwareSpanningTreeMsg::allPes, and ProxyNodeAwareSpanningTreeMsg::patch.

Referenced by recvNodeAwareSpanningTree().

01088                                                                           {
01089   CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01090   int pe = msg->allPes[0]; //the root procID
01091 
01092 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01093   DebugFileTrace *dft = DebugFileTrace::Object();
01094   dft->openTrace();
01095   dft->writeTrace("PMgr::sndST: from proc %d for patch[%d]\n", pe, msg->patch);
01096   dft->closeTrace();
01097 #endif
01098 
01099   cp[pe].recvNodeAwareSpanningTree(msg);
01100 }

void ProxyMgr::sendNodeAwareSpanningTreeToHomePatch int  pid,
proxyTreeNode tree,
int  n
 

Definition at line 1068 of file ProxyMgr.C.

References ProxyNodeAwareSpanningTreeMsg::getANewMsg(), PatchMap::node(), and PatchMap::Object().

Referenced by sendSpanningTrees().

01069 {
01070   CProxy_ProxyMgr cp(thisgroup);
01071   ProxyNodeAwareSpanningTreeMsg *msg = ProxyNodeAwareSpanningTreeMsg::getANewMsg(pid, -1, tree, n);
01072   cp[PatchMap::Object()->node(pid)].recvNodeAwareSpanningTreeOnHomePatch(msg);
01073 }

void ProxyMgr::sendProxies int  pid,
int *  list,
int  n
 

Definition at line 591 of file ProxyMgr.C.

Referenced by HomePatch::sendProxies().

00592 {
00593   CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
00594   cp[0].recvProxies(pid, list, n);
00595 }

void ProxyMgr::sendProxyAll ProxyDataMsg ,
int  ,
int * 
 

Definition at line 1533 of file ProxyMgr.C.

References proxySendSpanning.

Referenced by HomePatch::positionsReady(), and recvImmediateProxyAll().

01533                                                              {
01534 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
01535     if(proxySendSpanning == 1) {
01536         CProxy_NodeProxyMgr cnp(CkpvAccess(BOCclass_group).nodeProxyMgr);
01537         for(int i=0; i<pcnt-1; i++) {
01538             ProxyDataMsg *copymsg = (ProxyDataMsg *)CkCopyMsg((void **)&msg);
01539             cnp[pids[i]].recvImmediateProxyAll(copymsg);
01540         }
01541         cnp[pids[pcnt-1]].recvImmediateProxyAll(msg);
01542         return;
01543     }
01544 #endif
01545   CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01546   cp.recvImmediateProxyAll(msg,pcnt,pids);
01547 }

void ProxyMgr::sendProxyData ProxyDataMsg ,
int  ,
int * 
 

Definition at line 1439 of file ProxyMgr.C.

References proxySendSpanning.

Referenced by HomePatch::positionsReady(), and recvImmediateProxyData().

01439                                                               {
01440 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
01441     if(proxySendSpanning == 1) {
01442         CProxy_NodeProxyMgr cnp(CkpvAccess(BOCclass_group).nodeProxyMgr);
01443         for(int i=0; i<pcnt-1; i++) {
01444             ProxyDataMsg *copymsg = (ProxyDataMsg *)CkCopyMsg((void **)&msg);
01445             cnp[pids[i]].recvImmediateProxyData(copymsg);
01446         }
01447         cnp[pids[pcnt-1]].recvImmediateProxyData(msg);
01448         return;
01449     }
01450 #endif
01451   CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01452   cp.recvImmediateProxyData(msg,pcnt,pids);
01453 }

void ProxyMgr::sendResults ProxyCombinedResultMsg  ) 
 

Definition at line 1342 of file ProxyMgr.C.

References ProxyPatch::depositCombinedResultMsg(), ProxyPatch::getSpanningTreeParent(), PatchMap::Object(), ProxyCombinedResultMsg::patch, and PatchMap::patch().

01342                                                  {
01343   ProxyPatch *patch = (ProxyPatch *)PatchMap::Object()->patch(msg->patch);
01344   ProxyCombinedResultMsg *cMsg = patch->depositCombinedResultMsg(msg);
01345   if (cMsg) {    
01346     int destPe = patch->getSpanningTreeParent();
01347     CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01348     if(destPe != CkMyPe()) {
01349 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
01350       /*CkPrintf("ready to call node::recvImmRes on pe[%d] to dest[%d]\n", CkMyPe(), destPe);
01351       fflush(stdout);*/
01352 
01353       cMsg->destPe = destPe;
01354       CProxy_NodeProxyMgr cnp(CkpvAccess(BOCclass_group).nodeProxyMgr);
01355       cnp[CkNodeOf(destPe)].recvImmediateResults(cMsg);
01356 #else    
01357       cp[destPe].recvImmediateResults(cMsg);
01358 #endif
01359     }
01360     else{
01361       cp[destPe].recvResults(cMsg);
01362     }
01363   }
01364 }

void ProxyMgr::sendResults ProxyResultMsg  ) 
 

Definition at line 1330 of file ProxyMgr.C.

References PatchMap::node(), NodeID, PatchMap::Object(), and ProxyResultMsg::patch.

01330                                               {
01331   CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01332   NodeID node = PatchMap::Object()->node(msg->patch);
01333   cp[node].recvResults(msg);
01334 }

void ProxyMgr::sendResults ProxyResultVarsizeMsg  ) 
 

Definition at line 1319 of file ProxyMgr.C.

References PatchMap::node(), NodeID, PatchMap::Object(), and ProxyResultVarsizeMsg::patch.

01319                                                      {
01320     CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01321     NodeID node = PatchMap::Object()->node(msg->patch);
01322     cp[node].recvResults(msg);
01323 }

void ProxyMgr::sendSpanningTree ProxySpanningTreeMsg  ) 
 

Definition at line 1083 of file ProxyMgr.C.

References ProxySpanningTreeMsg::tree.

Referenced by recvSpanningTree(), and HomePatch::sendSpanningTree().

01083                                                     {
01084   CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
01085   cp[msg->tree[0]].recvSpanningTree(msg);
01086 }

void ProxyMgr::sendSpanningTrees  ) 
 

Definition at line 1035 of file ProxyMgr.C.

References ResizeArray< Elem >::begin(), PatchMap::numPatches(), Object(), PatchMap::Object(), ProxyTree::proxylist, sendNodeAwareSpanningTreeToHomePatch(), sendSpanningTreeToHomePatch(), ResizeArray< Elem >::size(), and ProxyTree::trees.

Referenced by recvProxies(), and ComputeMgr::updateLocalComputes5().

01036 {
01037   int numPatches = PatchMap::Object()->numPatches();
01038   for (int pid=0; pid<numPatches; pid++) {
01039     int numProxies = ptree.proxylist[pid].size();
01040 #ifdef NODEAWARE_PROXY_SPANNINGTREE
01041     if (numProxies == 0)
01042       ProxyMgr::Object()->sendNodeAwareSpanningTreeToHomePatch(pid, NULL, 0);
01043     else {
01044       ProxyMgr::Object()->sendNodeAwareSpanningTreeToHomePatch(pid, ptree.naTrees[pid].begin(), ptree.naTrees[pid].size());
01045     }
01046 #else
01047     if (numProxies == 0)
01048       ProxyMgr::Object()->sendSpanningTreeToHomePatch(pid, NULL, 0);
01049     else {
01050       ProxyMgr::Object()->sendSpanningTreeToHomePatch(pid, ptree.trees[pid].begin(), ptree.trees[pid].size());
01051     }
01052 #endif
01053   }
01054 }

void ProxyMgr::sendSpanningTreeToHomePatch int  pid,
int *  tree,
int  n
 

Definition at line 1056 of file ProxyMgr.C.

References PatchMap::node(), PatchMap::Object(), and recvSpanningTreeOnHomePatch().

Referenced by sendSpanningTrees().

01057 {
01058   CProxy_ProxyMgr cp(thisgroup);
01059   cp[PatchMap::Object()->node(pid)].recvSpanningTreeOnHomePatch(pid, tree, n);
01060 }

void ProxyMgr::setRecvSpanning  ) 
 

Definition at line 390 of file ProxyMgr.C.

References proxyRecvSpanning.

Referenced by Node::startup().

00390                                {
00391   proxyRecvSpanning = 1;
00392 }

void ProxyMgr::setSendSpanning  ) 
 

Definition at line 382 of file ProxyMgr.C.

References proxySendSpanning.

Referenced by WorkDistrib::saveMaps(), WorkDistrib::sendMaps(), and Node::startup().

00382                                {
00383   proxySendSpanning = 1;
00384 }

void ProxyMgr::unregisterProxy PatchID  pid  ) 
 

Definition at line 542 of file ProxyMgr.C.

References UnregisterProxyMsg::node, PatchMap::node(), NodeID, PatchMap::Object(), and UnregisterProxyMsg::patch.

Referenced by ProxyPatch::~ProxyPatch().

00542                                      {
00543   // determine which node gets message
00544   NodeID node = PatchMap::Object()->node(pid);
00545 
00546   UnregisterProxyMsg *msg = new UnregisterProxyMsg;
00547 
00548   msg->node=CkMyPe();
00549   msg->patch = pid;
00550 
00551   CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
00552   cp[node].recvUnregisterProxy(msg);
00553 }


Member Data Documentation

int ProxyMgr::nodecount = 0 [static]
 

Definition at line 367 of file ProxyMgr.C.

Referenced by recvNodeAwareSpanningTree(), and recvSpanningTree().


The documentation for this class was generated from the following files:
Generated on Sat Nov 7 04:07:56 2009 for NAMD by  doxygen 1.3.9.1