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

ProxyMgr.C File Reference

#include "InfoStream.h"
#include "main.h"
#include "BOCgroup.h"
#include "ProxyMgr.decl.h"
#include "ProxyMgr.h"
#include "PatchMap.inl"
#include "ProxyPatch.h"
#include "ComputeMap.h"
#include "HomePatch.h"
#include <string.h>
#include "ProcessorPrivate.h"
#include "packmsg.h"
#include "Priorities.h"
#include <alloca.h>
#include <malloc.h>
#include <map>
#include <vector>
#include <algorithm>
#include "Debug.h"
#include "ProxyMgr.def.h"

Go to the source code of this file.

Defines

#define MIN_DEBUG_LEVEL   2
#define ALLOCA(TYPE, NAME, SIZE)   TYPE *NAME = (TYPE *) alloca((SIZE)*sizeof(TYPE))
#define MAX_INTERNODE   1
#define HOMEPATCH_TREE_BRFACTOR   2

Functions

 PACK_MSG (ProxySpanningTreeMsg, PACK(patch);PACK(node);PACK_RESIZE(tree);)
void outputProxyTree (ProxyTree &ptree, int np)
int compLoad (const void *a, const void *b)
void processCpuLoad ()
int noInterNode (int p)

Variables

int proxySendSpanning = 0
int proxyRecvSpanning = 0
int proxySpanDim = 4
int inNodeProxySpanDim = 16
double * cpuloads
int * procidx = NULL
double averageLoad = 0.0


Define Documentation

#define ALLOCA TYPE,
NAME,
SIZE   )     TYPE *NAME = (TYPE *) alloca((SIZE)*sizeof(TYPE))
 

Definition at line 39 of file ProxyMgr.C.

#define HOMEPATCH_TREE_BRFACTOR   2
 

Definition at line 1909 of file ProxyMgr.C.

Referenced by NodeProxyMgr::createSTForHomePatches().

#define MAX_INTERNODE   1
 

Definition at line 596 of file ProxyMgr.C.

Referenced by ProxyMgr::buildSpanningTree0().

#define MIN_DEBUG_LEVEL   2
 

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 36 of file ProxyMgr.C.


Function Documentation

int compLoad const void *  a,
const void *  b
[static]
 

Definition at line 685 of file ProxyMgr.C.

References cpuloads.

Referenced by processCpuLoad().

00686 {
00687   int i1 = *(int *)a;
00688   int i2 = *(int *)b;
00689   double d1 = cpuloads[i1];
00690   double d2 = cpuloads[i2];
00691   if (d1 < d2) 
00692     return 1;
00693   else if (d1 == d2) 
00694     return 0;
00695   else 
00696     return -1;
00697   // sort from high to low
00698 }

int noInterNode int  p  )  [static]
 

Definition at line 716 of file ProxyMgr.C.

References procidx.

Referenced by ProxyMgr::buildSpanningTree0().

00717 {
00718   int exclude = 0;
00719   if(CkNumPes()<1025)
00720     exclude = 5;
00721   else if(CkNumPes()<4097)
00722     exclude = 10;
00723   else if(CkNumPes()<8193)
00724     exclude = 40;
00725   else if(CkNumPes()<16385)
00726     exclude = 40;
00727   else
00728     exclude = 80;
00729   for (int i=0; i<exclude; i++) if (procidx[i] == p) return 1;
00730 //  if (cpuloads[p] > averageLoad) return 1;
00731   return 0;
00732 }

void outputProxyTree ProxyTree ptree,
int  np
[static]
 

Definition at line 599 of file ProxyMgr.C.

References ResizeArray< Elem >::clear(), j, ProxyTree::proxylist, and ResizeArray< Elem >::size().

00599                                                      {
00600         FILE *ofp = fopen("patch_proxylist.txt", "w");
00601         std::vector<int> plist;
00602         for(int i=0; i<np; i++) {
00603                 fprintf(ofp, "%d: ", i);
00604                 int listlen = ptree.proxylist[i].size();
00605                 fprintf(ofp, "#%d ", listlen);
00606                 plist.clear();
00607                 for(int j=0; j<listlen; j++) {
00608                         plist.push_back(ptree.proxylist[i][j]);
00609                 }
00610                 std::sort(plist.begin(), plist.end());
00611                 for(int j=0; j<listlen; j++) {
00612                         fprintf(ofp, "%d ", plist[j]);
00613                 }
00614                 fprintf(ofp, "\n");
00615         }
00616         fclose(ofp);
00617 }

PACK_MSG ProxySpanningTreeMsg  ,
PACK(patch);PACK(node);PACK_RESIZE(tree); 
 

Definition at line 47 of file ProxyMgr.C.

References ALIGN_8, ResizeArray< Elem >::begin(), Force, ProxyResultMsg::forceList, j, ProxyResultMsg::node, ProxyResultMsg::patch, ResizeArray< Elem >::size(), Vector::x, Vector::y, and Vector::z.

00053                                               {
00054 
00055   int msg_size = 0;
00056   msg_size += sizeof(msg->node);
00057   msg_size += sizeof(msg->patch);
00058 
00059   int j;
00060   for ( j = 0; j < Results::maxNumForces; ++j ) {
00061     int array_size = msg->forceList[j].size();
00062     msg_size += sizeof(array_size);
00063     msg_size += array_size * sizeof(char);    
00064     msg_size = ALIGN_8 (msg_size);
00065     Force* f = msg->forceList[j].begin();
00066     int nonzero_count = 0;
00067     for ( int i = 0; i < array_size; ++i ) {
00068       if ( f[i].x != 0. || f[i].y != 0. || f[i].z != 0. ) { ++nonzero_count; }
00069     }
00070     msg_size += nonzero_count * sizeof(Vector);
00071   }
00072 
00073   void *msg_buf = CkAllocBuffer(msg,msg_size);
00074   char *msg_cur = (char *)msg_buf;
00075 
00076   CmiMemcpy((void*)msg_cur,(void*)(&(msg->node)),sizeof(msg->node));
00077   msg_cur += sizeof(msg->node);
00078   CmiMemcpy((void*)msg_cur,(void*)(&(msg->patch)),sizeof(msg->patch));
00079   msg_cur += sizeof(msg->patch);
00080   for ( j = 0; j < Results::maxNumForces; ++j ) {
00081     int array_size = msg->forceList[j].size();
00082     *(int *) msg_cur = array_size;
00083     msg_cur += sizeof(int);
00084     char *nonzero = msg_cur;
00085     msg_cur += array_size * sizeof(char);
00086     msg_cur = (char *)ALIGN_8 (msg_cur);
00087     Vector *farr = (Vector *)msg_cur;
00088     Force* f = msg->forceList[j].begin();
00089 
00090     for ( int i = 0; i < array_size; ++i ) {
00091       if ( f[i].x != 0. || f[i].y != 0. || f[i].z != 0. ) {
00092         nonzero[i] = 1;
00093         farr->x = f[i].x;
00094         farr->y = f[i].y;
00095         farr->z = f[i].z;
00096         farr ++;
00097       } else {
00098         nonzero[i] = 0;
00099       }
00100     }
00101     msg_cur = (char *) farr;      
00102   }
00103 
00104   delete msg;
00105   return msg_buf;
00106 }

void processCpuLoad  )  [static]
 

Definition at line 700 of file ProxyMgr.C.

References averageLoad, compLoad(), cpuloads, and procidx.

Referenced by ProxyMgr::buildSpanningTree0().

00701 {
00702   int i;
00703   if (!procidx) {
00704     procidx = new int[CkNumPes()];
00705   }
00706   for (i=0; i<CkNumPes(); i++) procidx[i] = i;
00707   qsort(procidx, CkNumPes(), sizeof(int), compLoad);
00708 
00709   double averageLoad = 0.0;
00710   for (i=0; i<CkNumPes(); i++) averageLoad += cpuloads[i];
00711   averageLoad /= CkNumPes();
00712 //  iout << "buildSpanningTree1: no intermediate node on " << procidx[0] << " " << procidx[1] << endi;
00713 
00714 }


Variable Documentation

double averageLoad = 0.0 [static]
 

Definition at line 683 of file ProxyMgr.C.

Referenced by processCpuLoad().

double* cpuloads
 

Definition at line 24 of file NamdCentLB.C.

Referenced by compLoad(), CreateNamdCentLB(), CreateNamdHybridLB(), processCpuLoad(), NamdCentLB::Strategy(), and NamdHybridLB::UpdateLocalLBInfo().

int inNodeProxySpanDim = 16
 

Definition at line 45 of file ProxyMgr.C.

int* procidx = NULL [static]
 

Definition at line 682 of file ProxyMgr.C.

Referenced by noInterNode(), and processCpuLoad().

int proxyRecvSpanning = 0
 

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 42 of file ProxyMgr.C.

Referenced by ProxyMgr::buildProxySpanningTree(), ProxyMgr::buildSpanningTree0(), ProxyMgr::recvResults(), and ProxyMgr::setRecvSpanning().

int proxySendSpanning = 0
 

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 41 of file ProxyMgr.C.

Referenced by ProxyMgr::buildProxySpanningTree(), ProxyMgr::buildSpanningTree0(), Sync::openSync(), HomePatch::positionsReady(), ProxyMgr::recvImmediateProxyAll(), ProxyMgr::recvImmediateProxyData(), ProxyMgr::recvProxyAll(), ProxyMgr::recvProxyData(), RefineOnly::RefineOnly(), RefineTorusLB::RefineTorusLB(), ProxyMgr::sendProxyAll(), ProxyMgr::sendProxyData(), ProxyMgr::setSendSpanning(), Node::startup(), and ComputeMgr::updateLocalComputes5().

int proxySpanDim = 4
 

Definition at line 44 of file ProxyMgr.C.

Referenced by ProxyMgr::buildProxySpanningTree(), HomePatch::buildSpanningTree(), ProxyMgr::buildSpanningTree0(), ProxyMgr::recvNodeAwareSpanningTree(), and ProxyMgr::setProxyTreeBranchFactor().


Generated on Fri May 25 04:07:18 2012 for NAMD by  doxygen 1.3.9.1