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  inline static Node *ObjectOnPe(int pe) {return CkpvAccessOther(Node_instance, CmiRankOf(pe));}
88 
89  // Run for the number of steps specified in the sim_parameters
90  static void messageRun();
91  void run();
92 
93  // Change parameters in mid-run
94  void enableScriptBarrier();
95  void scriptBarrier(void);
97 
98  void reloadCharges(const char *filename);
99  void reloadCharges(float charge[], int n);
100 
101  void reloadGridforceGrid(const char *key);
102  void reloadGridforceGrid(int gridnum);
103  void updateGridScale(const char* key, Vector scale);
104  void updateGridScale(int gridnum, float sx, float sy, float sz);
105 
106  void reloadStructure(const char *, const char *);
107  void resendMolecule();
108  void resendMolecule2();
109 
110  void sendCheckpointReq(int remote, const char *key, int task, Lattice &lat, ControllerState &cs);
113 
114  void sendEnableExitScheduler(void);
115  void recvEnableExitScheduler(void);
116  void enableExitScheduler(void);
117  void exitScheduler(void);
118 
119  void sendEnableEarlyExit(void);
120  void recvEnableEarlyExit(void);
121  void enableEarlyExit(void);
122  void earlyExit(void);
123 
124  // Charm Entry point - Read in system data, get all ready to simulate
125  static void messageStartUp();
126  void startup();
127 
128  void mallocTest(int);
129  void mallocTestQd(void);
131 
132 #ifdef MEM_OPT_VERSION
133  ParallelIOMgr *ioMgr;
134 #endif
135 
136  float initVM, initRSS;
137  float measureMemory();
138 
139  // Charm Entry point - synchronize on BOC creation and startup
140  static void messageBOCCheckIn();
141  void BOCCheckIn();
142  void awaitBOCCheckIn();
143 
144  // Utility for storing away simulation data for Node
146 
147  // entry methods for BG/P HPM (performance counters) library
148  void startHPM();
149  void stopHPM();
150 
151  //entry methods for trace barriers
153  void traceBarrier(int turnOnTrace, int step);
154  void resumeAfterTraceBarrier(CkReductionMsg *msg);
155 
156  //entry methods for measuring flops barriers
158  void papiMeasureBarrier(int turnOnMeasure, int step);
159  void resumeAfterPapiMeasureBarrier(CkReductionMsg *msg);
160 
161  void outputPatchComputeMaps(const char *filename, int tag);
162 
163  ScriptTcl* getScript();
164 
165  //to show whether +traceoff is specified
167 
168  // Made public for pmeAid;
170 
171  // Made public in order to access the ComputeGlobal on the node
173 
174  // BEGIN LA
176  // END LA
177 
178  // NAMD 1.X molecule database objects - must be public for now
187  colvarmodule *colvars;
188  Vector *coords; // Only exists during measure from Tcl
189 
190  // Remove these calls?
191  int myid() { return CkMyPe(); }
192  int numNodes() { return CkNumPes(); }
193 
194  void setScript(ScriptTcl *s) { script = s; }
195 
196 #ifdef OPENATOM_VERSION
197  doneMoaStart();
198 #endif //OPENATOM_VERSION
199 
200  protected:
201  // Map Databases - they have a singleton this access method ::Object()
206 
207 private:
208  void bindBocVars();
209 
210  void namdOneCommInit();
211  void namdOneRecv();
212  void namdOneSend();
213  void threadInit();
214  void buildSequencers();
215 
216  PatchMgr *patchMgr;
217  ProxyMgr *proxyMgr;
218  Namd *namd;
219  ScriptTcl *script = NULL;
220 
221  // Startup phase
222  int startupPhase;
223  int localRankOnNode;
224 #if defined(CMK_BALANCED_INJECTION_API) && CMK_BALANCED_INJECTION_API != 0
225  int balancedInjectionLevel;
226 #endif
227 
228  int recvCheckpointCReq_index;
229  int recvCheckpointCAck_index;
230 };
231 
232 #endif /* _NODE_H */
233 
static Node * Object()
Definition: Node.h:86
bool specialTracing
Definition: Node.h:166
static Node * ObjectOnPe(int pe)
Definition: Node.h:87
Definition: PDB.h:36
BOCgroup group
Definition: Node.h:68
int curTimeStep
Definition: Node.h:152
void mallocTest(int)
Definition: Node.C:400
void startHPM()
Definition: Node.C:1431
Definition: Node.h:78
void exitScheduler(void)
Definition: Node.C:1390
IMDOutput * imd
Definition: Node.h:186
void saveMolDataPointers(NamdState *)
Definition: Node.C:1420
LdbCoordinator * ldbCoordinator
Definition: Node.h:205
void sendEnableEarlyExit(void)
Definition: Node.C:1395
Definition: Vector.h:72
Output * output
Definition: Node.h:185
SimParameters * simParameters
Definition: Node.h:181
void enableScriptBarrier()
Definition: Node.C:1154
char value[MAX_SCRIPT_PARAM_SIZE]
Definition: Node.h:75
void sendEnableExitScheduler(void)
Definition: Node.C:1371
void recvCheckpointReq(CheckpointMsg *)
Definition: Node.C:1343
static void messageStartUp()
Definition: Node.C:427
void stopHPM()
Definition: Node.C:1437
int curMFlopStep
Definition: Node.h:157
void outputPatchComputeMaps(const char *filename, int tag)
Definition: Node.C:1560
Molecule stores the structural information for the system.
Definition: Molecule.h:175
void recvCheckpointAck(CheckpointMsg *)
Definition: Node.C:1365
ComputeMap * computeMap
Definition: Node.h:204
int numNodes()
Definition: Node.h:192
Definition: Output.h:35
void setScript(ScriptTcl *s)
Definition: Node.h:194
void resumeAfterPapiMeasureBarrier(CkReductionMsg *msg)
Definition: Node.C:1517
void scriptParam(ScriptParamMsg *)
Definition: Node.C:1162
Definition: Random.h:37
void run()
Definition: Node.C:1116
void enableExitScheduler(void)
Definition: Node.C:1382
void BOCCheckIn()
NamdState * state
Definition: Node.h:184
void traceBarrier(int turnOnTrace, int step)
Definition: Node.C:1444
static void messageBOCCheckIn()
void updateGridScale(const char *key, Vector scale)
Definition: Node.C:1231
static void messageRun()
Definition: Node.C:1107
void scriptBarrier(void)
Definition: Node.C:1158
void reloadStructure(const char *, const char *)
Definition: Node.C:1011
AtomMap * atomMap
Definition: Node.h:202
void recvEnableExitScheduler(void)
Definition: Node.C:1377
PDB * pdb
Definition: Node.h:183
ConfigList * configList
Definition: Node.h:182
Vector * coords
Definition: Node.h:188
float initRSS
Definition: Node.h:136
void recvEnableEarlyExit(void)
Definition: Node.C:1400
Parameters * parameters
Definition: Node.h:180
void resumeAfterTraceBarrier(CkReductionMsg *msg)
Definition: Node.C:1459
int myid()
Definition: Node.h:191
WorkDistrib * workDistrib
Definition: Node.h:169
~Node(void)
Definition: Node.C:363
float initVM
Definition: Node.h:136
Random * rand
Definition: Node.h:175
void mallocTestQd(void)
Definition: Node.C:412
PatchMap * patchMap
Definition: Node.h:203
void papiMeasureBarrier(int turnOnMeasure, int step)
Definition: Node.C:1465
void resendMolecule2()
Definition: Node.C:1057
#define MAX_SCRIPT_PARAM_SIZE
Definition: Node.h:71
ScriptTcl * getScript()
Definition: Node.C:1599
void resendMolecule()
Definition: Node.C:1024
colvarmodule * colvars
Definition: Node.h:187
void awaitBOCCheckIn()
void startup()
Definition: Node.C:437
Node(GroupInitMsg *msg)
Definition: Node.C:298
float measureMemory()
void sendCheckpointReq(int remote, const char *key, int task, Lattice &lat, ControllerState &cs)
Definition: Node.C:1319
ComputeMgr * computeMgr
Definition: Node.h:172
int mallocTest_size
Definition: Node.h:130
void enableEarlyExit(void)
Definition: Node.C:1404
void earlyExit(void)
Definition: Node.C:1412
Molecule * molecule
Definition: Node.h:179
char param[MAX_SCRIPT_PARAM_SIZE]
Definition: Node.h:74
void reloadCharges(const char *filename)
Definition: Node.C:1167
void reloadGridforceGrid(const char *key)
Definition: Node.C:1197