Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

Node.h

Go to the documentation of this file.
00001 
00007 /*
00008    Master BOC.  coordinates startup, close down of each PE
00009    Also owns pointers to common objects needed by system                
00010    Many utility static methods are owned by Node.
00011 */
00012 
00013 #ifndef _NODE_H
00014 #define _NODE_H
00015 
00016 #include "charm++.h"
00017 
00018 #include "main.h"
00019 
00020 // BEGIN LA
00021 class Random;
00022 // END LA
00023 
00024 #ifdef SOLARIS
00025 extern "C" int gethostname( char *name, int namelen);
00026 #endif
00027 
00028 #include "ProcessorPrivate.h"
00029 #include "Node.decl.h"
00030 
00031 class PatchMap;
00032 class AtomMap;
00033 class ProxyMgr;
00034 class ComputeMap;
00035 class PatchMgr;
00036 class Molecule;
00037 class Parameters;
00038 class SimParameters;
00039 class ConfigList;
00040 class PDB;
00041 class WorkDistrib;
00042 class PatchMgr;
00043 class ComputeMgr;
00044 class Communicate;
00045 class Namd;
00046 class NamdState;
00047 class Output;
00048 class LdbCoordinator;
00049 class ScriptTcl;
00050 class IMDOutput;
00051 class Vector;
00052 class colvarmodule;
00053 
00054 #ifdef MEM_OPT_VERSION
00055 class ParallelIOMgr;
00056 #endif
00057 
00058 // Message to send our per processor BOC's list of groupIDs of
00059 // all other BOC's
00060 class GroupInitMsg : public CMessage_GroupInitMsg
00061 {
00062 public:
00063   BOCgroup group;
00064 };
00065 
00066 #define MAX_SCRIPT_PARAM_SIZE 128
00067 class ScriptParamMsg : public CMessage_ScriptParamMsg {
00068 public:
00069   char param[MAX_SCRIPT_PARAM_SIZE];
00070   char value[MAX_SCRIPT_PARAM_SIZE];
00071 };
00072 
00073 class Node : public BOCclass
00074 {
00075 public:
00076 
00077   Node(GroupInitMsg *msg);
00078   ~Node(void);
00079 
00080   // Singleton Access method
00081   inline static Node *Object() {return CkpvAccess(Node_instance);}
00082 
00083   // Run for the number of steps specified in the sim_parameters
00084   static void messageRun();
00085   void run();                  
00086 
00087   // Change parameters in mid-run
00088   void enableScriptBarrier();  
00089   void scriptBarrier(CkQdMsg *);  
00090   void scriptParam(ScriptParamMsg *);
00091 
00092   void reloadCharges(const char *filename);
00093   void reloadCharges(float charge[], int n);
00094 
00095   void reloadGridforceGrid(const char *key);
00096   void reloadGridforceGrid(int gridnum);
00097   
00098   void sendEnableExitScheduler(void);
00099   void recvEnableExitScheduler(CkQdMsg *);
00100   void enableExitScheduler(void);
00101   void exitScheduler(CkQdMsg *);
00102 
00103   void sendEnableEarlyExit(void);
00104   void recvEnableEarlyExit(CkQdMsg *);
00105   void enableEarlyExit(void);
00106   void earlyExit(CkQdMsg *);
00107 
00108   // Charm Entry point - Read in system data, get all ready to simulate
00109   static void messageStartUp();
00110   void startup();  
00111   void startUp(CkQdMsg *);
00112 
00113   void mallocTest(int);
00114   void mallocTestQd(CkQdMsg *);
00115   int mallocTest_size;
00116   
00117 #ifdef MEM_OPT_VERSION
00118   ParallelIOMgr *ioMgr;
00119 #endif
00120 
00121   float initVM, initRSS;
00122   float measureMemory();
00123 
00124   // Charm Entry point - synchronize on BOC creation and startup
00125   static void messageBOCCheckIn();
00126   void BOCCheckIn();
00127   void awaitBOCCheckIn();
00128 
00129   // Utility for storing away simulation data for Node
00130   void saveMolDataPointers(NamdState *);
00131 
00132   // entry methods for BG/P HPM (performance counters) library
00133   void startHPM();
00134   void stopHPM();
00135   
00136   //entry methods for trace barriers
00137   int curTimeStep;
00138   void traceBarrier(int turnOnTrace, int step);
00139   void resumeAfterTraceBarrier(CkReductionMsg *msg);
00140 
00141   //entry methods for measuring flops barriers
00142   int curMFlopStep;
00143   void papiMeasureBarrier(int turnOnMeasure, int step);
00144   void resumeAfterPapiMeasureBarrier(CkReductionMsg *msg);
00145   
00146   void outputPatchComputeMaps(const char *filename, int tag);
00147 
00148   //to show whether +traceoff is specified
00149   bool specialTracing;
00150   
00151   // Made public for pmeAid;
00152   WorkDistrib *workDistrib;
00153 
00154   // Made public in order to access the ComputeGlobal on the node
00155   ComputeMgr *computeMgr;
00156   
00157   // BEGIN LA
00158   Random *rand;
00159   // END LA
00160   
00161   // NAMD 1.X molecule database objects - must be public for now
00162   Molecule *molecule;
00163   Parameters *parameters;
00164   SimParameters *simParameters;
00165   ConfigList *configList;
00166   PDB *pdb;
00167   NamdState *state;
00168   Output *output;
00169   IMDOutput *imd;
00170   colvarmodule *colvars;
00171   Vector *coords;  // Only exists during measure from Tcl
00172 
00173   // Remove these calls?
00174   int myid() { return CkMyPe(); }
00175   int numNodes() { return CkNumPes(); }
00176 
00177   void setScript(ScriptTcl *s) { script = s; }
00178   ScriptTcl *getScript(void) { return script; } 
00179 
00180 #ifdef OPENATOM_VERSION
00181   doneMoaStart();
00182 #endif //OPENATOM_VERSION
00183 
00184   protected:
00185   // Map Databases - they have a singleton this access method ::Object()
00186   AtomMap    *atomMap;
00187   PatchMap   *patchMap;
00188   ComputeMap *computeMap;
00189   LdbCoordinator *ldbCoordinator;
00190 
00191 private:  
00192   void bindBocVars();
00193 
00194   void namdOneCommInit();
00195   void namdOneRecv();
00196   void namdOneSend();
00197   void threadInit();
00198   void buildSequencers();
00199 
00200   PatchMgr *patchMgr;
00201   ProxyMgr *proxyMgr;
00202   Namd *namd;
00203   ScriptTcl *script;
00204 
00205   // Startup phase
00206   int startupPhase;
00207   int localRankOnNode;
00208 #ifdef CMK_BALANCED_INJECTION_API
00209   int balancedInjectionLevel;
00210 #endif
00211 };
00212 
00213 #endif /* _NODE_H */
00214 

Generated on Sat May 25 04:07:18 2013 for NAMD by  doxygen 1.3.9.1