NAMD
Node.h
Go to the documentation of this file.
1 
7 /*
8  Master BOC. coordinates startup, close down of each PE
9  Also owns pointers to common objects needed by system
10  Many utility static methods are owned by Node.
11 */
12 
13 #ifndef _NODE_H
14 #define _NODE_H
15 
16 #include "charm++.h"
17 
18 #include "main.h"
19 
20 // BEGIN LA
21 class Random;
22 // END LA
23 
24 #ifdef SOLARIS
25 extern "C" int gethostname( char *name, int namelen);
26 #endif
27 
28 class Vector;
29 
30 #include "ProcessorPrivate.h"
31 #include "Node.decl.h"
32 
33 class PatchMap;
34 class AtomMap;
35 class ProxyMgr;
36 class ComputeMap;
37 class PatchMgr;
38 class Molecule;
39 class Parameters;
40 class SimParameters;
41 class ConfigList;
42 class PDB;
43 class WorkDistrib;
44 class PatchMgr;
45 class ComputeMgr;
46 class Communicate;
47 class Namd;
48 class NamdState;
49 class Output;
50 class LdbCoordinator;
51 class ScriptTcl;
52 class IMDOutput;
53 class Vector;
54 class colvarmodule;
55 class CheckpointMsg;
56 class Lattice;
57 class ControllerState;
58 
59 #ifdef MEM_OPT_VERSION
60 class ParallelIOMgr;
61 #endif
62 
63 // Message to send our per processor BOC's list of groupIDs of
64 // all other BOC's
65 class GroupInitMsg : public CMessage_GroupInitMsg
66 {
67 public:
69 };
70 
71 #define MAX_SCRIPT_PARAM_SIZE 128
72 class ScriptParamMsg : public CMessage_ScriptParamMsg {
73 public:
76 };
77 
78 class Node : public CBase_Node
79 {
80 public:
81 
82  Node(GroupInitMsg *msg);
83  ~Node(void);
84 
85  // Singleton Access method
86  inline static Node *Object() {return CkpvAccess(Node_instance);}
87 
88  // Run for the number of steps specified in the sim_parameters
89  static void messageRun();
90  void run();
91 
92  // Change parameters in mid-run
93  void enableScriptBarrier();
94  void scriptBarrier(void);
96 
97  void reloadCharges(const char *filename);
98  void reloadCharges(float charge[], int n);
99 
100  void reloadGridforceGrid(const char *key);
101  void reloadGridforceGrid(int gridnum);
102  void updateGridScale(const char* key, Vector scale);
103  void updateGridScale(int gridnum, float sx, float sy, float sz);
104 
105  void reloadStructure(const char *, const char *);
106  void resendMolecule();
107  void resendMolecule2();
108 
109  void sendCheckpointReq(int remote, const char *key, int task, Lattice &lat, ControllerState &cs);
112 
113  void sendEnableExitScheduler(void);
114  void recvEnableExitScheduler(void);
115  void enableExitScheduler(void);
116  void exitScheduler(void);
117 
118  void sendEnableEarlyExit(void);
119  void recvEnableEarlyExit(void);
120  void enableEarlyExit(void);
121  void earlyExit(void);
122 
123  // Charm Entry point - Read in system data, get all ready to simulate
124  static void messageStartUp();
125  void startup();
126 
127  void mallocTest(int);
128  void mallocTestQd(void);
130 
131 #ifdef MEM_OPT_VERSION
132  ParallelIOMgr *ioMgr;
133 #endif
134 
135  float initVM, initRSS;
136  float measureMemory();
137 
138  // Charm Entry point - synchronize on BOC creation and startup
139  static void messageBOCCheckIn();
140  void BOCCheckIn();
141  void awaitBOCCheckIn();
142 
143  // Utility for storing away simulation data for Node
145 
146  // entry methods for BG/P HPM (performance counters) library
147  void startHPM();
148  void stopHPM();
149 
150  //entry methods for trace barriers
152  void traceBarrier(int turnOnTrace, int step);
153  void resumeAfterTraceBarrier(CkReductionMsg *msg);
154 
155  //entry methods for measuring flops barriers
157  void papiMeasureBarrier(int turnOnMeasure, int step);
158  void resumeAfterPapiMeasureBarrier(CkReductionMsg *msg);
159 
160  void outputPatchComputeMaps(const char *filename, int tag);
161 
162  //to show whether +traceoff is specified
164 
165  // Made public for pmeAid;
167 
168  // Made public in order to access the ComputeGlobal on the node
170 
171  // BEGIN LA
173  // END LA
174 
175  // NAMD 1.X molecule database objects - must be public for now
184  colvarmodule *colvars;
185  Vector *coords; // Only exists during measure from Tcl
186 
187  // Remove these calls?
188  int myid() { return CkMyPe(); }
189  int numNodes() { return CkNumPes(); }
190 
191  void setScript(ScriptTcl *s) { script = s; }
192  ScriptTcl *getScript(void) { return script; }
193 
194 #ifdef OPENATOM_VERSION
195  doneMoaStart();
196 #endif //OPENATOM_VERSION
197 
198  protected:
199  // Map Databases - they have a singleton this access method ::Object()
204 
205 private:
206  void bindBocVars();
207 
208  void namdOneCommInit();
209  void namdOneRecv();
210  void namdOneSend();
211  void threadInit();
212  void buildSequencers();
213 
214  PatchMgr *patchMgr;
215  ProxyMgr *proxyMgr;
216  Namd *namd;
217  ScriptTcl *script;
218 
219  // Startup phase
220  int startupPhase;
221  int localRankOnNode;
222 #ifdef CMK_BALANCED_INJECTION_API
223  int balancedInjectionLevel;
224 #endif
225 
226  int recvCheckpointCReq_index;
227  int recvCheckpointCAck_index;
228 };
229 
230 #endif /* _NODE_H */
231 
static Node * Object()
Definition: Node.h:86
bool specialTracing
Definition: Node.h:163
Definition: PDB.h:35
BOCgroup group
Definition: Node.h:68
int curTimeStep
Definition: Node.h:151
void mallocTest(int)
Definition: Node.C:391
void startHPM()
Definition: Node.C:1383
Definition: Node.h:78
void exitScheduler(void)
Definition: Node.C:1342
IMDOutput * imd
Definition: Node.h:183
void saveMolDataPointers(NamdState *)
Definition: Node.C:1372
ScriptTcl * getScript(void)
Definition: Node.h:192
LdbCoordinator * ldbCoordinator
Definition: Node.h:203
void sendEnableEarlyExit(void)
Definition: Node.C:1347
Definition: Vector.h:64
Output * output
Definition: Node.h:182
SimParameters * simParameters
Definition: Node.h:178
void enableScriptBarrier()
Definition: Node.C:1131
char value[MAX_SCRIPT_PARAM_SIZE]
Definition: Node.h:75
void sendEnableExitScheduler(void)
Definition: Node.C:1323
void recvCheckpointReq(CheckpointMsg *)
Definition: Node.C:1295
static void messageStartUp()
Definition: Node.C:418
void stopHPM()
Definition: Node.C:1389
int curMFlopStep
Definition: Node.h:156
void outputPatchComputeMaps(const char *filename, int tag)
Definition: Node.C:1512
void recvCheckpointAck(CheckpointMsg *)
Definition: Node.C:1317
ComputeMap * computeMap
Definition: Node.h:202
int numNodes()
Definition: Node.h:189
Definition: Output.h:43
void setScript(ScriptTcl *s)
Definition: Node.h:191
void resumeAfterPapiMeasureBarrier(CkReductionMsg *msg)
Definition: Node.C:1469
void scriptParam(ScriptParamMsg *)
Definition: Node.C:1139
Definition: Random.h:37
void run()
Definition: Node.C:1096
void enableExitScheduler(void)
Definition: Node.C:1334
void BOCCheckIn()
NamdState * state
Definition: Node.h:181
void traceBarrier(int turnOnTrace, int step)
Definition: Node.C:1396
static void messageBOCCheckIn()
void updateGridScale(const char *key, Vector scale)
Definition: Node.C:1195
static void messageRun()
Definition: Node.C:1087
void scriptBarrier(void)
Definition: Node.C:1135
void reloadStructure(const char *, const char *)
Definition: Node.C:998
AtomMap * atomMap
Definition: Node.h:200
void recvEnableExitScheduler(void)
Definition: Node.C:1329
PDB * pdb
Definition: Node.h:180
ConfigList * configList
Definition: Node.h:179
Vector * coords
Definition: Node.h:185
float initRSS
Definition: Node.h:135
void recvEnableEarlyExit(void)
Definition: Node.C:1352
Parameters * parameters
Definition: Node.h:177
void resumeAfterTraceBarrier(CkReductionMsg *msg)
Definition: Node.C:1411
int myid()
Definition: Node.h:188
WorkDistrib * workDistrib
Definition: Node.h:166
~Node(void)
Definition: Node.C:355
float initVM
Definition: Node.h:135
Random * rand
Definition: Node.h:172
void mallocTestQd(void)
Definition: Node.C:403
PatchMap * patchMap
Definition: Node.h:201
void papiMeasureBarrier(int turnOnMeasure, int step)
Definition: Node.C:1417
void resendMolecule2()
Definition: Node.C:1045
#define MAX_SCRIPT_PARAM_SIZE
Definition: Node.h:71
void resendMolecule()
Definition: Node.C:1011
colvarmodule * colvars
Definition: Node.h:184
void awaitBOCCheckIn()
void startup()
Definition: Node.C:428
k< npairi;++k){TABENERGY(const int numtypes=simParams->tableNumTypes;const float table_spacing=simParams->tableSpacing;const int npertype=(int)(namdnearbyint(simParams->tableMaxDist/simParams->tableSpacing)+1);) int table_i=(r2iilist[2 *k] >> 14)+r2_delta_expc;const int j=pairlisti[k];#define p_j BigReal diffa=r2list[k]-r2_table[table_i];#define table_four_i TABENERGY(register const int tabtype=-1-(lj_pars->A< 0?lj_pars->A:0);) BigReal kqq=kq_i *p_j-> charge
Node(GroupInitMsg *msg)
Definition: Node.C:290
float measureMemory()
void sendCheckpointReq(int remote, const char *key, int task, Lattice &lat, ControllerState &cs)
Definition: Node.C:1271
ComputeMgr * computeMgr
Definition: Node.h:169
int mallocTest_size
Definition: Node.h:129
void enableEarlyExit(void)
Definition: Node.C:1356
void earlyExit(void)
Definition: Node.C:1364
Molecule * molecule
Definition: Node.h:176
char param[MAX_SCRIPT_PARAM_SIZE]
Definition: Node.h:74
void reloadCharges(const char *filename)
Definition: Node.C:1144
void reloadGridforceGrid(const char *key)
Definition: Node.C:1167