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 "ComputeNonbondedMICKernel.h"
#include "SimParameters.h"
#include "Node.h"
#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);)
static void outputProxyTree (ProxyTree &ptree, int np)
static int compLoad (const void *a, const void *b)
static void processCpuLoad ()
static int noInterNode (int p)

Variables

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


Define Documentation

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

Definition at line 43 of file ProxyMgr.C.

#define HOMEPATCH_TREE_BRFACTOR   2

Definition at line 1921 of file ProxyMgr.C.

Referenced by NodeProxyMgr::createSTForHomePatches().

#define MAX_INTERNODE   1

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


Function Documentation

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

Definition at line 698 of file ProxyMgr.C.

Referenced by processCpuLoad().

00699 {
00700   int i1 = *(int *)a;
00701   int i2 = *(int *)b;
00702   double d1 = cpuloads[i1];
00703   double d2 = cpuloads[i2];
00704   if (d1 < d2) 
00705     return 1;
00706   else if (d1 == d2) 
00707     return 0;
00708   else 
00709     return -1;
00710   // sort from high to low
00711 }

static int noInterNode ( int  p  )  [static]

Definition at line 729 of file ProxyMgr.C.

Referenced by ProxyMgr::buildSpanningTree0().

00730 {
00731   int exclude = 0;
00732   if(CkNumPes()<1025)
00733     exclude = 5;
00734   else if(CkNumPes()<4097)
00735     exclude = 10;
00736   else if(CkNumPes()<8193)
00737     exclude = 40;
00738   else if(CkNumPes()<16385)
00739     exclude = 40;
00740   else
00741     exclude = 80;
00742   for (int i=0; i<exclude; i++) if (procidx[i] == p) return 1;
00743 //  if (cpuloads[p] > averageLoad) return 1;
00744   return 0;
00745 }

static void outputProxyTree ( ProxyTree ptree,
int  np 
) [static]

Definition at line 612 of file ProxyMgr.C.

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

00612                                                      {
00613         FILE *ofp = fopen("patch_proxylist.txt", "w");
00614         std::vector<int> plist;
00615         for(int i=0; i<np; i++) {
00616                 fprintf(ofp, "%d: ", i);
00617                 int listlen = ptree.proxylist[i].size();
00618                 fprintf(ofp, "#%d ", listlen);
00619                 plist.clear();
00620                 for(int j=0; j<listlen; j++) {
00621                         plist.push_back(ptree.proxylist[i][j]);
00622                 }
00623                 std::sort(plist.begin(), plist.end());
00624                 for(int j=0; j<listlen; j++) {
00625                         fprintf(ofp, "%d ", plist[j]);
00626                 }
00627                 fprintf(ofp, "\n");
00628         }
00629         fclose(ofp);
00630 }

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

Definition at line 51 of file ProxyMgr.C.

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

static void processCpuLoad (  )  [static]

Definition at line 713 of file ProxyMgr.C.

References compLoad().

Referenced by ProxyMgr::buildSpanningTree0().

00714 {
00715   int i;
00716   if (!procidx) {
00717     procidx = new int[CkNumPes()];
00718   }
00719   for (i=0; i<CkNumPes(); i++) procidx[i] = i;
00720   qsort(procidx, CkNumPes(), sizeof(int), compLoad);
00721 
00722   double averageLoad = 0.0;
00723   for (i=0; i<CkNumPes(); i++) averageLoad += cpuloads[i];
00724   averageLoad /= CkNumPes();
00725 //  iout << "buildSpanningTree1: no intermediate node on " << procidx[0] << " " << procidx[1] << endi;
00726 
00727 }


Variable Documentation

double averageLoad = 0.0 [static]

Definition at line 696 of file ProxyMgr.C.

Referenced by NamdHybridLB::splitComputes(), and NamdCentLB::Strategy().

double* cpuloads

Definition at line 24 of file NamdCentLB.C.

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

int inNodeProxySpanDim = 16

Definition at line 49 of file ProxyMgr.C.

int* procidx = NULL [static]

Definition at line 695 of file ProxyMgr.C.

int proxyRecvSpanning = 0

Definition at line 46 of file ProxyMgr.C.

Referenced by ProxyMgr::buildProxySpanningTree(), ProxyMgr::buildSpanningTree0(), ProxyMgr::getRecvSpanning(), Sync::openSync(), ProxyMgr::recvResults(), RefineOnly::RefineOnly(), RefineTorusLB::RefineTorusLB(), ProxyMgr::setRecvSpanning(), Node::startup(), and ComputeMgr::updateLocalComputes5().

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

Referenced by ProxyMgr::buildProxySpanningTree(), ProxyMgr::buildSpanningTree0(), ProxyMgr::getSendSpanning(), 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 48 of file ProxyMgr.C.

Referenced by ProxyMgr::buildProxySpanningTree(), HomePatch::buildSpanningTree(), ProxyMgr::buildSpanningTree0(), Rebalancer::decrSTLoad(), Rebalancer::incrSTLoad(), HomePatch::positionsReady(), ProxyPatch::ProxyPatch(), ProxyMgr::recvSpanningTree(), HomePatch::recvSpanningTree(), and ProxyMgr::setProxyTreeBranchFactor().


Generated on Sat Nov 18 01:17:17 2017 for NAMD by  doxygen 1.4.7