NamdHybridLB.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * $Source: /home/cvs/namd/cvsroot/namd2/src/NamdHybridLB.h,v $
00003  * $Author: jim $
00004  * $Date: 2013/08/29 02:20:58 $
00005  * $Revision: 1.15 $
00006  *****************************************************************************/
00007 
00008 #ifndef _NAMDHYBRIDLB_H_
00009 #define _NAMDHYBRIDLB_H_
00010 
00011 #include <HybridBaseLB.h>
00012 #include "NamdHybridLB.decl.h"
00013 
00014 #include "Node.h"
00015 #include "PatchMap.h"
00016 #include "SimParameters.h"
00017 #include "RefineOnly.h"
00018 #include "Alg7.h"
00019 #include "AlgRecBisection.h"
00020 #include "InfoStream.h"
00021 #include "NamdCentLB.h"
00022 #include "NamdDummyLB.h"
00023 #include "TorusLB.h"
00024 #include "RefineTorusLB.h"
00025 
00026 void CreateNamdHybridLB();
00027 
00031 class LocalLBInfoMsg: public CMessage_LocalLBInfoMsg{
00032 public:
00033         int n_moves;
00034         int startPE;
00035         int endPE;
00036         MigrateInfo *moves;
00037         double *cpuloads;
00038 
00039         // Constructor
00040         LocalLBInfoMsg(): n_moves(0), startPE(0), endPE(0){}
00041 
00042         // Pup method
00043         void pup(PUP::er &p) {
00044                 int i;
00045                 p | n_moves;
00046                 p | startPE;
00047                 p | endPE;
00048                 for (i=0; i<n_moves; ++i) p | moves[i];
00049                 for (i=0; i<endPE-startPE+1; ++i) p | cpuloads[i];
00050         }
00051 
00052 };
00053 
00054 class SplitComputesMsg;
00055 
00056 class NamdHybridLB : public HybridBaseLB {
00057 
00058 public:
00059   NamdHybridLB();
00060   NamdHybridLB(CkMigrateMessage *m):HybridBaseLB(m) {}
00061   void UpdateLocalLBInfo(LocalLBInfoMsg *msg);
00062   //void CollectInfo(Location *loc, int n, int fromlevel);
00063   void splitComputes(SplitComputesMsg*);
00064 
00065 private:
00066   CProxy_NamdHybridLB thisProxy;
00067   int updateCount;
00068   int splitCount;
00069   SplitComputesMsg **splitComputesMsgs;
00070   bool collectFlag;
00071   bool updateFlag;
00072   int parent_backup;
00073   Location *loc_backup;
00074   int n_backup;
00075   int fromlevel_backup;
00076 
00077   int *from_procs;
00078   computeInfo *computeArray;
00079   patchInfo *patchArray;
00080   processorInfo *processorArray;
00081 
00082         double *peLoads;
00083         int startPE;
00084         int endPE;
00085 
00086   bool QueryBalanceNow(int step);
00087   bool QueryDumpData();
00088   // LBVectorMigrateMsg* VectorStrategy(LDStats* stats);
00089 
00090   CLBMigrateMsg* Strategy(LDStats* stats);
00091   LBMigrateMsg* GrpLevelStrategy(LDStats* stats);
00092   
00093   int buildData(LDStats* stats);
00094   int requiredProxies(PatchID id, int neighborNodes[]);
00095   void dumpDataASCII(char *file, int numProcessors, int numPatches,
00096                 int numComputes);
00097 
00098   // centralized load balancer for load balancing all the children processors
00099   NamdCentLB *centralLB;
00100   NamdDummyLB *dummyLB;
00101 };
00102 
00103 #endif /* _NAMDHYBRIDLB_H_ */

Generated on Mon Nov 20 01:17:13 2017 for NAMD by  doxygen 1.4.7