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 ( )

Definition at line 349 of file ProxyMgr.C.

References NAMD_bug().

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

Definition at line 356 of file ProxyMgr.C.

References removeProxies().

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

Member Function Documentation

void ProxyMgr::buildProxySpanningTree ( )

Definition at line 559 of file ProxyMgr.C.

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

Referenced by Node::startup().

560 {
561  PatchIDList pids;
562  if (!CkMyPe()) iout << iINFO << "Building spanning tree ... send: " << proxySendSpanning << " recv: " << proxyRecvSpanning
563  << " with branch factor " << proxySpanDim <<"\n" << endi;
565  for (int i=0; i<pids.size(); i++) {
566  HomePatch *home = PatchMap::Object()->homePatch(pids[i]);
567  if (home == NULL) CkPrintf("ERROR: homepatch NULL\n");
568 #ifdef NODEAWARE_PROXY_SPANNINGTREE
569  home->buildNodeAwareSpanningTree();
570 #else
571  home->buildSpanningTree();
572 #endif
573  }
574 }
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
int proxyRecvSpanning
Definition: ProxyMgr.C:46
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:240
void homePatchIDList(PatchIDList &)
Definition: PatchMap.C:443
void buildSpanningTree(void)
Definition: HomePatch.C:674
int size(void) const
Definition: ResizeArray.h:127
int proxySpanDim
Definition: ProxyMgr.C:48
int proxySendSpanning
Definition: ProxyMgr.C:45
void ProxyMgr::buildProxySpanningTree2 ( )

Definition at line 577 of file ProxyMgr.C.

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

Referenced by ComputeMgr::updateLocalComputes5().

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

Definition at line 1007 of file ProxyMgr.C.

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

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

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

Definition at line 417 of file ProxyMgr.C.

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

Referenced by Node::startup().

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

Definition at line 493 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(), ComputeNonbondedCUDA::registerPatches(), and ComputeMgr::updateLocalComputes().

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

Definition at line 385 of file ProxyMgr.C.

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

385  {
386  return ptree;
387 }
int ProxyMgr::getRecvSpanning ( )

Definition at line 376 of file ProxyMgr.C.

References proxyRecvSpanning.

Referenced by Node::startup().

376  {
377  return proxyRecvSpanning;
378 }
int proxyRecvSpanning
Definition: ProxyMgr.C:46
int ProxyMgr::getSendSpanning ( )

Definition at line 367 of file ProxyMgr.C.

References proxySendSpanning.

Referenced by Node::startup().

367  {
368  return proxySendSpanning;
369 }
int proxySendSpanning
Definition: ProxyMgr.C:45
int ProxyMgr::numProxies ( )
inline

Definition at line 396 of file ProxyMgr.h.

Referenced by buildSpanningTree0().

396 { return proxySet.size(); }
int size(void) const
Definition: UniqueSet.h:58
static ProxyMgr* ProxyMgr::Object ( )
inlinestatic
void ProxyMgr::recvData ( ProxyGBISP2DataMsg msg)

Definition at line 1862 of file ProxyMgr.C.

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

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

Definition at line 1877 of file ProxyMgr.C.

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

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

Definition at line 1711 of file ProxyMgr.C.

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

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

Definition at line 1596 of file ProxyMgr.C.

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

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

Definition at line 1506 of file ProxyMgr.C.

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

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

Definition at line 1230 of file ProxyMgr.C.

References ResizeArray< T >::add(), ALLOCA, ProxyNodeAwareSpanningTreeMsg::allPes, PatchMap::homePatch(), ResizeArray< T >::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< T >::size().

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

Definition at line 1147 of file ProxyMgr.C.

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

1148 {
1149  HomePatch *p = PatchMap::Object()->homePatch(msg->patch);
1150  p->recvNodeAwareSpanningTree(msg);
1151  delete msg;
1152 }
static PatchMap * Object()
Definition: PatchMap.h:27
void recvNodeAwareSpanningTree(ProxyNodeAwareSpanningTreeMsg *msg)
Definition: HomePatch.C:630
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void ProxyMgr::recvNodeAwareSTParent ( int  patch,
int  parent 
)

Definition at line 1416 of file ProxyMgr.C.

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

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

Definition at line 659 of file ProxyMgr.C.

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

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

Definition at line 634 of file ProxyMgr.C.

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

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

Definition at line 1694 of file ProxyMgr.C.

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

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

Definition at line 1580 of file ProxyMgr.C.

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

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

Definition at line 533 of file ProxyMgr.C.

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

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

Definition at line 1858 of file ProxyMgr.C.

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

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

Definition at line 1873 of file ProxyMgr.C.

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

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

Definition at line 1436 of file ProxyMgr.C.

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

1436  {
1437  HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
1438  home->receiveResults(msg); // delete done in HomePatch::receiveResults()
1439 }
static PatchMap * Object()
Definition: PatchMap.h:27
void receiveResults(ProxyResultVarsizeMsg *msg)
Definition: HomePatch.C:796
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void ProxyMgr::recvResults ( ProxyResultMsg msg)

Definition at line 1449 of file ProxyMgr.C.

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

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

Definition at line 1482 of file ProxyMgr.C.

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

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

Definition at line 1175 of file ProxyMgr.C.

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

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

Definition at line 1134 of file ProxyMgr.C.

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

1135 {
1136  HomePatch *p = PatchMap::Object()->homePatch(pid);
1137  p->recvSpanningTree(tree, n);
1138 }
static PatchMap * Object()
Definition: PatchMap.h:27
HomePatch * homePatch(PatchID pid)
Definition: PatchMap.h:240
void recvSpanningTree(int *t, int n)
Definition: HomePatch.C:636
void ProxyMgr::recvUnregisterProxy ( UnregisterProxyMsg msg)

Definition at line 553 of file ProxyMgr.C.

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

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

Definition at line 519 of file ProxyMgr.C.

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

Referenced by ProxyPatch::ProxyPatch().

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

Definition at line 389 of file ProxyMgr.C.

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

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

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

Definition at line 508 of file ProxyMgr.C.

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

Referenced by removeUnusedProxies().

508  {
509  ProxyElem *p = proxySet.find(ProxyElem(pid));
510  if (p) {
512  delete p->proxyPatch;
513  proxySet.del(ProxyElem(pid));
514  // iout << iINFO << "Removing unused proxy " << pid << " on " << iPE << ".\n" << endi;
515  }
516 }
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
void ProxyMgr::removeUnusedProxies ( void  )

Definition at line 399 of file ProxyMgr.C.

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

Referenced by ComputeMgr::updateLocalComputes3().

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

Definition at line 1160 of file ProxyMgr.C.

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

Referenced by recvNodeAwareSpanningTree().

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

Definition at line 1140 of file ProxyMgr.C.

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

Referenced by sendSpanningTrees().

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

Definition at line 600 of file ProxyMgr.C.

Referenced by HomePatch::sendProxies().

601 {
602  CProxy_ProxyMgr cp(CkpvAccess(BOCclass_group).proxyMgr);
603  cp[0].recvProxies(pid, list, n);
604 }
void ProxyMgr::sendProxyAll ( ProxyDataMsg msg,
int  pcnt,
int *  pids 
)

Definition at line 1677 of file ProxyMgr.C.

References proxySendSpanning.

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

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

Definition at line 1563 of file ProxyMgr.C.

References proxySendSpanning.

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

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

Definition at line 1851 of file ProxyMgr.C.

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

Referenced by ProxyPatch::boxClosed().

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

Definition at line 1866 of file ProxyMgr.C.

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

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

Definition at line 1428 of file ProxyMgr.C.

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

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

Definition at line 1441 of file ProxyMgr.C.

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

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

Definition at line 1455 of file ProxyMgr.C.

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

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

Definition at line 1155 of file ProxyMgr.C.

References ProxySpanningTreeMsg::tree.

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

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

Definition at line 1107 of file ProxyMgr.C.

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

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

1108 {
1110  for (int pid=0; pid<numPatches; pid++) {
1111  int numProxies = ptree.proxylist[pid].size();
1112 #ifdef NODEAWARE_PROXY_SPANNINGTREE
1113  if (numProxies == 0)
1115  else {
1116  ProxyMgr::Object()->sendNodeAwareSpanningTreeToHomePatch(pid, ptree.naTrees[pid].begin(), ptree.naTrees[pid].size());
1117  }
1118 #else
1119  if (numProxies == 0)
1121  else {
1122  ProxyMgr::Object()->sendSpanningTreeToHomePatch(pid, ptree.trees[pid].begin(), ptree.trees[pid].size());
1123  }
1124 #endif
1125  }
1126 }
void sendSpanningTreeToHomePatch(int pid, int *tree, int n)
Definition: ProxyMgr.C:1128
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
static PatchMap * Object()
Definition: PatchMap.h:27
NodeIDList * trees
Definition: ProxyMgr.h:297
__global__ void const int const TileList *__restrict__ TileExcl *__restrict__ const int *__restrict__ const int const float2 *__restrict__ cudaTextureObject_t const int *__restrict__ const float3 const float3 const float3 const float4 *__restrict__ const float cudaTextureObject_t cudaTextureObject_t float const PatchPairRecord *__restrict__ const int *__restrict__ const int2 *__restrict__ const unsigned int *__restrict__ unsigned int *__restrict__ int *__restrict__ int *__restrict__ TileListStat *__restrict__ const BoundingBox *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ float *__restrict__ const int numPatches
void sendNodeAwareSpanningTreeToHomePatch(int pid, proxyTreeNode *tree, int n)
Definition: ProxyMgr.C:1140
int numPatches(void) const
Definition: PatchMap.h:59
NodeIDList * proxylist
Definition: ProxyMgr.h:291
int size(void) const
Definition: ResizeArray.h:127
int numProxies()
Definition: ProxyMgr.h:396
iterator begin(void)
Definition: ResizeArray.h:36
void ProxyMgr::sendSpanningTreeToHomePatch ( int  pid,
int *  tree,
int  n 
)

Definition at line 1128 of file ProxyMgr.C.

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

Referenced by sendSpanningTrees().

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

Definition at line 380 of file ProxyMgr.C.

References proxySpanDim.

Referenced by Node::startup().

380  {
381  if(CkMyRank()!=0) return;
382  proxySpanDim = dim;
383 }
int proxySpanDim
Definition: ProxyMgr.C:48
void ProxyMgr::setRecvSpanning ( )

Definition at line 371 of file ProxyMgr.C.

References proxyRecvSpanning.

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

371  {
372  if(CkMyRank()!=0) return;
373  proxyRecvSpanning = 1;
374 }
int proxyRecvSpanning
Definition: ProxyMgr.C:46
void ProxyMgr::setSendSpanning ( )

Definition at line 362 of file ProxyMgr.C.

References proxySendSpanning.

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

362  {
363  if(CkMyRank()!=0) return;
364  proxySendSpanning = 1;
365 }
int proxySendSpanning
Definition: ProxyMgr.C:45
void ProxyMgr::unregisterProxy ( PatchID  pid)

Definition at line 539 of file ProxyMgr.C.

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

Referenced by ProxyPatch::~ProxyPatch().

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

Member Data Documentation

int ProxyMgr::nodecount = 0
static

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