Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | 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 1915 of file ProxyMgr.C.

Referenced by NodeProxyMgr::createSTForHomePatches().

#define MAX_INTERNODE   1
 

Definition at line 598 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 687 of file ProxyMgr.C.

References cpuloads.

Referenced by processCpuLoad().

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

int noInterNode int  p  )  [static]
 

Definition at line 718 of file ProxyMgr.C.

References procidx.

Referenced by ProxyMgr::buildSpanningTree0().

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

void outputProxyTree ProxyTree ptree,
int  np
[static]
 

Definition at line 601 of file ProxyMgr.C.

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

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

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 702 of file ProxyMgr.C.

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

Referenced by ProxyMgr::buildSpanningTree0().

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


Variable Documentation

double averageLoad = 0.0 [static]
 

Definition at line 685 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 684 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 Wed May 22 04:07:20 2013 for NAMD by  doxygen 1.3.9.1