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

LdbCoordinator.h

Go to the documentation of this file.
00001 
00007 /*****************************************************************************
00008  * $Source: /home/cvs/namd/cvsroot/namd2/src/LdbCoordinator.h,v $
00009  * $Author: gzheng $
00010  * $Date: 2008/07/14 19:38:02 $
00011  * $Revision: 1.40 $
00012  *****************************************************************************/
00013 
00014 #ifndef LDBCOORDINATOR_H
00015 #define LDBCOORDINATOR_H
00016 
00017 #include <stdio.h>
00018 
00019 #include <charm++.h>
00020 #include <LBDatabase.h>
00021 
00022 #include "NamdTypes.h"
00023 #include "BOCgroup.h"
00024 #include "LdbCoordinator.decl.h"
00025 
00026 class PatchMap;
00027 class ComputeMap;
00028 class Controller;
00029 class Sequencer;
00030 class computeInfo;
00031 class patchInfo;
00032 class processorInfo;
00033 
00034 enum {LDB_PATCHES = 4096};
00035 enum {LDB_COMPUTES = 16384};
00036 enum {COMPUTEMAX = 16384};
00037 enum {PATCHMAX = 4096};
00038 enum {PROCESSORMAX = 512};
00039 
00040 void LdbCoordinator_initproc();
00041 
00042 class LdbCoordinator : public BOCclass
00043 {
00044 public:
00045   LdbCoordinator();
00046   ~LdbCoordinator(void);
00047   static LdbCoordinator *Object()  { 
00048     return CkpvAccess(LdbCoordinator_instance); 
00049   }
00050 
00051   void initialize(PatchMap *pmap, ComputeMap *cmap, int reinit=0);
00052   void createLoadBalancer();
00053   void patchLoad(PatchID id, int nAtoms, int timestep);
00054   void startWork(ComputeID id, int timestep);
00055   void endWork(ComputeID id, int timestep);
00056   void rebalance(Sequencer *seq, PatchID id);
00057   void rebalance(Controller *seq);
00058   void nodeDone(void);
00059   void updateComputesReady();
00060   void barrier(void);
00061   void resume(void);
00062   void resumeReady(CkQdMsg *msg);
00063   void resume2(void);
00064   int getNumStepsToRun(void) { return numStepsToRun; }
00065   static void staticMigrateFn(LDObjHandle handle, int dest);
00066   static void staticStatsFn(LDOMHandle h, int state);
00067   static void staticQueryEstLoadFn(LDOMHandle h);
00068   static void staticReceiveAtSync(void* data);
00069   static void staticResumeFromSync(void* data);
00070   void ReceiveAtSync(void);
00071   void Migrate(LDObjHandle handle, int dest);
00072   void RecvMigrate(LdbMigrateMsg*);
00073   void ProcessMigrate(LdbMigrateMsg*);
00074   void ExpectMigrate(LdbMigrateMsg*);
00075   void ResumeFromSync(void);
00076 
00077 public:
00078   void ExecuteMigrations(void);
00079   void awakenSequencers(void);
00080   int requiredProxies(PatchID id, int []);
00081   void printRequiredProxies(PatchID id, FILE *fp);
00082   void printLocalLdbReport(void);
00083 
00084   int stepsPerLdbCycle;
00085   int nLocalComputes;
00086   int nLocalPatches;
00087   int nPatchesReported;
00088   int nPatchesExpected;
00089   int nComputesReported;
00090   int nComputesExpected;
00091   int controllerReported;
00092   int controllerExpected;
00093   int nStatsMessagesReceived;
00094   int nStatsMessagesExpected;
00095   ComputeMap *computeMap;
00096   PatchMap *patchMap;
00097   int *patchNAtoms;
00098   int  nPatches;
00099   Controller *controllerThread;
00100   Sequencer **sequencerThreads;
00101 
00102   int ldbCycleNum;
00103   int numStepsToRun;    // tells Controller how many time steps to run 
00104                         // before another load balancing
00105   int firstLdbStep;
00106   int totalStepsDone;   // keeps a count of the total number of
00107                         // time steps to stop load balancing
00108   int takingLdbData;
00109   int nodesDone;
00110 
00111   FILE *ldbStatsFP;
00112   computeInfo *computeArray;
00113   patchInfo *patchArray;
00114   processorInfo *processorArray;
00115   LBDatabase *theLbdb;
00116   LDOMid myOMid;
00117   LDOMHandle myHandle;
00118   LDObjHandle* objHandles;
00119   int numComputes;
00120   int nRegisteredObjs;
00121   LDBarrierClient ldBarrierHandle;
00122   int reg_all_objs;
00123   LDObjHandle* patchHandles;
00124 };
00125 
00126 class LdbMigrateMsg : public CMessage_LdbMigrateMsg
00127 {
00128 public:
00129   LDObjHandle handle;
00130   int from;
00131   int to;
00132 };
00133 
00134 
00135 #endif // LDBCOORDINATOR_H
00136 

Generated on Sat Oct 11 04:07:42 2008 for NAMD by  doxygen 1.3.9.1