NAMD
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ProxyMgr Class Reference

#include <ProxyMgr.h>

Inheritance diagram for ProxyMgr:

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 setProxyTreeBranchFactor (int dim)
 
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 recvPatchProxyInfo (PatchProxyListMsg *msg)
 
void buildSpanningTree0 ()
 
void sendResults (ProxyResultVarsizeMsg *)
 
void recvResults (ProxyResultVarsizeMsg *)
 
void sendResults (ProxyResultMsg *)
 
void recvResults (ProxyResultMsg *)
 
void sendResults (ProxyCombinedResultMsg *)
 
void sendResult (ProxyGBISP1ResultMsg *)
 
void recvResult (ProxyGBISP1ResultMsg *)
 
void recvData (ProxyGBISP2DataMsg *)
 
void sendResult (ProxyGBISP2ResultMsg *)
 
void recvResult (ProxyGBISP2ResultMsg *)
 
void recvData (ProxyGBISP3DataMsg *)
 
void recvResults (ProxyCombinedResultRawMsg *)
 
void recvImmediateResults (ProxyCombinedResultRawMsg *)
 
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

static ProxyMgrObject ()
 

Static Public Attributes

static int nodecount = 0
 

Detailed Description

Definition at line 316 of file ProxyMgr.h.

Constructor & Destructor Documentation

◆ ProxyMgr()

ProxyMgr::ProxyMgr ( )

Definition at line 348 of file ProxyMgr.C.

References NAMD_bug().

348  {
349  if (CkpvAccess(ProxyMgr_instance)) {
350  NAMD_bug("Tried to create ProxyMgr twice.");
351  }
352  CkpvAccess(ProxyMgr_instance) = this;
353 }
void NAMD_bug(const char *err_msg)
Definition: common.C:195

◆ ~ProxyMgr()

ProxyMgr::~ProxyMgr ( )

Definition at line 355 of file ProxyMgr.C.

References removeProxies().

355  {
356  removeProxies();
357  CkpvAccess(ProxyMgr_instance) = NULL;
358 }
void removeProxies(void)
Definition: ProxyMgr.C:388

Member Function Documentation

◆ buildProxySpanningTree()

void ProxyMgr::buildProxySpanningTree ( )

Definition at line 558 of file ProxyMgr.C.

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

Referenced by Node::startup().

559 {
560  PatchIDList pids;
561  if (!CkMyPe()) iout << iINFO << "Building spanning tree ... send: " << proxySendSpanning << " recv: " << proxyRecvSpanning
562  << " with branch factor " << proxySpanDim <<"\n" << endi;
564  for (int i=0; i<pids.size(); i++) {
565  HomePatch *home = PatchMap::Object()->homePatch(pids[i]);
566  if (home == NULL) CkPrintf("ERROR: homepatch NULL\n");
567 #ifdef NODEAWARE_PROXY_SPANNINGTREE
568  home->buildNodeAwareSpanningTree();
569 #else
570  home->buildSpanningTree();
571 #endif
572  }
573 }
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
int size(void) const
Definition: ResizeArray.h:131
int proxyRecvSpanning
Definition: ProxyMgr.C:45
static PatchMap * Object()
Definition: PatchMap.h:27
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define iout
Definition: InfoStream.h:51
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
void homePatchIDList(PatchIDList &)
Definition: PatchMap.C:443
void buildSpanningTree(void)
Definition: HomePatch.C:715
int proxySpanDim
Definition: ProxyMgr.C:47
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ buildProxySpanningTree2()

void ProxyMgr::buildProxySpanningTree2 ( )

Definition at line 576 of file ProxyMgr.C.

References ResizeArrayIter< T >::begin(), ResizeArrayIter< T >::end(), PatchMap::homePatch(), PatchMap::homePatchIDList(), PatchMap::homePatchList(), PatchMap::Object(), HomePatch::sendProxies(), and ResizeArray< Elem >::size().

Referenced by ComputeMgr::updateLocalComputes5().

577 {
578 #if 0
579  //The homePatchIDList is an expensive as it goes through
580  //every patch ids.
581  PatchIDList pids;
583  for (int i=0; i<pids.size(); i++) {
584  HomePatch *home = PatchMap::Object()->homePatch(pids[i]);
585  if (home == NULL) CkPrintf("ERROR: homepatch NULL\n");
586  home->sendProxies();
587  }
588 #else
590  HomePatchListIter iter(*hpl);
591  for(iter=iter.begin(); iter!=iter.end(); iter++) {
592  HomePatch *home = iter->patch;
593  home->sendProxies();
594  }
595 #endif
596 }
void sendProxies()
Definition: HomePatch.C:509
int size(void) const
Definition: ResizeArray.h:131
static PatchMap * Object()
Definition: PatchMap.h:27
HomePatchList * homePatchList()
Definition: PatchMap.C:438
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
void homePatchIDList(PatchIDList &)
Definition: PatchMap.C:443

◆ buildSpanningTree0()

void ProxyMgr::buildSpanningTree0 ( )

Definition at line 1006 of file ProxyMgr.C.

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

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

1007 {
1008  CkPrintf("Info: build spanning tree with send: %d, recv: %d with branch factor %d\n",
1010 
1011  int i;
1012 
1013  processCpuLoad();
1014 
1015  int *numPatchesOnNode = new int[CkNumPes()];
1016  int numNodesWithPatches = 0;
1017  for (i=0; i<CkNumPes(); i++) numPatchesOnNode[i] = 0;
1018  int numPatches = PatchMap::Object()->numPatches();
1019  for (i=0; i<numPatches; i++) {
1020  int node = PatchMap::Object()->node(i);
1021  numPatchesOnNode[node]++;
1022  if (numPatchesOnNode[node] == 1)
1023  numNodesWithPatches ++;
1024  }
1025  int patchNodesLast =
1026  ( numNodesWithPatches < ( 0.7 * CkNumPes() ) );
1027  int *ntrees = new int[CkNumPes()];
1028  for (i=0; i<CkNumPes(); i++) ntrees[i] = 0;
1029  if (ptree.trees == NULL) ptree.trees = new NodeIDList[numPatches];
1030  for (int pid=0; pid<numPatches; pid++)
1031  {
1032  int numProxies = ptree.proxylist[pid].size();
1033  if (numProxies == 0) {
1034  //CkPrintf ("This is sheer evil!\n\n");
1035  //ProxyMgr::Object()->sendSpanningTreeToHomePatch(pid, NULL, 0);
1036  delete [] ntrees;
1037  delete [] numPatchesOnNode;
1038  return;
1039  }
1040  NodeIDList &tree = ptree.trees[pid]; // spanning tree
1041  NodeIDList oldtree; oldtree.swap(tree);
1042  tree.resize(numProxies+1);
1043  tree.setall(-1);
1044  tree[0] = PatchMap::Object()->node(pid);
1045  int s=1, e=numProxies;
1046  int nNonPatch = 0;
1047  int treesize = 1;
1048  int pp;
1049 
1050  // keep tree persistent for non-intermediate nodes
1051  for (pp=0; pp<numProxies; pp++) {
1052  int p = ptree.proxylist[pid][pp];
1053  int oldindex = oldtree.find(p);
1054  if (oldindex != -1 && oldindex <= numProxies) {
1055  int isIntermediate = (oldindex*proxySpanDim+1 <= numProxies);
1056  if (!isIntermediate) {
1057  tree[oldindex] = p;
1058  }
1059  else if (ntrees[p] < MAX_INTERNODE) {
1060  tree[oldindex] = p;
1061  ntrees[p] ++;
1062  }
1063  }
1064  }
1065 
1066  for (pp=0; pp<numProxies; pp++) {
1067  int p = ptree.proxylist[pid][pp]; // processor number
1068  if (tree.find(p) != -1) continue; // already used
1069  treesize++;
1070  if (patchNodesLast && numPatchesOnNode[p] ) {
1071  while (tree[e] != -1) { e--; if (e==-1) e = numProxies; }
1072  tree[e] = p;
1073  int isIntermediate = (e*proxySpanDim+1 <= numProxies);
1074  if (isIntermediate) ntrees[p]++;
1075  }
1076  else {
1077  while (tree[s] != -1) { s++; if (s==numProxies+1) s = 1; }
1078  int isIntermediate = (s*proxySpanDim+1 <= numProxies);
1079  if (isIntermediate && (ntrees[p] >= MAX_INTERNODE || noInterNode(p))) { // TOO MANY INTERMEDIATE TREES
1080  //if (isIntermediate && ntrees[p] >= MAX_INTERNODE) // TOO MANY INTERMEDIATE TREES
1081  while (tree[e] != -1) { e--; if (e==-1) e = numProxies; }
1082  tree[e] = p;
1083  isIntermediate = (e*proxySpanDim+1 <= numProxies);
1084  if (isIntermediate) ntrees[p]++;
1085  }
1086  else {
1087  tree[s] = p;
1088  nNonPatch++;
1089  if (isIntermediate) ntrees[p]++;
1090  }
1091  }
1092  }
1093  // send homepatch's proxy tree
1094  if(ptree.sizes)
1095  ptree.sizes[pid] = treesize;
1096  //ProxyMgr::Object()->sendSpanningTreeToHomePatch(pid, &tree[0], treesize);
1097  }
1098  /*for (i=0; i<CkNumPes(); i++) {
1099  if (ntrees[i] > MAX_INTERNODE) iout << "Processor " << i << "has (guess) " << ntrees[i] << " intermediate nodes." << endi;
1100  }*/
1101  delete [] ntrees;
1102  delete [] numPatchesOnNode;
1103 }
int size(void) const
Definition: ResizeArray.h:131
int proxyRecvSpanning
Definition: ProxyMgr.C:45
static PatchMap * Object()
Definition: PatchMap.h:27
static void processCpuLoad()
Definition: ProxyMgr.C:712
void resize(int i)
Definition: ResizeArray.h:84
void setall(const Elem &elem)
Definition: ResizeArray.h:94
int numPatches(void) const
Definition: PatchMap.h:59
int * sizes
Definition: ProxyMgr.h:298
NodeIDList * trees
Definition: ProxyMgr.h:297
static int noInterNode(int p)
Definition: ProxyMgr.C:728
NodeIDList * proxylist
Definition: ProxyMgr.h:291
#define MAX_INTERNODE
Definition: ProxyMgr.C:608
int find(const Elem &e) const
Definition: ResizeArray.h:141
int node(int pid) const
Definition: PatchMap.h:114
void swap(ResizeArray< Elem > &ra)
Definition: ResizeArray.h:64
int proxySpanDim
Definition: ProxyMgr.C:47
int numProxies()
Definition: ProxyMgr.h:396
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ createProxies()

void ProxyMgr::createProxies ( void  )

Definition at line 416 of file ProxyMgr.C.

References UniqueSet< Elem >::add(), PatchMap::basePatchIDList(), computeNonbondedPairType, computeNonbondedSelfType, PatchMap::MaxOneAway, ComputeMap::node(), PatchMap::node(), ComputeMap::numComputes(), PatchMap::numPatches(), ComputeMap::numPids(), PatchMap::Object(), ComputeMap::Object(), ComputeMap::pid(), PatchMap::registerPatch(), removeProxies(), ResizeArray< Elem >::size(), ComputeMap::type(), and PatchMap::upstreamNeighbors().

Referenced by Node::startup().

417 {
418  // Delete the old proxies.
419  removeProxies();
420 
421  PatchMap *patchMap = PatchMap::Object();
422  int numPatches = patchMap->numPatches();
423  int myNode = CkMyPe();
424  enum PatchFlag { Unknown, Home, NeedProxy };
425  int *patchFlag = new int[numPatches];
426  int i, j;
427 
428  // Note all home patches.
429  for ( i = 0; i < numPatches; ++i )
430  {
431  patchFlag[i] = ( patchMap->node(i) == myNode ) ? Home : Unknown;
432  }
433 
434 #if !(defined(NAMD_CUDA) || defined(NAMD_HIP))
435  // Add all upstream neighbors.
436  PatchID neighbors[PatchMap::MaxOneAway];
437  PatchIDList basepids;
438  patchMap->basePatchIDList(myNode,basepids);
439  for ( i = 0; i < basepids.size(); ++i )
440  {
441  if ( patchMap->node(basepids[i]) != myNode ) {
442  patchFlag[basepids[i]] = NeedProxy;
443  }
444  int numNeighbors = patchMap->upstreamNeighbors(basepids[i],neighbors);
445  for ( j = 0; j < numNeighbors; ++j )
446  {
447  if ( ! patchFlag[neighbors[j]] ) {
448  patchFlag[neighbors[j]] = NeedProxy;
449  }
450  }
451  }
452 #endif
453 
454  ComputeMap *computeMap = ComputeMap::Object();
455 
456  // Check all patch-based compute objects.
457  int nc = computeMap->numComputes();
458  for ( i = 0; i < nc; ++i )
459  {
460 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
461  ComputeType t = computeMap->type(i);
463  continue;
464 #elif defined(NAMD_MIC)
465  ComputeType t = computeMap->type(i);
466  if ( computeMap->directToDevice(i) != 0 ) { continue; } // NOTE: Compute for device will take care of requiring the patch
467 #endif
468  if ( computeMap->node(i) != myNode )
469  continue;
470  int numPid = computeMap->numPids(i);
471  for ( j = 0; j < numPid; ++j )
472  {
473  int pid = computeMap->pid(i,j);
474  if ( ! patchFlag[pid] ) {
475  patchFlag[pid] = NeedProxy;
476  }
477  }
478  }
479  // Create proxy list
480  for ( i = 0; i < numPatches; ++i ) {
481  if ( patchFlag[i] == NeedProxy )
482  { // create proxy patch
483  ProxyPatch *proxy = new ProxyPatch(i);
484  proxySet.add(ProxyElem(i, proxy));
485  patchMap->registerPatch(i, proxy);
486  }
487  }
488  delete[] patchFlag;
489 }
int size(void) const
Definition: ResizeArray.h:131
int numComputes(void)
Definition: ComputeMap.h:101
static PatchMap * Object()
Definition: PatchMap.h:27
ComputeType
Definition: ComputeMap.h:20
void basePatchIDList(int pe, PatchIDList &)
Definition: PatchMap.C:454
int upstreamNeighbors(int pid, PatchID *neighbor_ids)
Definition: PatchMap.C:669
int add(const Elem &elem)
Definition: UniqueSet.h:52
int numPatches(void) const
Definition: PatchMap.h:59
ComputeType type(ComputeID cid)
Definition: ComputeMap.C:118
static ComputeMap * Object()
Definition: ComputeMap.h:89
void removeProxies(void)
Definition: ProxyMgr.C:388
int node(ComputeID cid)
Definition: ComputeMap.h:106
int numPids(ComputeID cid)
Definition: ComputeMap.C:101
int pid(ComputeID cid, int i)
Definition: ComputeMap.C:107
void registerPatch(PatchID pid, HomePatch *pptr)
Definition: PatchMap.C:786
int node(int pid) const
Definition: PatchMap.h:114
int32 PatchID
Definition: NamdTypes.h:277

◆ createProxy()

void ProxyMgr::createProxy ( PatchID  pid)

Definition at line 492 of file ProxyMgr.C.

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

Referenced by ComputeHomeTuples< TholeElem, Thole, TholeValue >::initialize(), and ComputeMgr::updateLocalComputes().

492  {
493  Patch *p = PatchMap::Object()->patch(pid);
494  if (!p) {
495  DebugM(4,"createProxy("<<pid<<")\n");
496  ProxyPatch *proxy = new ProxyPatch(pid);
497  proxySet.add(ProxyElem(pid,proxy));
498  PatchMap::Object()->registerPatch(pid,proxy);
499  }
500  else {
501  DebugM(4,"createProxy("<<pid<<") found " << p->getPatchID() << "\n");
502  }
503 
504 }
static PatchMap * Object()
Definition: PatchMap.h:27
#define DebugM(x, y)
Definition: Debug.h:75
int add(const Elem &elem)
Definition: UniqueSet.h:52
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
Definition: Patch.h:35
PatchID getPatchID() const
Definition: Patch.h:114
void registerPatch(PatchID pid, HomePatch *pptr)
Definition: PatchMap.C:786

◆ getPtree()

ProxyTree & ProxyMgr::getPtree ( )

Definition at line 384 of file ProxyMgr.C.

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

384  {
385  return ptree;
386 }

◆ getRecvSpanning()

int ProxyMgr::getRecvSpanning ( )

Definition at line 375 of file ProxyMgr.C.

References proxyRecvSpanning.

Referenced by Node::startup().

375  {
376  return proxyRecvSpanning;
377 }
int proxyRecvSpanning
Definition: ProxyMgr.C:45

◆ getSendSpanning()

int ProxyMgr::getSendSpanning ( )

Definition at line 366 of file ProxyMgr.C.

References proxySendSpanning.

Referenced by Node::startup().

366  {
367  return proxySendSpanning;
368 }
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ numProxies()

int ProxyMgr::numProxies ( )
inline

Definition at line 396 of file ProxyMgr.h.

Referenced by buildSpanningTree0(), and sendSpanningTrees().

396 { return proxySet.size(); }
int size(void) const
Definition: UniqueSet.h:58

◆ Object()

static ProxyMgr* ProxyMgr::Object ( )
inlinestatic

◆ recvData() [1/2]

void ProxyMgr::recvData ( ProxyGBISP2DataMsg msg)

Definition at line 1861 of file ProxyMgr.C.

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

1861  { //hp -d> pp
1862  ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
1863  proxy->receiveData(msg); // deleted in ProxyPatch::receiveAtoms() ?
1864 }
static PatchMap * Object()
Definition: PatchMap.h:27
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
void receiveData(ProxyDataMsg *)
Definition: ProxyPatch.C:168

◆ recvData() [2/2]

void ProxyMgr::recvData ( ProxyGBISP3DataMsg msg)

Definition at line 1876 of file ProxyMgr.C.

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

1876  { //hp -d> pp
1877  ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
1878  proxy->receiveData(msg); // deleted in ProxyPatch::receiveAtoms() ?
1879 }
static PatchMap * Object()
Definition: PatchMap.h:27
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
void receiveData(ProxyDataMsg *)
Definition: ProxyPatch.C:168

◆ recvImmediateProxyAll()

void ProxyMgr::recvImmediateProxyAll ( ProxyDataMsg msg)

Definition at line 1710 of file ProxyMgr.C.

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

1710  {
1711  ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
1712  #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
1713  DebugFileTrace *dft = DebugFileTrace::Object();
1714  dft->openTrace();
1715  dft->writeTrace("PMgr::recvImmPAll for patch[%d]\n", msg->patch);
1716  CmiAssert(proxy!=NULL);
1717  dft->writeTrace("PMgr::recvImmPAll assertion OK for patch[%d]\n", msg->patch);
1718  dft->closeTrace();
1719  #endif
1720  if (proxySendSpanning == 1) {
1721  // copy the message and send to spanning children
1722  //int *pids = (int*)alloca(proxy->getSpanningTreeNChild()*sizeof(int));
1723  //int npid = proxy->getSpanningTreeChild(pids);
1724  int npid = proxy->getSpanningTreeNChild();
1725  int *pids = (int *)proxy->getSpanningTreeChildPtr();
1726  if (npid) {
1727  ProxyDataMsg *newmsg = (ProxyDataMsg *)CkCopyMsg((void **)&msg);
1728 #if CMK_PERSISTENT_COMM && USE_PERSISTENT_TREE
1729  int ntreephs;
1730  PersistentHandle *treephs = proxy->getSpanningTreePhs(ntreephs);
1731  CmiAssert(treephs && ntreephs == npid);
1732  CmiUsePersistentHandle(treephs, ntreephs);
1733 #endif
1734  ProxyMgr::Object()->sendProxyAll(newmsg,npid,pids);
1735 #if CMK_PERSISTENT_COMM && USE_PERSISTENT_TREE
1736  CmiUsePersistentHandle(NULL, 0);
1737 #endif
1738  }
1739  }
1740  /* send to self via EP method to preserve priority */
1741  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1742  cp[CkMyPe()].recvProxyAll(msg);
1743 }
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
static PatchMap * Object()
Definition: PatchMap.h:27
int getSpanningTreeNChild(void)
Definition: ProxyPatch.h:36
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
PatchID patch
Definition: ProxyMgr.h:97
void sendProxyAll(ProxyDataMsg *, int, int *)
Definition: ProxyMgr.C:1676
const int * getSpanningTreeChildPtr()
Definition: ProxyPatch.h:35
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ recvImmediateProxyData()

void ProxyMgr::recvImmediateProxyData ( ProxyDataMsg msg)

Definition at line 1595 of file ProxyMgr.C.

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

1595  {
1596  ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
1597  if (proxySendSpanning == 1) {
1598  // copy the message and send to spanning children
1599  //int *pids = (int*)alloca(proxy->getSpanningTreeNChild()*sizeof(int));
1600  //int npid = proxy->getSpanningTreeChild(pids);
1601  int npid = proxy->getSpanningTreeNChild();
1602  int *pids = (int *)proxy->getSpanningTreeChildPtr();
1603  if (npid) {
1604  ProxyDataMsg *newmsg = (ProxyDataMsg *)CkCopyMsg((void **)&msg);
1605 #if CMK_PERSISTENT_COMM && USE_PERSISTENT_TREE
1606  int ntreephs;
1607  PersistentHandle *treephs = proxy->getSpanningTreePhs(ntreephs);
1608  CmiAssert(treephs && ntreephs == npid);
1609  CmiUsePersistentHandle(treephs, ntreephs);
1610 #endif
1611  ProxyMgr::Object()->sendProxyData(newmsg,npid,pids);
1612 #if CMK_PERSISTENT_COMM && USE_PERSISTENT_TREE
1613  CmiUsePersistentHandle(NULL, 0);
1614 #endif
1615  #if 0
1616  //ChaoMei: buggy code??? the spanning tree doesn't always have 2 levels
1617  //At the second level of the tree immediate messages are not needed
1618  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1619  cp.recvProxyData(newmsg,npid,pids);
1620  #endif
1621  }
1622  }
1623  /* send to self via EP method to preserve priority */
1624  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1625  cp[CkMyPe()].recvProxyData(msg);
1626 }
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
static PatchMap * Object()
Definition: PatchMap.h:27
int getSpanningTreeNChild(void)
Definition: ProxyPatch.h:36
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
PatchID patch
Definition: ProxyMgr.h:97
void sendProxyData(ProxyDataMsg *, int, int *)
Definition: ProxyMgr.C:1562
const int * getSpanningTreeChildPtr()
Definition: ProxyPatch.h:35
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ recvImmediateResults()

void ProxyMgr::recvImmediateResults ( ProxyCombinedResultRawMsg omsg)

Definition at line 1505 of file ProxyMgr.C.

References ProxyPatch::depositCombinedResultRawMsg(), ProxyPatch::getSpanningTreeParent(), PatchMap::homePatch(), PatchMap::Object(), PatchMap::patch(), ProxyCombinedResultRawMsg::patch, and ProxyCombinedResultMsg::toRaw().

1505  {
1506  HomePatch *home = PatchMap::Object()->homePatch(omsg->patch);
1507  if (home) {
1508  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1509  CmiEnableUrgentSend(1);
1510  cp[CkMyPe()].recvResults(omsg);
1511  CmiEnableUrgentSend(0);
1512  }
1513  else {
1514  ProxyPatch *patch = (ProxyPatch *)PatchMap::Object()->patch(omsg->patch);
1516  if (ocMsg) {
1517  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1519  cp[patch->getSpanningTreeParent()].recvImmediateResults(cMsg);
1520  }
1521  }
1522 }
static PatchMap * Object()
Definition: PatchMap.h:27
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
static ProxyCombinedResultRawMsg * toRaw(ProxyCombinedResultMsg *msg)
Definition: ProxyMgr.C:247
ProxyCombinedResultMsg * depositCombinedResultRawMsg(ProxyCombinedResultRawMsg *)
Definition: ProxyPatch.C:540
int getSpanningTreeParent()
Definition: ProxyPatch.h:33

◆ recvNodeAwareSpanningTree()

void ProxyMgr::recvNodeAwareSpanningTree ( ProxyNodeAwareSpanningTreeMsg msg)

Definition at line 1229 of file ProxyMgr.C.

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

1229  {
1230 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
1231  DebugFileTrace *dft = DebugFileTrace::Object();
1232  dft->openTrace();
1233  dft->writeTrace("PMgr::recvST0 for patch[%d] with #nodes=%d\n", msg->patch, msg->numNodesWithProxies);
1234  dft->closeTrace();
1235  msg->printOut("PMgr::recvST");
1236 #endif
1237 
1238  //This function is divided into three parts. The tree root is msg->allPes[0]
1239  //1. set up its own immediate childrens
1240  int treesize = msg->numNodesWithProxies; //at least include one as its internal procs
1241  int iNChild = msg->numPesOfNode[0]-1; //number of internal children
1242  int eNChild = treesize-1; //number of external children
1243 
1244  CmiAssert(treesize>0);
1245  //use the same way of computing children in HomePatch::setupChildrenFromProxySpanningTree
1246  eNChild = (proxySpanDim>eNChild)?eNChild:proxySpanDim;
1247  int iSlots = proxySpanDim-eNChild;
1248  if(iNChild>0) {
1249  if(iSlots==0){
1250  //at least having one internal child
1251  iNChild = 1;
1252  }else{
1253  iNChild = (iSlots>iNChild)?iNChild:iSlots;
1254  }
1255  }
1256  int numChild = iNChild + eNChild;
1257  if(numChild==0){
1258  //Indicating this proxy is a leaf in the spanning tree
1259  ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
1260  proxy->setSpanningTree(msg->procID, NULL, 0);
1261 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
1262  //When using NODEPATCHMGR, the proc-level is a flat list attached to the node
1263  //while the node-level spanning tree obeys the branch factor.
1264  //As a result, when passing down spanning trees, if this proc is on the same node
1265  //of its parent, then the NodeProxyMgr has already been set by its parent. There's
1266  //no need resetting here. However, the nodeChildren attached to this proxy has
1267  //to be set to NULL. -Chao Mei
1268  int onSameNode = (CkMyNode() == CkNodeOf(msg->procID));
1269  //set up proxyInfo inside NodeProxyMgr
1270  if(!onSameNode && !PatchMap::Object()->homePatch(msg->patch)){
1271  //only when this processor contains a proxy patch of "msg->patch"
1272  //is the patch registeration in NodeProxyMgr needed,
1273  //and itself needs to be registered
1274  CProxy_NodeProxyMgr pm(CkpvAccess(BOCclass_group).nodeProxyMgr);
1275  NodeProxyMgr *npm = pm[CkMyNode()].ckLocalBranch();
1276  npm->registerPatch(msg->patch, msg->numPesOfNode[0], msg->allPes);
1277  }
1278  //set children in terms of node ids
1279  proxy->setSTNodeChildren(0, NULL);
1280 #endif
1281  delete msg;
1282  return;
1283  }
1284 
1285  nodecount++;
1286  //if (nodecount > MAX_INTERNODE)
1287  // iout << "Processor " << CkMyPe() << "has (actual) " << nodecount << " intermediate nodes." << endi;
1288 
1289  if(!PatchMap::Object()->homePatch(msg->patch)){
1290  //the home patch of this spanning tree has been already set
1291  //in HomePatch::setupChildrenFromProxySpanningTree, so we
1292  //only care about the children setup for proxy patches here
1293  ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
1294  ALLOCA(int,children,numChild);
1295  //add external children
1296  int *p = msg->allPes + msg->numPesOfNode[0];
1297  for(int i=0; i<eNChild; i++) {
1298  children[i] = *p;
1299  p += msg->numPesOfNode[i+1];
1300  }
1301  //add internal children
1302  for(int i=eNChild, j=1; i<numChild; i++, j++) {
1303  children[i] = msg->allPes[j];
1304  }
1305  proxy->setSpanningTree(msg->procID, children, numChild);
1306 
1307 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
1308  int onSameNode = (CkMyNode() == CkNodeOf(msg->procID));
1309  if(!onSameNode) {
1310  //set up proxyInfo inside NodeProxyMgr
1311  CProxy_NodeProxyMgr pm(CkpvAccess(BOCclass_group).nodeProxyMgr);
1312  NodeProxyMgr *npm = pm[CkMyNode()].ckLocalBranch();
1313  npm->registerPatch(msg->patch, msg->numPesOfNode[0], msg->allPes);
1314 
1315  //set children in terms of node ids
1316  ALLOCA(int,nodeChildren,eNChild+1);
1317  p = msg->allPes + msg->numPesOfNode[0];
1318  for(int i=0; i<eNChild; i++) {
1319  nodeChildren[i] = CkNodeOf(*p);
1320  p += msg->numPesOfNode[i+1];
1321  }
1322  //the last entry always stores the node id that contains this proxy
1323  nodeChildren[eNChild] = CkNodeOf(msg->allPes[0]);
1324  proxy->setSTNodeChildren(eNChild+1, nodeChildren);
1325  } else {
1326  proxy->setSTNodeChildren(0, NULL);
1327  }
1328 #endif
1329  }
1330 
1331  //2. send msgs for the tree to children proxies
1332  ResizeArray<int> *exTreeChildSize = new ResizeArray<int>[numChild];
1333  ResizeArray<int *> *exTreeChildPtr = new ResizeArray<int *>[numChild];
1334 
1335  //2a. first processing children of external nodes
1336  if(eNChild > 0) {
1337  int nodesToCnt = 1; //the number of children each root (current root's
1338  //immedidate external nodes) has in each level
1339  int pos = 1; //track the iteration over msg->numPesOfNode and skip the current root
1340  int *pePtr = msg->allPes + msg->numPesOfNode[0];
1341  int done = 0;
1342  while(!done) {
1343  for(int childID=0; childID<eNChild; childID++) {
1344  //iterate nodes on each level
1345  for(int i=0; i<nodesToCnt; i++) {
1346  int cursize = msg->numPesOfNode[pos];
1347  exTreeChildSize[childID].add(cursize);
1348  exTreeChildPtr[childID].add(pePtr);
1349  pos++;
1350  pePtr += cursize;
1351  if(pos==msg->numNodesWithProxies) {
1352  done = 1;
1353  break;
1354  }
1355  }
1356  if(done) break;
1357  }
1358  nodesToCnt *= proxySpanDim;
1359  }
1360  }
1361 
1362  //2b. secondly processing children on the same node
1363  if(iNChild>0) {
1364  int nodesToCnt = 1; //the number of children each root (current root's
1365  //immedidate internal child proxies) has in each level
1366  int pos = 1; //track the iteration over proxies on the same node and skip the current root
1367  int *pePtr = msg->allPes+1; //skip the root
1368  int done = 0;
1369  while(!done) {
1370  for(int childID=eNChild; childID<numChild; childID++) {
1371  //iterate nodes on each level
1372  for(int i=0; i<nodesToCnt; i++) {
1373  exTreeChildSize[childID].add(1);
1374  exTreeChildPtr[childID].add(pePtr);
1375  pos++;
1376  pePtr++;
1377  if(pos==msg->numPesOfNode[0]) {
1378  done = 1;
1379  break;
1380  }
1381  }
1382  if(done) break;
1383  }
1384  nodesToCnt *= proxySpanDim;
1385  }
1386  }
1387 
1388  for(int i=0; i<numChild; i++) {
1389  ResizeArray<int> *allSizes = &exTreeChildSize[i];
1390  ResizeArray<int *> *allPtrs = &exTreeChildPtr[i];
1391  int totalNodes = allSizes->size();
1392  int totalPes = 0;
1393  for(int j=0; j<totalNodes; j++) totalPes += allSizes->item(j);
1394  ProxyNodeAwareSpanningTreeMsg *cmsg = new(totalNodes, totalPes, 0) ProxyNodeAwareSpanningTreeMsg;
1395  cmsg->patch = msg->patch;
1396  cmsg->procID = CkMyPe();
1397  cmsg->numNodesWithProxies = totalNodes;
1398  int *pAllPes = cmsg->allPes;
1399  for(int j=0; j<totalNodes; j++) {
1400  int numPes = allSizes->item(j);
1401  cmsg->numPesOfNode[j] = numPes;
1402  memcpy(pAllPes, allPtrs->item(j), sizeof(int)*numPes);
1403  pAllPes += numPes;
1404  }
1405  #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
1406  cmsg->printOut("sndChi:");
1407  #endif
1409  }
1410  delete [] exTreeChildSize;
1411  delete [] exTreeChildPtr;
1412  delete msg;
1413 }
int size(void) const
Definition: ResizeArray.h:131
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
static PatchMap * Object()
Definition: PatchMap.h:27
void sendNodeAwareSpanningTree(ProxyNodeAwareSpanningTreeMsg *)
Definition: ProxyMgr.C:1159
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
int add(const Elem &elem)
Definition: ResizeArray.h:101
#define ALLOCA(TYPE, NAME, SIZE)
Definition: ProxyMgr.C:42
Elem & item(int i)
Definition: ResizeArray.h:119
void setSpanningTree(int, int *, int)
Definition: ProxyPatch.C:455
void printOut(char *tag)
Definition: ProxyMgr.C:217
static int nodecount
Definition: ProxyMgr.h:398
void registerPatch(int patchID, int numPes, int *pes)
Definition: ProxyMgr.C:1839
int proxySpanDim
Definition: ProxyMgr.C:47

◆ recvNodeAwareSpanningTreeOnHomePatch()

void ProxyMgr::recvNodeAwareSpanningTreeOnHomePatch ( ProxyNodeAwareSpanningTreeMsg msg)

Definition at line 1146 of file ProxyMgr.C.

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

1147 {
1148  HomePatch *p = PatchMap::Object()->homePatch(msg->patch);
1149  p->recvNodeAwareSpanningTree(msg);
1150  delete msg;
1151 }
static PatchMap * Object()
Definition: PatchMap.h:27
void recvNodeAwareSpanningTree(ProxyNodeAwareSpanningTreeMsg *msg)
Definition: HomePatch.C:671
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249

◆ recvNodeAwareSTParent()

void ProxyMgr::recvNodeAwareSTParent ( int  patch,
int  parent 
)

Definition at line 1415 of file ProxyMgr.C.

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

1415  {
1416 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
1417  DebugFileTrace *dft = DebugFileTrace::Object();
1418  dft->openTrace();
1419  dft->writeTrace("PMgr::recvSTParent: for ProxyPatch[%d], parent is %d\n", patch, parent);
1420  dft->closeTrace();
1421 #endif
1422  ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(patch);
1423  CmiAssert(proxy!=NULL);
1424  proxy->setSpanningTree(parent, NULL, 0);
1425 }
static PatchMap * Object()
Definition: PatchMap.h:27
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
void setSpanningTree(int, int *, int)
Definition: ProxyPatch.C:455

◆ recvPatchProxyInfo()

void ProxyMgr::recvPatchProxyInfo ( PatchProxyListMsg msg)

Definition at line 658 of file ProxyMgr.C.

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

658  {
659  int nPatches = PatchMap::Object()->numPatches();
660  if(ptree.proxylist == NULL) ptree.proxylist = new NodeIDList[nPatches];
661  CmiAssert(msg->numPatches == nPatches);
662  int peIdx = 0;
663  for(int i=0; i<nPatches; i++) {
664  int pid = msg->patchIDs[i];
665  int plen = msg->proxyListLen[i];
666  ptree.proxylist[pid].resize(plen);
667  for(int j=0; j<plen; j++) {
668  ptree.proxylist[pid][j] = msg->proxyPEs[peIdx++];
669  }
670  }
671  delete msg;
672 
673  //debug
674  //outputProxyTree(ptree, nPatches);
675 
676  ptree.proxyMsgCount = 0;
677  // building and sending of trees is done in two steps now
678  // so that the building step can be shifted to the load balancer
679 #ifdef NODEAWARE_PROXY_SPANNINGTREE
680  buildNodeAwareSpanningTree0();
681 #else
683 #endif
685 }
static PatchMap * Object()
Definition: PatchMap.h:27
void resize(int i)
Definition: ResizeArray.h:84
int numPatches(void) const
Definition: PatchMap.h:59
int * proxyListLen
Definition: ProxyMgr.h:418
void buildSpanningTree0()
Definition: ProxyMgr.C:1006
NodeIDList * proxylist
Definition: ProxyMgr.h:291
void sendSpanningTrees()
Definition: ProxyMgr.C:1106
int proxyMsgCount
Definition: ProxyMgr.h:290

◆ recvProxies()

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

Definition at line 633 of file ProxyMgr.C.

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

634 {
635  int nPatches = PatchMap::Object()->numPatches();
636  if (ptree.proxylist == NULL)
637  ptree.proxylist = new NodeIDList[nPatches];
638  ptree.proxylist[pid].resize(n);
639  for (int i=0; i<n; i++)
640  ptree.proxylist[pid][i] = list[i];
641  ptree.proxyMsgCount ++;
642  if (ptree.proxyMsgCount == nPatches) {
643  //debug
644  //outputProxyTree(ptree, nPatches);
645 
646  ptree.proxyMsgCount = 0;
647  // building and sending of trees is done in two steps now
648  // so that the building step can be shifted to the load balancer
649 #ifdef NODEAWARE_PROXY_SPANNINGTREE
650  buildNodeAwareSpanningTree0();
651 #else
653 #endif
655  }
656 }
static PatchMap * Object()
Definition: PatchMap.h:27
void resize(int i)
Definition: ResizeArray.h:84
int numPatches(void) const
Definition: PatchMap.h:59
void buildSpanningTree0()
Definition: ProxyMgr.C:1006
NodeIDList * proxylist
Definition: ProxyMgr.h:291
void sendSpanningTrees()
Definition: ProxyMgr.C:1106
int proxyMsgCount
Definition: ProxyMgr.h:290

◆ recvProxyAll()

void ProxyMgr::recvProxyAll ( ProxyDataMsg msg)

Definition at line 1693 of file ProxyMgr.C.

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

1693  {
1694 //Chao Mei: hack for QD in case of SMP with immediate msg
1695 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR) && (CMK_SMP) && defined(NAMDSRC_IMMQD_HACK)
1696  if(proxySendSpanning && msg->isFromImmMsgCall){
1697 // CkPrintf("qdcreate called on pe[%d]\n", CkMyPe());
1698 // fflush(stdout);
1699  //To compensate for the counter loss for message creation
1700  //inside the process of immediate message on comm thread
1701  CkpvAccess(_qd)->create();
1702  }
1703 #endif
1704 
1705  ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
1706  proxy->receiveAll(msg); // deleted in ProxyPatch::receiveAtoms()
1707 }
static PatchMap * Object()
Definition: PatchMap.h:27
void receiveAll(ProxyDataMsg *)
Definition: ProxyPatch.C:245
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
PatchID patch
Definition: ProxyMgr.h:97
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ recvProxyData()

void ProxyMgr::recvProxyData ( ProxyDataMsg msg)

Definition at line 1579 of file ProxyMgr.C.

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

1579  {
1580 //Chao Mei: hack for QD in case of SMP with immediate msg
1581 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR) && (CMK_SMP) && defined(NAMDSRC_IMMQD_HACK)
1582  if(proxySendSpanning && msg->isFromImmMsgCall){
1583 // CkPrintf("qdcreate called on pe[%d]\n", CkMyPe());
1584 // fflush(stdout);
1585  //To compensate for the counter loss for message creation
1586  //inside the process of immediate message on comm thread
1587  CkpvAccess(_qd)->create();
1588  }
1589 #endif
1590  ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
1591  proxy->receiveData(msg); // deleted in ProxyPatch::receiveAtoms()
1592 }
static PatchMap * Object()
Definition: PatchMap.h:27
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
void receiveData(ProxyDataMsg *)
Definition: ProxyPatch.C:168
PatchID patch
Definition: ProxyMgr.h:97
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ recvRegisterProxy()

void ProxyMgr::recvRegisterProxy ( RegisterProxyMsg msg)

Definition at line 532 of file ProxyMgr.C.

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

532  {
533  HomePatch *homePatch = PatchMap::Object()->homePatch(msg->patch);
534  homePatch->registerProxy(msg); // message deleted in registerProxy()
535 }
void registerProxy(RegisterProxyMsg *)
Definition: HomePatch.C:443
static PatchMap * Object()
Definition: PatchMap.h:27
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
PatchID patch
Definition: ProxyMgr.h:66

◆ recvResult() [1/2]

void ProxyMgr::recvResult ( ProxyGBISP1ResultMsg msg)

Definition at line 1857 of file ProxyMgr.C.

References PatchMap::homePatch(), PatchMap::Object(), ProxyGBISP1ResultMsg::patch, and HomePatch::receiveResult().

1857  { //pp -r> hp
1858  HomePatch *homePatch = PatchMap::Object()->homePatch(msg->patch);
1859  homePatch->receiveResult(msg); // message deleted in registerProxy()
1860 }
static PatchMap * Object()
Definition: PatchMap.h:27
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
void receiveResult(ProxyGBISP1ResultMsg *msg)
Definition: HomePatch.C:5024

◆ recvResult() [2/2]

void ProxyMgr::recvResult ( ProxyGBISP2ResultMsg msg)

Definition at line 1872 of file ProxyMgr.C.

References PatchMap::homePatch(), PatchMap::Object(), ProxyGBISP2ResultMsg::patch, and HomePatch::receiveResult().

1872  { //pp -r> hp
1873  HomePatch *homePatch = PatchMap::Object()->homePatch(msg->patch);
1874  homePatch->receiveResult(msg); // message deleted in registerProxy()
1875 }
static PatchMap * Object()
Definition: PatchMap.h:27
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
void receiveResult(ProxyGBISP1ResultMsg *msg)
Definition: HomePatch.C:5024

◆ recvResults() [1/3]

void ProxyMgr::recvResults ( ProxyResultVarsizeMsg msg)

Definition at line 1435 of file ProxyMgr.C.

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

1435  {
1436  HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
1437  home->receiveResults(msg); // delete done in HomePatch::receiveResults()
1438 }
static PatchMap * Object()
Definition: PatchMap.h:27
void receiveResults(ProxyResultVarsizeMsg *msg)
Definition: HomePatch.C:837
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249

◆ recvResults() [2/3]

void ProxyMgr::recvResults ( ProxyResultMsg msg)

Definition at line 1448 of file ProxyMgr.C.

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

1448  {
1449  HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
1450  home->receiveResults(msg); // delete done in HomePatch::receiveResults()
1451 }
static PatchMap * Object()
Definition: PatchMap.h:27
void receiveResults(ProxyResultVarsizeMsg *msg)
Definition: HomePatch.C:837
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
PatchID patch
Definition: ProxyMgr.h:167

◆ recvResults() [3/3]

void ProxyMgr::recvResults ( ProxyCombinedResultRawMsg omsg)

Definition at line 1481 of file ProxyMgr.C.

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

1481  {
1482  ProxyCombinedResultRawMsg *msg = omsg;
1483 
1484 //Chao Mei: hack for QD in case of SMP with immediate msg
1485 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR) && (CMK_SMP) && defined(NAMDSRC_IMMQD_HACK)
1486  if(proxyRecvSpanning && msg->isFromImmMsgCall){
1487 // CkPrintf("qdcreate called on pe[%d]\n", CkMyPe());
1488 // fflush(stdout);
1489  //To compensate for the counter loss for message creation
1490  //inside the process of immediate message on comm thread
1491  CkpvAccess(_qd)->create();
1492  }
1493 #endif
1494 
1495  HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
1496  if (home) {
1497  //printf("Home got a message\n");
1498  home->receiveResults(msg); // delete done in HomePatch::receiveResults()
1499  }
1500  else {
1501  NAMD_bug("ProxyMgr should receive result message on home processor");
1502  }
1503 }
int proxyRecvSpanning
Definition: ProxyMgr.C:45
static PatchMap * Object()
Definition: PatchMap.h:27
void receiveResults(ProxyResultVarsizeMsg *msg)
Definition: HomePatch.C:837
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
void NAMD_bug(const char *err_msg)
Definition: common.C:195

◆ recvSpanningTree()

void ProxyMgr::recvSpanningTree ( ProxySpanningTreeMsg msg)

Definition at line 1174 of file ProxyMgr.C.

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

1174  {
1175  int size = msg->tree.size();
1176  int *child = new int[proxySpanDim];
1177  int nChild = 0;
1178  int i;
1179  ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
1180  for (i=0; i<proxySpanDim; i++) {
1181  if (size > i+1) { child[i] = msg->tree[i+1]; nChild++; }
1182  }
1183  if (!PatchMap::Object()->homePatch(msg->patch)) {
1184  proxy->setSpanningTree(msg->node, child, nChild);
1185  }
1186 
1187  // build subtree and pass down
1188  if (nChild > 0) {
1189 
1190  nodecount ++;
1191  //if (nodecount > MAX_INTERNODE)
1192  // iout << "Processor " << CkMyPe() << "has (actual) " << nodecount << " intermediate nodes." << endi;
1193 
1194 //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]);
1195  NodeIDList *tree = new NodeIDList[proxySpanDim];
1196  int level = 1, index=1;
1197  int done = 0;
1198  while (!done) {
1199  for (int n=0; n<nChild; n++) {
1200  if (done) break;
1201  for (int j=0; j<level; j++) {
1202  if (index >= size) { done = 1; break; }
1203  tree[n].add(msg->tree[index]);
1204  index++;
1205  }
1206  }
1207  level *=proxySpanDim;
1208  }
1209 
1210  ProxyMgr *proxyMgr = ProxyMgr::Object();
1211  for (i=0; i<proxySpanDim; i++) {
1212  if (tree[i].size()) {
1214  cmsg->patch = msg->patch;
1215  cmsg->node = CkMyPe();
1216  cmsg->tree.copy(tree[i]); // copy data for thread safety
1217  proxyMgr->sendSpanningTree(cmsg);
1218  }
1219  }
1220 
1221  delete [] tree;
1222  }
1223 
1224  delete [] child;
1225  delete msg;
1226 }
void copy(ResizeArray< Elem > &ra)
Definition: ResizeArray.h:59
int size(void) const
Definition: ResizeArray.h:131
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
static PatchMap * Object()
Definition: PatchMap.h:27
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
int add(const Elem &elem)
Definition: ResizeArray.h:101
NodeIDList tree
Definition: ProxyMgr.h:265
void setSpanningTree(int, int *, int)
Definition: ProxyPatch.C:455
void sendSpanningTree(ProxySpanningTreeMsg *)
Definition: ProxyMgr.C:1154
Index index
Definition: Parameters.C:155
static int nodecount
Definition: ProxyMgr.h:398
int proxySpanDim
Definition: ProxyMgr.C:47

◆ recvSpanningTreeOnHomePatch()

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

Definition at line 1133 of file ProxyMgr.C.

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

1134 {
1135  HomePatch *p = PatchMap::Object()->homePatch(pid);
1136  p->recvSpanningTree(tree, n);
1137 }
static PatchMap * Object()
Definition: PatchMap.h:27
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
void recvSpanningTree(int *t, int n)
Definition: HomePatch.C:677

◆ recvUnregisterProxy()

void ProxyMgr::recvUnregisterProxy ( UnregisterProxyMsg msg)

Definition at line 552 of file ProxyMgr.C.

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

552  {
553  HomePatch *homePatch = PatchMap::Object()->homePatch(msg->patch);
554  homePatch->unregisterProxy(msg); // message deleted in registerProxy()
555 }
static PatchMap * Object()
Definition: PatchMap.h:27
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:249
void unregisterProxy(UnregisterProxyMsg *)
Definition: HomePatch.C:457

◆ registerProxy()

void ProxyMgr::registerProxy ( PatchID  pid)

Definition at line 518 of file ProxyMgr.C.

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

Referenced by ProxyPatch::ProxyPatch().

518  {
519  // determine which node gets message
520  NodeID node = PatchMap::Object()->node(pid);
521 
523 
524  msg->node=CkMyPe();
525  msg->patch = pid;
526 
527  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
528  cp[node].recvRegisterProxy(msg);
529 }
static PatchMap * Object()
Definition: PatchMap.h:27
PatchID patch
Definition: ProxyMgr.h:66
int32 NodeID
Definition: NamdTypes.h:279
int node(int pid) const
Definition: PatchMap.h:114

◆ removeProxies()

void ProxyMgr::removeProxies ( void  )

Definition at line 388 of file ProxyMgr.C.

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

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

389 {
390  ProxySetIter pi(proxySet);
391  for ( pi = pi.begin(); pi != pi.end(); pi++)
392  {
393  delete pi->proxyPatch;
394  }
395  proxySet.clear();
396 }
void clear(void)
Definition: UniqueSet.h:62

◆ removeProxy()

void ProxyMgr::removeProxy ( PatchID  pid)

Definition at line 507 of file ProxyMgr.C.

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

Referenced by removeUnusedProxies().

507  {
508  ProxyElem *p = proxySet.find(ProxyElem(pid));
509  if (p) {
511  delete p->proxyPatch;
512  proxySet.del(ProxyElem(pid));
513  // iout << iINFO << "Removing unused proxy " << pid << " on " << iPE << ".\n" << endi;
514  }
515 }
Elem * find(const Elem &elem)
Definition: UniqueSet.h:60
static PatchMap * Object()
Definition: PatchMap.h:27
void unregisterPatch(PatchID pid, HomePatch *pptr)
Definition: PatchMap.C:796
ProxyPatch * proxyPatch
Definition: ProxyMgr.h:282
int del(const Elem &elem)
Definition: UniqueSet.h:56

◆ removeUnusedProxies()

void ProxyMgr::removeUnusedProxies ( void  )

Definition at line 398 of file ProxyMgr.C.

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

Referenced by ComputeMgr::updateLocalComputes3().

399 {
400  ResizeArray<PatchID> toDelete;
401  ProxySetIter pi(proxySet);
402  for ( pi = pi.begin(); pi != pi.end(); pi++)
403  {
404  if ( pi->proxyPatch->getNumComputes() == 0 ) {
405  toDelete.add(pi->patchID);
406  //fprintf(stderr, "Proxy Deleted Patch %d Proc %d", pi->patchID, CkMyPe());
407  }
408  }
409  PatchID *pidi = toDelete.begin();
410  for ( ; pidi != toDelete.end(); ++pidi ) {
411  removeProxy(*pidi);
412  }
413 }
int add(const Elem &elem)
Definition: ResizeArray.h:101
iterator begin(void)
Definition: ResizeArray.h:36
iterator end(void)
Definition: ResizeArray.h:37
int32 PatchID
Definition: NamdTypes.h:277
void removeProxy(PatchID pid)
Definition: ProxyMgr.C:507

◆ sendNodeAwareSpanningTree()

void ProxyMgr::sendNodeAwareSpanningTree ( ProxyNodeAwareSpanningTreeMsg msg)

Definition at line 1159 of file ProxyMgr.C.

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

Referenced by recvNodeAwareSpanningTree().

1159  {
1160  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1161  int pe = msg->allPes[0]; //the root procID
1162 
1163 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
1164  DebugFileTrace *dft = DebugFileTrace::Object();
1165  dft->openTrace();
1166  dft->writeTrace("PMgr::sndST: from proc %d for patch[%d]\n", pe, msg->patch);
1167  dft->closeTrace();
1168 #endif
1169 
1170  cp[pe].recvNodeAwareSpanningTree(msg);
1171 }

◆ sendNodeAwareSpanningTreeToHomePatch()

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

Definition at line 1139 of file ProxyMgr.C.

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

Referenced by sendSpanningTrees().

1140 {
1141  CProxy_ProxyMgr cp(thisgroup);
1143  cp[PatchMap::Object()->node(pid)].recvNodeAwareSpanningTreeOnHomePatch(msg);
1144 }
static PatchMap * Object()
Definition: PatchMap.h:27
static ProxyNodeAwareSpanningTreeMsg * getANewMsg(PatchID pid, NodeID nid, proxyTreeNode *tree, int size)
Definition: ProxyMgr.C:196
int node(int pid) const
Definition: PatchMap.h:114

◆ sendProxies()

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

Definition at line 599 of file ProxyMgr.C.

Referenced by HomePatch::sendProxies().

600 {
601  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
602  cp[0].recvProxies(pid, list, n);
603 }

◆ sendProxyAll()

void ProxyMgr::sendProxyAll ( ProxyDataMsg msg,
int  pcnt,
int *  pids 
)

Definition at line 1676 of file ProxyMgr.C.

References proxySendSpanning.

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

1676  {
1677 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
1678  if(proxySendSpanning == 1) {
1679  CProxy_NodeProxyMgr cnp(CkpvAccess(BOCclass_group).nodeProxyMgr);
1680  for(int i=0; i<pcnt-1; i++) {
1681  ProxyDataMsg *copymsg = (ProxyDataMsg *)CkCopyMsg((void **)&msg);
1682  cnp[pids[i]].recvImmediateProxyAll(copymsg);
1683  }
1684  cnp[pids[pcnt-1]].recvImmediateProxyAll(msg);
1685  return;
1686  }
1687 #endif
1688  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1689  cp.recvImmediateProxyAll(msg,pcnt,pids);
1690 }
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ sendProxyData()

void ProxyMgr::sendProxyData ( ProxyDataMsg msg,
int  pcnt,
int *  pids 
)

Definition at line 1562 of file ProxyMgr.C.

References proxySendSpanning.

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

1562  {
1563 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
1564  if(proxySendSpanning == 1) {
1565  CProxy_NodeProxyMgr cnp(CkpvAccess(BOCclass_group).nodeProxyMgr);
1566  for(int i=0; i<pcnt-1; i++) {
1567  ProxyDataMsg *copymsg = (ProxyDataMsg *)CkCopyMsg((void **)&msg);
1568  cnp[pids[i]].recvImmediateProxyData(copymsg);
1569  }
1570  cnp[pids[pcnt-1]].recvImmediateProxyData(msg);
1571  return;
1572  }
1573 #endif
1574  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1575  cp.recvImmediateProxyData(msg,pcnt,pids);
1576 }
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ sendResult() [1/2]

void ProxyMgr::sendResult ( ProxyGBISP1ResultMsg msg)

Definition at line 1850 of file ProxyMgr.C.

References PatchMap::node(), PatchMap::Object(), and ProxyGBISP1ResultMsg::patch.

Referenced by ProxyPatch::boxClosed().

1850  { //pp -r> hp
1851  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1852  NodeID node = PatchMap::Object()->node(msg->patch);
1853  CmiEnableUrgentSend(1);
1854  cp[node].recvResult(msg);
1855  CmiEnableUrgentSend(0);
1856 }
static PatchMap * Object()
Definition: PatchMap.h:27
int32 NodeID
Definition: NamdTypes.h:279
int node(int pid) const
Definition: PatchMap.h:114

◆ sendResult() [2/2]

void ProxyMgr::sendResult ( ProxyGBISP2ResultMsg msg)

Definition at line 1865 of file ProxyMgr.C.

References PatchMap::node(), PatchMap::Object(), and ProxyGBISP2ResultMsg::patch.

1865  { //pp -r> hp
1866  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1867  NodeID node = PatchMap::Object()->node(msg->patch);
1868  CmiEnableUrgentSend(1);
1869  cp[node].recvResult(msg);
1870  CmiEnableUrgentSend(0);
1871 }
static PatchMap * Object()
Definition: PatchMap.h:27
int32 NodeID
Definition: NamdTypes.h:279
int node(int pid) const
Definition: PatchMap.h:114

◆ sendResults() [1/3]

void ProxyMgr::sendResults ( ProxyResultVarsizeMsg msg)

Definition at line 1427 of file ProxyMgr.C.

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

1427  {
1428  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1429  NodeID node = PatchMap::Object()->node(msg->patch);
1430  CmiEnableUrgentSend(1);
1431  cp[node].recvResults(msg);
1432  CmiEnableUrgentSend(0);
1433 }
static PatchMap * Object()
Definition: PatchMap.h:27
int32 NodeID
Definition: NamdTypes.h:279
int node(int pid) const
Definition: PatchMap.h:114

◆ sendResults() [2/3]

void ProxyMgr::sendResults ( ProxyResultMsg msg)

Definition at line 1440 of file ProxyMgr.C.

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

1440  {
1441  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1442  NodeID node = PatchMap::Object()->node(msg->patch);
1443  CmiEnableUrgentSend(1);
1444  cp[node].recvResults(msg);
1445  CmiEnableUrgentSend(0);
1446 }
static PatchMap * Object()
Definition: PatchMap.h:27
PatchID patch
Definition: ProxyMgr.h:167
int32 NodeID
Definition: NamdTypes.h:279
int node(int pid) const
Definition: PatchMap.h:114

◆ sendResults() [3/3]

void ProxyMgr::sendResults ( ProxyCombinedResultMsg msg)

Definition at line 1454 of file ProxyMgr.C.

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

1454  {
1455  ProxyPatch *patch = (ProxyPatch *)PatchMap::Object()->patch(msg->patch);
1456  ProxyCombinedResultMsg *ocMsg = patch->depositCombinedResultMsg(msg);
1457  if (ocMsg) {
1459  int destPe = patch->getSpanningTreeParent();
1460  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1461  CmiAssert(destPe!=CkMyPe());
1462  //if(destPe != CkMyPe()) {
1463 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
1464  /*CkPrintf("ready to call node::recvImmRes on pe[%d] to dest[%d]\n", CkMyPe(), destPe);
1465  fflush(stdout);*/
1466 
1467  cMsg->destPe = destPe;
1468  CProxy_NodeProxyMgr cnp(CkpvAccess(BOCclass_group).nodeProxyMgr);
1469  cnp[CkNodeOf(destPe)].recvImmediateResults(cMsg);
1470 #else
1471  cp[destPe].recvImmediateResults(cMsg);
1472 #endif
1473  //}
1474  //else{
1476  // cp[destPe].recvResults(cMsg);
1477  //}
1478  }
1479 }
static PatchMap * Object()
Definition: PatchMap.h:27
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
static ProxyCombinedResultRawMsg * toRaw(ProxyCombinedResultMsg *msg)
Definition: ProxyMgr.C:247
ProxyCombinedResultMsg * depositCombinedResultMsg(ProxyCombinedResultMsg *)
Definition: ProxyPatch.C:476
int getSpanningTreeParent()
Definition: ProxyPatch.h:33

◆ sendSpanningTree()

void ProxyMgr::sendSpanningTree ( ProxySpanningTreeMsg msg)

Definition at line 1154 of file ProxyMgr.C.

References ProxySpanningTreeMsg::tree.

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

1154  {
1155  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
1156  cp[msg->tree[0]].recvSpanningTree(msg);
1157 }
NodeIDList tree
Definition: ProxyMgr.h:265

◆ sendSpanningTrees()

void ProxyMgr::sendSpanningTrees ( )

Definition at line 1106 of file ProxyMgr.C.

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

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

1107 {
1108  int numPatches = PatchMap::Object()->numPatches();
1109  for (int pid=0; pid<numPatches; pid++) {
1110  int numProxies = ptree.proxylist[pid].size();
1111 #ifdef NODEAWARE_PROXY_SPANNINGTREE
1112  if (numProxies == 0)
1114  else {
1115  ProxyMgr::Object()->sendNodeAwareSpanningTreeToHomePatch(pid, ptree.naTrees[pid].begin(), ptree.naTrees[pid].size());
1116  }
1117 #else
1118  if (numProxies == 0)
1120  else {
1121  ProxyMgr::Object()->sendSpanningTreeToHomePatch(pid, ptree.trees[pid].begin(), ptree.trees[pid].size());
1122  }
1123 #endif
1124  }
1125 }
int size(void) const
Definition: ResizeArray.h:131
void sendSpanningTreeToHomePatch(int pid, int *tree, int n)
Definition: ProxyMgr.C:1127
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
static PatchMap * Object()
Definition: PatchMap.h:27
int numPatches(void) const
Definition: PatchMap.h:59
NodeIDList * trees
Definition: ProxyMgr.h:297
void sendNodeAwareSpanningTreeToHomePatch(int pid, proxyTreeNode *tree, int n)
Definition: ProxyMgr.C:1139
iterator begin(void)
Definition: ResizeArray.h:36
NodeIDList * proxylist
Definition: ProxyMgr.h:291
int numProxies()
Definition: ProxyMgr.h:396

◆ sendSpanningTreeToHomePatch()

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

Definition at line 1127 of file ProxyMgr.C.

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

Referenced by sendSpanningTrees().

1128 {
1129  CProxy_ProxyMgr cp(thisgroup);
1130  cp[PatchMap::Object()->node(pid)].recvSpanningTreeOnHomePatch(pid, tree, n);
1131 }
static PatchMap * Object()
Definition: PatchMap.h:27
int node(int pid) const
Definition: PatchMap.h:114

◆ setProxyTreeBranchFactor()

void ProxyMgr::setProxyTreeBranchFactor ( int  dim)

Definition at line 379 of file ProxyMgr.C.

References proxySpanDim.

Referenced by Node::startup().

379  {
380  if(CkMyRank()!=0) return;
381  proxySpanDim = dim;
382 }
int proxySpanDim
Definition: ProxyMgr.C:47

◆ setRecvSpanning()

void ProxyMgr::setRecvSpanning ( )

Definition at line 370 of file ProxyMgr.C.

References proxyRecvSpanning.

Referenced by WorkDistrib::savePatchMap(), WorkDistrib::sendPatchMap(), and Node::startup().

370  {
371  if(CkMyRank()!=0) return;
372  proxyRecvSpanning = 1;
373 }
int proxyRecvSpanning
Definition: ProxyMgr.C:45

◆ setSendSpanning()

void ProxyMgr::setSendSpanning ( )

Definition at line 361 of file ProxyMgr.C.

References proxySendSpanning.

Referenced by WorkDistrib::savePatchMap(), WorkDistrib::sendPatchMap(), and Node::startup().

361  {
362  if(CkMyRank()!=0) return;
363  proxySendSpanning = 1;
364 }
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ unregisterProxy()

void ProxyMgr::unregisterProxy ( PatchID  pid)

Definition at line 538 of file ProxyMgr.C.

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

Referenced by ProxyPatch::~ProxyPatch().

538  {
539  // determine which node gets message
540  NodeID node = PatchMap::Object()->node(pid);
541 
543 
544  msg->node=CkMyPe();
545  msg->patch = pid;
546 
547  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
548  cp[node].recvUnregisterProxy(msg);
549 }
static PatchMap * Object()
Definition: PatchMap.h:27
int32 NodeID
Definition: NamdTypes.h:279
int node(int pid) const
Definition: PatchMap.h:114

Member Data Documentation

◆ nodecount

int ProxyMgr::nodecount = 0
static

The documentation for this class was generated from the following files: