#include <ProxyMgr.h>
Inheritance diagram for ProxyMgr:

|
|
Definition at line 336 of file ProxyMgr.C. References NAMD_bug(). 00336 {
00337 if (CpvAccess(ProxyMgr_instance)) {
00338 NAMD_bug("Tried to create ProxyMgr twice.");
00339 }
00340 CkpvAccess(ProxyMgr_instance) = this;
00341 }
|
|
|
Definition at line 343 of file ProxyMgr.C. References removeProxies(). 00343 {
00344 removeProxies();
00345 CpvAccess(ProxyMgr_instance) = NULL;
00346 }
|
|
|
Definition at line 537 of file ProxyMgr.C. References HomePatch::buildSpanningTree(), PatchMap::homePatch(), PatchMap::homePatchIDList(), iINFO(), iout, PatchMap::Object(), PatchIDList, proxyRecvSpanning, proxySendSpanning, and ResizeArray< Elem >::size(). Referenced by Node::startup(). 00538 {
00539 PatchIDList pids;
00540 if (!CkMyPe()) iout << iINFO << "Building spanning tree ... send: " << proxySendSpanning << " recv: " << proxyRecvSpanning << "\n" << endi;
00541 PatchMap::Object()->homePatchIDList(pids);
00542 for (int i=0; i<pids.size(); i++) {
00543 HomePatch *home = PatchMap::Object()->homePatch(pids[i]);
00544 if (home == NULL) CkPrintf("ERROR: homepatch NULL\n");
00545 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00546 home->buildNodeAwareSpanningTree();
00547 #else
00548 home->buildSpanningTree();
00549 #endif
00550 }
00551 }
|
|
|
Definition at line 554 of file ProxyMgr.C. References PatchMap::homePatch(), PatchMap::homePatchIDList(), PatchMap::Object(), PatchIDList, HomePatch::sendProxies(), and ResizeArray< Elem >::size(). Referenced by ComputeMgr::updateLocalComputes5(). 00555 {
00556 PatchIDList pids;
00557 PatchMap::Object()->homePatchIDList(pids);
00558 for (int i=0; i<pids.size(); i++) {
00559 HomePatch *home = PatchMap::Object()->homePatch(pids[i]);
00560 if (home == NULL) CkPrintf("ERROR: homepatch NULL\n");
00561 home->sendProxies();
00562 }
00563 }
|
|
|
Definition at line 915 of file ProxyMgr.C. References ResizeArray< Elem >::find(), MAX_INTERNODE, PatchMap::node(), NodeIDList, noInterNode(), PatchMap::numPatches(), PatchMap::Object(), processCpuLoad(), ProxyTree::proxylist, proxySpanDim, ResizeArray< Elem >::resize(), ResizeArray< Elem >::setall(), ResizeArray< Elem >::size(), ProxyTree::sizes, and ProxyTree::trees. Referenced by Rebalancer::createSpanningTree(), and recvProxies(). 00916 {
00917 int i;
00918
00919 processCpuLoad();
00920
00921 int *numPatchesOnNode = new int[CkNumPes()];
00922 int numNodesWithPatches = 0;
00923 for (i=0; i<CkNumPes(); i++) numPatchesOnNode[i] = 0;
00924 int numPatches = PatchMap::Object()->numPatches();
00925 for (i=0; i<numPatches; i++) {
00926 int node = PatchMap::Object()->node(i);
00927 numPatchesOnNode[node]++;
00928 if (numPatchesOnNode[node] == 1)
00929 numNodesWithPatches ++;
00930 }
00931 int patchNodesLast =
00932 ( numNodesWithPatches < ( 0.7 * CkNumPes() ) );
00933 int *ntrees = new int[CkNumPes()];
00934 for (i=0; i<CkNumPes(); i++) ntrees[i] = 0;
00935 if (ptree.trees == NULL) ptree.trees = new NodeIDList[numPatches];
00936 for (int pid=0; pid<numPatches; pid++)
00937 {
00938 int numProxies = ptree.proxylist[pid].size();
00939 if (numProxies == 0) {
00940 CkPrintf ("This is sheer evil!\n\n");
00941 //ProxyMgr::Object()->sendSpanningTreeToHomePatch(pid, NULL, 0);
00942 return;
00943 }
00944 NodeIDList &tree = ptree.trees[pid]; // spanning tree
00945 NodeIDList oldtree = tree;
00946 tree.resize(numProxies+1);
00947 tree.setall(-1);
00948 tree[0] = PatchMap::Object()->node(pid);
00949 int s=1, e=numProxies;
00950 int nNonPatch = 0;
00951 int treesize = 1;
00952 int pp;
00953
00954 // keep tree persistent for non-intermediate nodes
00955 for (pp=0; pp<numProxies; pp++) {
00956 int p = ptree.proxylist[pid][pp];
00957 int oldindex = oldtree.find(p);
00958 if (oldindex != -1 && oldindex <= numProxies) {
00959 int isIntermediate = (oldindex*proxySpanDim+1 <= numProxies);
00960 if (!isIntermediate) {
00961 tree[oldindex] = p;
00962 }
00963 else if (ntrees[p] < MAX_INTERNODE) {
00964 tree[oldindex] = p;
00965 ntrees[p] ++;
00966 }
00967 }
00968 }
00969
00970 for (pp=0; pp<numProxies; pp++) {
00971 int p = ptree.proxylist[pid][pp]; // processor number
00972 if (tree.find(p) != -1) continue; // already used
00973 treesize++;
00974 if (patchNodesLast && numPatchesOnNode[p] ) {
00975 while (tree[e] != -1) { e--; if (e==-1) e = numProxies; }
00976 tree[e] = p;
00977 int isIntermediate = (e*proxySpanDim+1 <= numProxies);
00978 if (isIntermediate) ntrees[p]++;
00979 }
00980 else {
00981 while (tree[s] != -1) { s++; if (s==numProxies+1) s = 1; }
00982 int isIntermediate = (s*proxySpanDim+1 <= numProxies);
00983 if (isIntermediate && (ntrees[p] >= MAX_INTERNODE || noInterNode(p))) { // TOO MANY INTERMEDIATE TREES
00984 //if (isIntermediate && ntrees[p] >= MAX_INTERNODE) // TOO MANY INTERMEDIATE TREES
00985 while (tree[e] != -1) { e--; if (e==-1) e = numProxies; }
00986 tree[e] = p;
00987 isIntermediate = (e*proxySpanDim+1 <= numProxies);
00988 if (isIntermediate) ntrees[p]++;
00989 }
00990 else {
00991 tree[s] = p;
00992 nNonPatch++;
00993 if (isIntermediate) ntrees[p]++;
00994 }
00995 }
00996 }
00997 // send homepatch's proxy tree
00998 if(ptree.sizes)
00999 ptree.sizes[pid] = treesize;
01000 //ProxyMgr::Object()->sendSpanningTreeToHomePatch(pid, &tree[0], treesize);
01001 }
01002 /*for (i=0; i<CkNumPes(); i++) {
01003 if (ntrees[i] > MAX_INTERNODE) iout << "Processor " << i << "has (guess) " << ntrees[i] << " intermediate nodes." << endi;
01004 }*/
01005 delete [] ntrees;
01006 delete [] numPatchesOnNode;
01007 }
|
|
|
Definition at line 397 of file ProxyMgr.C. References UniqueSet< Elem >::add(), PatchMap::basePatchIDList(), ComputeMap::isPatchBased(), ComputeMap::node(), PatchMap::node(), ComputeMap::numComputes(), PatchMap::numPatches(), ComputeMap::numPids(), ComputeMap::Object(), PatchMap::Object(), PatchID, PatchIDList, ComputeMap::pid(), PatchMap::registerPatch(), removeProxies(), ResizeArray< Elem >::size(), and PatchMap::upstreamNeighbors(). Referenced by Node::startup(). 00398 {
00399 // Delete the old proxies.
00400 removeProxies();
00401
00402 PatchMap *patchMap = PatchMap::Object();
00403 int numPatches = patchMap->numPatches();
00404 int myNode = CkMyPe();
00405 enum PatchFlag { Unknown, Home, NeedProxy };
00406 int *patchFlag = new int[numPatches];
00407 int i, j;
00408
00409 // Note all home patches.
00410 for ( i = 0; i < numPatches; ++i )
00411 {
00412 patchFlag[i] = ( patchMap->node(i) == myNode ) ? Home : Unknown;
00413 }
00414
00415 // Add all upstream neighbors.
00416 PatchID neighbors[PatchMap::MaxOneAway];
00417 PatchIDList basepids;
00418 patchMap->basePatchIDList(myNode,basepids);
00419 for ( i = 0; i < basepids.size(); ++i )
00420 {
00421 if ( patchMap->node(basepids[i]) != myNode ) {
00422 patchFlag[basepids[i]] = NeedProxy;
00423 }
00424 int numNeighbors = patchMap->upstreamNeighbors(basepids[i],neighbors);
00425 for ( j = 0; j < numNeighbors; ++j )
00426 {
00427 if ( ! patchFlag[neighbors[j]] ) {
00428 patchFlag[neighbors[j]] = NeedProxy;
00429 }
00430 }
00431 }
00432
00433 // Check all patch-based compute objects.
00434 ComputeMap *computeMap = ComputeMap::Object();
00435 int nc = computeMap->numComputes();
00436 for ( i = 0; i < nc; ++i )
00437 {
00438 if ( computeMap->node(i) != myNode || !computeMap->isPatchBased(i) )
00439 continue;
00440 int numPid = computeMap->numPids(i);
00441 for ( j = 0; j < numPid; ++j )
00442 {
00443 int pid = computeMap->pid(i,j);
00444 if ( ! patchFlag[pid] ) {
00445 patchFlag[pid] = NeedProxy;
00446 }
00447 }
00448 }
00449
00450 // Create proxy list
00451 for ( i = 0; i < numPatches; ++i ) {
00452 if ( patchFlag[i] == NeedProxy )
00453 { // create proxy patch
00454 ProxyPatch *proxy = new ProxyPatch(i);
00455 proxySet.add(ProxyElem(i, proxy));
00456 patchMap->registerPatch(i, proxy);
00457 }
00458 }
00459 delete[] patchFlag;
00460 }
|
|
|
Definition at line 463 of file ProxyMgr.C. References UniqueSet< Elem >::add(), DebugM, Patch::getPatchID(), PatchMap::Object(), PatchMap::patch(), and PatchMap::registerPatch(). Referenced by ComputeMgr::updateLocalComputes(). 00463 {
00464 Patch *p = PatchMap::Object()->patch(pid);
00465 if (!p) {
00466 DebugM(4,"createProxy("<<pid<<")\n");
00467 ProxyPatch *proxy = new ProxyPatch(pid);
00468 proxySet.add(ProxyElem(pid,proxy));
00469 PatchMap::Object()->registerPatch(pid,proxy);
00470 }
00471 else {
00472 DebugM(4,"createProxy("<<pid<<") found " << p->getPatchID() << "\n");
00473 }
00474
00475 }
|
|
|
Definition at line 365 of file ProxyMgr.C. Referenced by Rebalancer::createSpanningTree(), Rebalancer::decrSTLoad(), and Rebalancer::incrSTLoad(). 00365 {
00366 return ptree;
00367 }
|
|
|
Definition at line 361 of file ProxyMgr.C. 00361 {
00362 return proxyRecvSpanning;
00363 }
|
|
|
Definition at line 353 of file ProxyMgr.C. 00353 {
00354 return proxySendSpanning;
00355 }
|
|
|
Definition at line 284 of file ProxyMgr.h. References UniqueSet< Elem >::size(). Referenced by Sync::openSync(). 00284 { return proxySet.size(); }
|
|
|
Definition at line 282 of file ProxyMgr.h. Referenced by Rebalancer::createSpanningTree(), Rebalancer::decrSTLoad(), Rebalancer::incrSTLoad(), Sync::openSync(), HomePatch::positionsReady(), ProxyPatch::ProxyPatch(), recvImmediateProxyAll(), recvImmediateProxyData(), recvNodeAwareSpanningTree(), recvSpanningTree(), WorkDistrib::saveMaps(), WorkDistrib::sendMaps(), HomePatch::sendProxies(), HomePatch::sendSpanningTree(), sendSpanningTrees(), Node::startup(), ComputeMgr::updateLocalComputes5(), and ProxyPatch::~ProxyPatch(). 00282 { return CpvAccess(ProxyMgr_instance); }
|
|
|
Definition at line 1405 of file ProxyMgr.C. References ProxyPatch::getSpanningTreeChild(), ProxyPatch::getSpanningTreeNChild(), Object(), PatchMap::Object(), ProxyDataMsg::patch, PatchMap::patch(), proxySendSpanning, recvProxyAll(), and sendProxyAll(). Referenced by sendProxyAll(). 01405 {
01406 ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01407 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01408 DebugFileTrace *dft = DebugFileTrace::Object();
01409 dft->openTrace();
01410 dft->writeTrace("PMgr::recvImmPAll for patch[%d]\n", msg->patch);
01411 CmiAssert(proxy!=NULL);
01412 dft->writeTrace("PMgr::recvImmPAll assertion OK for patch[%d]\n", msg->patch);
01413 dft->closeTrace();
01414 #endif
01415 if (proxySendSpanning == 1) {
01416 // copy the message and send to spanning children
01417 int pids[proxy->getSpanningTreeNChild()];
01418 int npid = proxy->getSpanningTreeChild(pids);
01419 if (npid) {
01420 ProxyDataMsg *newmsg = (ProxyDataMsg *)CkCopyMsg((void **)&msg);
01421 ProxyMgr::Object()->sendProxyAll(newmsg,npid,pids);
01422 }
01423 }
01424 /* send to self via EP method to preserve priority */
01425 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
01426 cp[CkMyPe()].recvProxyAll(msg);
01427 }
|
|
|
Definition at line 1369 of file ProxyMgr.C. References ProxyPatch::getSpanningTreeChild(), ProxyPatch::getSpanningTreeNChild(), Object(), PatchMap::Object(), ProxyDataMsg::patch, PatchMap::patch(), proxySendSpanning, recvProxyData(), and sendProxyData(). 01369 {
01370 ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01371 if (proxySendSpanning == 1) {
01372 // copy the message and send to spanning children
01373 int pids[proxy->getSpanningTreeNChild()];
01374 int npid = proxy->getSpanningTreeChild(pids);
01375 if (npid) {
01376 ProxyDataMsg *newmsg = (ProxyDataMsg *)CkCopyMsg((void **)&msg);
01377
01378 ProxyMgr::Object()->sendProxyData(newmsg,npid,pids);
01379 #if 0
01380 //ChaoMei: buggy code??? the spanning tree doesn't always have 2 levels
01381 //At the second level of the tree immediate messages are not needed
01382 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
01383 cp.recvProxyData(newmsg,npid,pids);
01384 #endif
01385 }
01386 }
01387 /* send to self via EP method to preserve priority */
01388 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
01389 cp[CkMyPe()].recvProxyData(msg);
01390 }
|
|
|
Definition at line 1332 of file ProxyMgr.C. References ProxyPatch::depositCombinedResultMsg(), ProxyPatch::getSpanningTreeParent(), PatchMap::homePatch(), PatchMap::Object(), PatchMap::patch(), and ProxyCombinedResultMsg::patch. 01332 {
01333 HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
01334 if (home) {
01335 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
01336 #if CHARM_VERSION > 050402
01337 cp[CkMyPe()].recvResults(msg);
01338 #else
01339 cp.recvResults(msg, CkMyPe());
01340 #endif
01341 }
01342 else {
01343 ProxyPatch *patch = (ProxyPatch *)PatchMap::Object()->patch(msg->patch);
01344 ProxyCombinedResultMsg *cMsg = patch->depositCombinedResultMsg(msg);
01345 if (cMsg) {
01346 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
01347 #if CHARM_VERSION > 050402
01348 cp[patch->getSpanningTreeParent()].recvImmediateResults(cMsg);
01349 #else
01350 cp.recvImmediateResults(cMsg, patch->getSpanningTreeParent());
01351 #endif
01352 }
01353 }
01354 }
|
|
|
Definition at line 1139 of file ProxyMgr.C. References ResizeArray< Elem >::add(), ProxyNodeAwareSpanningTreeMsg::allPes, PatchMap::homePatch(), ResizeArray< Elem >::item(), nodecount, ProxyNodeAwareSpanningTreeMsg::numNodesWithProxies, ProxyNodeAwareSpanningTreeMsg::numPesOfNode, Object(), PatchMap::Object(), PatchMap::patch(), ProxyNodeAwareSpanningTreeMsg::patch, ProxyNodeAwareSpanningTreeMsg::printOut(), ProxyNodeAwareSpanningTreeMsg::procID, proxySpanDim, sendNodeAwareSpanningTree(), ProxyPatch::setSpanningTree(), and ResizeArray< Elem >::size(). 01139 {
01140
01141 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01142 DebugFileTrace *dft = DebugFileTrace::Object();
01143 dft->openTrace();
01144 dft->writeTrace("PMgr::recvST0 for patch[%d] with #nodes=%d\n", msg->patch, msg->numNodesWithProxies);
01145 dft->closeTrace();
01146 msg->printOut("PMgr::recvST");
01147 #endif
01148
01149 //This function is divided into three parts. The tree root is msg->allPes[0]
01150 //1. set up its own immediate childrens
01151 int treesize = msg->numNodesWithProxies;
01152 int iNChild = 0; //number of internal children
01153 int eNChild = 0; //number of external children
01154 if(treesize>0){
01155 iNChild = (msg->numPesOfNode[0]-1); //exclude the root itself
01156 eNChild = (proxySpanDim>(treesize-1))?(treesize-1):proxySpanDim;
01157 }
01158 int numChild = iNChild + eNChild;
01159 if(numChild==0){
01160 ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01161 proxy->setSpanningTree(msg->procID, NULL, 0);
01162 return;
01163 }
01164
01165 nodecount++;
01166 //if (nodecount > MAX_INTERNODE)
01167 // iout << "Processor " << CkMyPe() << "has (actual) " << nodecount << " intermediate nodes." << endi;
01168
01169 if(!PatchMap::Object()->homePatch(msg->patch)){
01170 //the home patch of this spanning tree has been already set up for its childrens
01171 ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01172 int children[numChild];
01173 //add external children
01174 int *p = msg->allPes + msg->numPesOfNode[0];
01175 for(int i=0; i<eNChild; i++) {
01176 children[i] = *p;
01177 p += msg->numPesOfNode[i+1];
01178 }
01179 //add internal children
01180 for(int i=eNChild, j=1; i<numChild; i++, j++) {
01181 children[i] = msg->allPes[j];
01182 }
01183 proxy->setSpanningTree(msg->procID, children, numChild);
01184 }
01185
01186 //2. send msgs for the tree to external children proxies
01187 if(eNChild > 0) {
01188 ResizeArray<int> *exTreeChildSize = new ResizeArray<int>[eNChild];
01189 ResizeArray<int *> *exTreeChildPtr = new ResizeArray<int *>[eNChild];
01190
01191 int nodesToCnt = 1; //the number of children each root (current root's
01192 //immedidate external nodes) has in each level
01193 int pos = 1; //track the iteration over msg->numPesOfNode and skip the current root
01194 int *pePtr = msg->allPes + msg->numPesOfNode[0];
01195 int done = 0;
01196 while(!done) {
01197 for(int childID=0; childID<eNChild;childID++) {
01198 //iterate nodes on each level
01199 for(int i=0; i<nodesToCnt; i++) {
01200 int cursize = msg->numPesOfNode[pos];
01201 exTreeChildSize[childID].add(cursize);
01202 exTreeChildPtr[childID].add(pePtr);
01203 pos++;
01204 pePtr += cursize;
01205 if(pos==msg->numNodesWithProxies) {
01206 done = 1;
01207 break;
01208 }
01209 }
01210 if(done) break;
01211 }
01212 nodesToCnt *= proxySpanDim;
01213 }
01214
01215 for(int i=0; i<eNChild; i++) {
01216 ResizeArray<int> *allSizes = &exTreeChildSize[i];
01217 ResizeArray<int *> *allPtrs = &exTreeChildPtr[i];
01218 int totalNodes = allSizes->size();
01219 int totalPes = 0;
01220 for(int j=0; j<totalNodes; j++) totalPes += allSizes->item(j);
01221 ProxyNodeAwareSpanningTreeMsg *cmsg = new(totalNodes, totalPes)ProxyNodeAwareSpanningTreeMsg;
01222 cmsg->patch = msg->patch;
01223 cmsg->procID = CkMyPe();
01224 cmsg->numNodesWithProxies = totalNodes;
01225 int *pAllPes = cmsg->allPes;
01226 for(int j=0; j<totalNodes; j++) {
01227 int numPes = allSizes->item(j);
01228 cmsg->numPesOfNode[j] = numPes;
01229 memcpy(pAllPes, allPtrs->item(j), sizeof(int)*numPes);
01230 pAllPes += numPes;
01231 }
01232 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01233 cmsg->printOut("sndExtChi:");
01234 #endif
01235 ProxyMgr::Object()->sendNodeAwareSpanningTree(cmsg);
01236 }
01237
01238 delete [] exTreeChildSize;
01239 delete [] exTreeChildPtr;
01240 }
01241
01242 //3. send msgs for the tree to the children proxies within the same (physical) node
01243 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
01244 for(int i=0; i<iNChild; i++) {
01245 int pe = msg->allPes[i+1]; //excluding the root procID at allPes[0]
01246 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01247 DebugFileTrace *dft = DebugFileTrace::Object();
01248 dft->openTrace();
01249 dft->writeTrace("Preparing send a msg to internal children for patch[%d] from proc %d to proc %d\n",
01250 msg->patch, CkMyPe(), pe);
01251 dft->closeTrace();
01252 #endif
01253 cp[pe].recvNodeAwareSTParent(msg->patch, CkMyPe());
01254 }
01255
01256 delete msg;
01257 }
|
|
|
Definition at line 1050 of file ProxyMgr.C. References PatchMap::homePatch(), PatchMap::Object(), ProxyNodeAwareSpanningTreeMsg::patch, and HomePatch::recvNodeAwareSpanningTree(). 01051 {
01052 HomePatch *p = PatchMap::Object()->homePatch(msg->patch);
01053 p->recvNodeAwareSpanningTree(msg);
01054 delete msg;
01055 }
|
|
||||||||||||
|
Definition at line 1259 of file ProxyMgr.C. References PatchMap::Object(), PatchMap::patch(), and ProxyPatch::setSpanningTree(). 01259 {
01260 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01261 DebugFileTrace *dft = DebugFileTrace::Object();
01262 dft->openTrace();
01263 dft->writeTrace("PMgr::recvSTParent: for ProxyPatch[%d], parent is %d\n", patch, parent);
01264 dft->closeTrace();
01265 #endif
01266 ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(patch);
01267 CmiAssert(proxy!=NULL);
01268 proxy->setSpanningTree(parent, NULL, 0);
01269 }
|
|
||||||||||||||||
|
Definition at line 579 of file ProxyMgr.C. References buildSpanningTree0(), NodeIDList, PatchMap::numPatches(), PatchMap::Object(), ProxyTree::proxylist, ProxyTree::proxyMsgCount, ResizeArray< Elem >::resize(), and sendSpanningTrees(). 00580 {
00581 int nPatches = PatchMap::Object()->numPatches();
00582 if (ptree.proxylist == NULL)
00583 ptree.proxylist = new NodeIDList[nPatches];
00584 ptree.proxylist[pid].resize(n);
00585 for (int i=0; i<n; i++)
00586 ptree.proxylist[pid][i] = list[i];
00587 ptree.proxyMsgCount ++;
00588 if (ptree.proxyMsgCount == nPatches) {
00589 ptree.proxyMsgCount = 0;
00590 // building and sending of trees is done in two steps now
00591 // so that the building step can be shifted to the load balancer
00592 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00593 buildNodeAwareSpanningTree0();
00594 #else
00595 buildSpanningTree0();
00596 #endif
00597 sendSpanningTrees();
00598 }
00599 }
|
|
|
Definition at line 1399 of file ProxyMgr.C. References PatchMap::Object(), ProxyDataMsg::patch, PatchMap::patch(), and ProxyPatch::receiveAll(). Referenced by recvImmediateProxyAll(). 01399 {
01400 ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01401 proxy->receiveAll(msg); // deleted in ProxyPatch::receiveAtoms()
01402 }
|
|
|
Definition at line 1363 of file ProxyMgr.C. References PatchMap::Object(), ProxyDataMsg::patch, PatchMap::patch(), and ProxyPatch::receiveData(). Referenced by recvImmediateProxyData(). 01363 {
01364 ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01365 proxy->receiveData(msg); // deleted in ProxyPatch::receiveAtoms()
01366 }
|
|
|
Definition at line 507 of file ProxyMgr.C. References PatchMap::homePatch(), PatchMap::Object(), RegisterProxyMsg::patch, and HomePatch::registerProxy(). 00507 {
00508 HomePatch *homePatch = PatchMap::Object()->homePatch(msg->patch);
00509 homePatch->registerProxy(msg); // message deleted in registerProxy()
00510 }
|
|
|
Definition at line 1321 of file ProxyMgr.C. References PatchMap::homePatch(), NAMD_bug(), PatchMap::Object(), ProxyCombinedResultMsg::patch, and HomePatch::receiveResults(). 01321 {
01322 HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
01323 if (home) {
01324 //printf("Home got a message\n");
01325 home->receiveResults(msg); // delete done in HomePatch::receiveResults()
01326 }
01327 else {
01328 NAMD_bug("ProxyMgr should receive result message on home processor");
01329 }
01330 }
|
|
|
Definition at line 1296 of file ProxyMgr.C. References PatchMap::homePatch(), PatchMap::Object(), ProxyResultMsg::patch, and HomePatch::receiveResults(). 01296 {
01297 HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
01298 home->receiveResults(msg); // delete done in HomePatch::receiveResults()
01299 }
|
|
|
Definition at line 1281 of file ProxyMgr.C. References PatchMap::homePatch(), PatchMap::Object(), ProxyResultVarsizeMsg::patch, and HomePatch::receiveResults(). 01281 {
01282 HomePatch *home = PatchMap::Object()->homePatch(msg->patch);
01283 home->receiveResults(msg); // delete done in HomePatch::receiveResults()
01284 }
|
|
|
Definition at line 1086 of file ProxyMgr.C. References ResizeArray< Elem >::add(), PatchMap::homePatch(), ProxySpanningTreeMsg::node, nodecount, NodeIDList, Object(), PatchMap::Object(), ProxySpanningTreeMsg::patch, PatchMap::patch(), sendSpanningTree(), ProxyPatch::setSpanningTree(), ResizeArray< Elem >::size(), and ProxySpanningTreeMsg::tree. 01086 {
01087 int size = msg->tree.size();
01088 int child[proxySpanDim];
01089 int nChild = 0;
01090 int i;
01091 ProxyPatch *proxy = (ProxyPatch *) PatchMap::Object()->patch(msg->patch);
01092 for (i=0; i<proxySpanDim; i++) {
01093 if (size > i+1) { child[i] = msg->tree[i+1]; nChild++; }
01094 }
01095 if (!PatchMap::Object()->homePatch(msg->patch)) {
01096 proxy->setSpanningTree(msg->node, child, nChild);
01097 }
01098
01099 // build subtree and pass down
01100 if (nChild == 0) return;
01101
01102 nodecount ++;
01103 //if (nodecount > MAX_INTERNODE)
01104 // iout << "Processor " << CkMyPe() << "has (actual) " << nodecount << " intermediate nodes." << endi;
01105
01106 //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]);
01107 NodeIDList *tree = new NodeIDList[proxySpanDim];
01108 int level = 1, index=1;
01109 int done = 0;
01110 while (!done) {
01111 for (int n=0; n<nChild; n++) {
01112 if (done) break;
01113 for (int j=0; j<level; j++) {
01114 if (index >= size) { done = 1; break; }
01115 tree[n].add(msg->tree[index]);
01116 index++;
01117 }
01118 }
01119 level *=proxySpanDim;
01120 }
01121
01122 ProxyMgr *proxyMgr = ProxyMgr::Object();
01123 for (i=0; i<proxySpanDim; i++) {
01124 if (tree[i].size()) {
01125 ProxySpanningTreeMsg *cmsg = new ProxySpanningTreeMsg;
01126 cmsg->patch = msg->patch;
01127 cmsg->node = CkMyPe();
01128 cmsg->tree = tree[i];
01129 proxyMgr->sendSpanningTree(cmsg);
01130 }
01131 }
01132
01133 delete [] tree;
01134 delete msg;
01135 }
|
|
||||||||||||||||
|
Definition at line 1037 of file ProxyMgr.C. References PatchMap::homePatch(), PatchMap::Object(), and HomePatch::recvSpanningTree(). Referenced by sendSpanningTreeToHomePatch(). 01038 {
01039 HomePatch *p = PatchMap::Object()->homePatch(pid);
01040 p->recvSpanningTree(tree, n);
01041 }
|
|
|
Definition at line 531 of file ProxyMgr.C. References PatchMap::homePatch(), PatchMap::Object(), UnregisterProxyMsg::patch, and HomePatch::unregisterProxy(). 00531 {
00532 HomePatch *homePatch = PatchMap::Object()->homePatch(msg->patch);
00533 homePatch->unregisterProxy(msg); // message deleted in registerProxy()
00534 }
|
|
|
Definition at line 489 of file ProxyMgr.C. References RegisterProxyMsg::node, PatchMap::node(), NodeID, PatchMap::Object(), and RegisterProxyMsg::patch. Referenced by ProxyPatch::ProxyPatch(). 00489 {
00490 // determine which node gets message
00491 NodeID node = PatchMap::Object()->node(pid);
00492
00493 RegisterProxyMsg *msg = new RegisterProxyMsg;
00494
00495 msg->node=CkMyPe();
00496 msg->patch = pid;
00497
00498 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
00499 #if CHARM_VERSION > 050402
00500 cp[node].recvRegisterProxy(msg);
00501 #else
00502 cp.recvRegisterProxy(msg,node);
00503 #endif
00504 }
|
|
|
Definition at line 369 of file ProxyMgr.C. References UniqueSetIter< T >::begin(), UniqueSet< Elem >::clear(), UniqueSetIter< T >::end(), and ProxySetIter. Referenced by createProxies(), and ~ProxyMgr(). 00370 {
00371 ProxySetIter pi(proxySet);
00372 for ( pi = pi.begin(); pi != pi.end(); pi++)
00373 {
00374 delete pi->proxyPatch;
00375 }
00376 proxySet.clear();
00377 }
|
|
|
Definition at line 478 of file ProxyMgr.C. References UniqueSet< Elem >::del(), UniqueSet< Elem >::find(), PatchMap::Object(), ProxyElem::proxyPatch, and PatchMap::unregisterPatch(). Referenced by removeUnusedProxies(). 00478 {
00479 ProxyElem *p = proxySet.find(ProxyElem(pid));
00480 if (p) {
00481 PatchMap::Object()->unregisterPatch(pid,p->proxyPatch);
00482 delete p->proxyPatch;
00483 proxySet.del(ProxyElem(pid));
00484 // iout << iINFO << "Removing unused proxy " << pid << " on " << iPE << ".\n" << endi;
00485 }
00486 }
|
|
|
Definition at line 379 of file ProxyMgr.C. References ResizeArray< Elem >::add(), ResizeArray< Elem >::begin(), UniqueSetIter< T >::begin(), ResizeArray< Elem >::end(), UniqueSetIter< T >::end(), PatchID, ProxySetIter, and removeProxy(). Referenced by ComputeMgr::updateLocalComputes3(). 00380 {
00381 ResizeArray<PatchID> toDelete;
00382 ProxySetIter pi(proxySet);
00383 for ( pi = pi.begin(); pi != pi.end(); pi++)
00384 {
00385 if ( pi->proxyPatch->getNumComputes() == 0 ) {
00386 toDelete.add(pi->patchID);
00387 //fprintf(stderr, "Proxy Deleted Patch %d Proc %d", pi->patchID, CkMyPe());
00388 }
00389 }
00390 PatchID *pidi = toDelete.begin();
00391 for ( ; pidi != toDelete.end(); ++pidi ) {
00392 removeProxy(*pidi);
00393 }
00394 }
|
|
|
Definition at line 1067 of file ProxyMgr.C. References ProxyNodeAwareSpanningTreeMsg::allPes, and ProxyNodeAwareSpanningTreeMsg::patch. Referenced by recvNodeAwareSpanningTree(). 01067 {
01068 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
01069 int pe = msg->allPes[0]; //the root procID
01070
01071 #if defined(PROCTRACE_DEBUG) && defined(NAST_DEBUG)
01072 DebugFileTrace *dft = DebugFileTrace::Object();
01073 dft->openTrace();
01074 dft->writeTrace("PMgr::sndST: from proc %d for patch[%d]\n", pe, msg->patch);
01075 dft->closeTrace();
01076 #endif
01077
01078 #if CHARM_VERSION > 050402
01079 cp[pe].recvNodeAwareSpanningTree(msg);
01080 #else
01081 cp.recvNodeAwareSpanningTree(msg, pe);
01082 #endif
01083 }
|
|
||||||||||||||||
|
Definition at line 1043 of file ProxyMgr.C. References ProxyNodeAwareSpanningTreeMsg::getANewMsg(), PatchMap::node(), and PatchMap::Object(). Referenced by sendSpanningTrees(). 01044 {
01045 CProxy_ProxyMgr cp(thisgroup);
01046 ProxyNodeAwareSpanningTreeMsg *msg = ProxyNodeAwareSpanningTreeMsg::getANewMsg(pid, -1, tree, n);
01047 cp[PatchMap::Object()->node(pid)].recvNodeAwareSpanningTreeOnHomePatch(msg);
01048 }
|
|
||||||||||||||||
|
Definition at line 566 of file ProxyMgr.C. Referenced by HomePatch::sendProxies(). 00567 {
00568 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
00569 cp[0].recvProxies(pid, list, n);
00570 }
|
|
||||||||||||||||
|
Definition at line 1393 of file ProxyMgr.C. References recvImmediateProxyAll(). Referenced by HomePatch::positionsReady(), and recvImmediateProxyAll(). 01393 {
01394 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
01395 cp.recvImmediateProxyAll(msg,pcnt,pids);
01396 }
|
|
||||||||||||||||
|
Definition at line 1357 of file ProxyMgr.C. Referenced by HomePatch::positionsReady(), and recvImmediateProxyData(). 01357 {
01358 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
01359 cp.recvImmediateProxyData(msg,pcnt,pids);
01360 }
|
|
|
Definition at line 1302 of file ProxyMgr.C. References ProxyPatch::depositCombinedResultMsg(), ProxyPatch::getSpanningTreeParent(), PatchMap::Object(), ProxyCombinedResultMsg::patch, and PatchMap::patch(). 01302 {
01303 ProxyPatch *patch = (ProxyPatch *)PatchMap::Object()->patch(msg->patch);
01304 ProxyCombinedResultMsg *cMsg = patch->depositCombinedResultMsg(msg);
01305 if (cMsg) {
01306 CProxy_ProxyMgr cp(CpvAccess(BOCclass_group).proxyMgr);
01307 int destPe = patch->getSpanningTreeParent();
01308 if(destPe != CkMyPe()) {
01309 #if CHARM_VERSION > 050402
01310 cp[destPe].recvImmediateResults(cMsg);
01311 #else
01312 cp.recvImmediateResults(cMsg, destPe);
01313 #endif
01314 }
01315 else
01316 cp[destPe].recvResults(cMsg);
01317 }
01318 }
|
|