NAMD
Macros | Functions | Variables
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.

Macros

#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
 

Macro Definition Documentation

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

Definition at line 43 of file ProxyMgr.C.

Referenced by ProxyMgr::recvNodeAwareSpanningTree().

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

699 {
700  int i1 = *(int *)a;
701  int i2 = *(int *)b;
702  double d1 = cpuloads[i1];
703  double d2 = cpuloads[i2];
704  if (d1 < d2)
705  return 1;
706  else if (d1 == d2)
707  return 0;
708  else
709  return -1;
710  // sort from high to low
711 }
double * cpuloads
Definition: NamdCentLB.C:24
static int noInterNode ( int  p)
static

Definition at line 729 of file ProxyMgr.C.

Referenced by ProxyMgr::buildSpanningTree0().

730 {
731  int exclude = 0;
732  if(CkNumPes()<1025)
733  exclude = 5;
734  else if(CkNumPes()<4097)
735  exclude = 10;
736  else if(CkNumPes()<8193)
737  exclude = 40;
738  else if(CkNumPes()<16385)
739  exclude = 40;
740  else
741  exclude = 80;
742  for (int i=0; i<exclude; i++) if (procidx[i] == p) return 1;
743 // if (cpuloads[p] > averageLoad) return 1;
744  return 0;
745 }
static int * procidx
Definition: ProxyMgr.C:695
static void outputProxyTree ( ProxyTree ptree,
int  np 
)
static

Definition at line 612 of file ProxyMgr.C.

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

612  {
613  FILE *ofp = fopen("patch_proxylist.txt", "w");
614  std::vector<int> plist;
615  for(int i=0; i<np; i++) {
616  fprintf(ofp, "%d: ", i);
617  int listlen = ptree.proxylist[i].size();
618  fprintf(ofp, "#%d ", listlen);
619  plist.clear();
620  for(int j=0; j<listlen; j++) {
621  plist.push_back(ptree.proxylist[i][j]);
622  }
623  std::sort(plist.begin(), plist.end());
624  for(int j=0; j<listlen; j++) {
625  fprintf(ofp, "%d ", plist[j]);
626  }
627  fprintf(ofp, "\n");
628  }
629  fclose(ofp);
630 }
static __thread unsigned int * plist
BlockRadixSort::TempStorage sort
NodeIDList * proxylist
Definition: ProxyMgr.h:291
int size(void) const
Definition: ResizeArray.h:127
PACK_MSG ( ProxySpanningTreeMsg  ,
PACK(patch);PACK(node);PACK_RESIZE(tree);   
)

Definition at line 51 of file ProxyMgr.C.

57  {
58 
59  int msg_size = 0;
60  msg_size += sizeof(msg->node);
61  msg_size += sizeof(msg->patch);
62 
63  int j;
64  for ( j = 0; j < Results::maxNumForces; ++j ) {
65  int array_size = msg->forceList[j]->size();
66  msg_size += sizeof(array_size);
67  msg_size += array_size * sizeof(char);
68  msg_size = ALIGN_8 (msg_size);
69  Force* f = msg->forceList[j]->begin();
70  int nonzero_count = 0;
71  for ( int i = 0; i < array_size; ++i ) {
72  if ( f[i].x != 0. || f[i].y != 0. || f[i].z != 0. ) { ++nonzero_count; }
73  }
74  msg_size += nonzero_count * sizeof(Vector);
75  }
76 
77  void *msg_buf = CkAllocBuffer(msg,msg_size);
78  char *msg_cur = (char *)msg_buf;
79 
80  CmiMemcpy((void*)msg_cur,(void*)(&(msg->node)),sizeof(msg->node));
81  msg_cur += sizeof(msg->node);
82  CmiMemcpy((void*)msg_cur,(void*)(&(msg->patch)),sizeof(msg->patch));
83  msg_cur += sizeof(msg->patch);
84  for ( j = 0; j < Results::maxNumForces; ++j ) {
85  int array_size = msg->forceList[j]->size();
86  *(int *) msg_cur = array_size;
87  msg_cur += sizeof(int);
88  char *nonzero = msg_cur;
89  msg_cur += array_size * sizeof(char);
90  msg_cur = (char *)ALIGN_8 (msg_cur);
91  Vector *farr = (Vector *)msg_cur;
92  Force* f = msg->forceList[j]->begin();
93 
94  for ( int i = 0; i < array_size; ++i ) {
95  if ( f[i].x != 0. || f[i].y != 0. || f[i].z != 0. ) {
96  nonzero[i] = 1;
97  farr->x = f[i].x;
98  farr->y = f[i].y;
99  farr->z = f[i].z;
100  farr ++;
101  } else {
102  nonzero[i] = 0;
103  }
104  }
105  msg_cur = (char *) farr;
106  }
107 
108  delete msg;
109  return msg_buf;
110 }
Definition: Vector.h:64
BigReal z
Definition: Vector.h:66
gridSize z
BigReal x
Definition: Vector.h:66
#define ALIGN_8(x)
Definition: packmsg.h:25
BigReal y
Definition: Vector.h:66
gridSize y
gridSize x
static void processCpuLoad ( )
static

Definition at line 713 of file ProxyMgr.C.

References compLoad().

Referenced by ProxyMgr::buildSpanningTree0().

714 {
715  int i;
716  if (!procidx) {
717  procidx = new int[CkNumPes()];
718  }
719  for (i=0; i<CkNumPes(); i++) procidx[i] = i;
720  qsort(procidx, CkNumPes(), sizeof(int), compLoad);
721 
722  double averageLoad = 0.0;
723  for (i=0; i<CkNumPes(); i++) averageLoad += cpuloads[i];
724  averageLoad /= CkNumPes();
725 // iout << "buildSpanningTree1: no intermediate node on " << procidx[0] << " " << procidx[1] << endi;
726 
727 }
double * cpuloads
Definition: NamdCentLB.C:24
static int * procidx
Definition: ProxyMgr.C:695
static double averageLoad
Definition: ProxyMgr.C:696
static int compLoad(const void *a, const void *b)
Definition: ProxyMgr.C:698

Variable Documentation

double averageLoad = 0.0
static

Definition at line 696 of file ProxyMgr.C.

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

double* cpuloads
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
int proxySendSpanning = 0
int proxySpanDim = 4