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

WorkDistrib.h

Go to the documentation of this file.
00001 
00007 #ifndef _WORKDISTRIB_H
00008 #define _WORKDISTRIB_H
00009 
00010 #include "charm++.h"
00011 
00012 #include "main.h"
00013 
00014 #include "NamdTypes.h"
00015 #include "BOCgroup.h"
00016 #include "ComputeMap.h"
00017 #include "WorkDistrib.decl.h"
00018 
00019 class Node;
00020 class Compute;
00021 class Molecule;
00022 
00023 // For Compute objects to enqueue themselves when ready to compute
00024 class LocalWorkMsg : public CMessage_LocalWorkMsg
00025 {
00026 public:
00027   Compute *compute;
00028 };
00029 
00030 enum { maxPatchDepends = 126 };
00031 
00032 class MapDistribMsg;
00033 class ComputeMapChangeMsg;
00034 
00035 class WorkDistrib : public BOCclass
00036 {
00037 public:
00038   WorkDistrib();
00039   ~WorkDistrib(void);
00040 
00041   // static void messageMovePatchDone();
00042   // void movePatchDone();
00043 
00044   static void messageEnqueueWork(Compute *);
00045   void enqueueWork(LocalWorkMsg *msg);
00046   void enqueueBonds(LocalWorkMsg *msg);
00047   void enqueueAngles(LocalWorkMsg *msg);
00048   void enqueueDihedrals(LocalWorkMsg *msg);
00049   void enqueueImpropers(LocalWorkMsg *msg);
00050   void enqueueCrossterms(LocalWorkMsg *msg);
00051   void enqueuePme(LocalWorkMsg *msg);
00052   void enqueueSelfA(LocalWorkMsg *msg);
00053   void enqueueSelfB(LocalWorkMsg *msg);
00054   void enqueueWorkA(LocalWorkMsg *msg);
00055   void enqueueWorkB(LocalWorkMsg *msg);
00056   void enqueueWorkC(LocalWorkMsg *msg);
00057 
00058   void mapComputes(void);
00059   void sendMaps(void);
00060   void saveComputeMapChanges(int,CkGroupID);
00061   void recvComputeMapChanges(ComputeMapChangeMsg *);
00062   void doneSaveComputeMap();
00063 
00064   FullAtomList *createAtomLists(void);
00065   void createHomePatches(void);
00066 
00067   int *caclNumAtomsInEachPatch(void);
00068   //create home patches without populating them with atoms' data
00069   //the only data set is the number atoms the patch contains
00070   void preCreateHomePatches(void);
00071   void fillOnePatchAtoms(int patchId, FullAtomList *onePatchAtoms, Vector *velocities);
00072 
00073   void distributeHomePatches(void);
00074   //populate the home patch with actual atom data
00075   void initAndSendHomePatch(void);
00076 
00077   void reinitAtoms(void);
00078   void patchMapInit(void);
00079   void assignNodeToPatch(void);
00080 
00081   void saveMaps(MapDistribMsg *msg);
00082 
00083 private:
00084   void mapComputeNonbonded(void);
00085   void mapComputeHomePatches(ComputeType);
00086   void mapComputeHomeTuples(ComputeType);
00087   void mapComputePatch(ComputeType);
00088   void assignPatchesToLowestLoadNode(void);
00089   void assignPatchesRecursiveBisection(void);
00090   void assignPatchesRoundRobin(void);
00091   void assignPatchesBitReversal(void);
00092   int  assignPatchesTopoGridRecBisection();
00093 
00094   void sortNodesAndAssign(int *assignedNode, int baseNodes = 0);
00095   void velocities_from_PDB(char *filename, 
00096                            Vector *v, int totalAtoms);
00097   void velocities_from_binfile(char *fname, Vector *vels, int n);
00098   void random_velocities(BigReal Temp, Molecule *structure,
00099                          Vector *v, int totalAtoms);
00100   void remove_com_motion(Vector *vel, Molecule *structure, int n);
00101 
00102   bool mapsArrived;
00103   bool awaitingMaps;
00104   CthThread awaitingMapsTh;
00105 
00106   int saveComputeMapReturnEP;
00107   CkGroupID saveComputeMapReturnChareID;
00108   int saveComputeMapCount;
00109 };
00110 
00111 #endif /* WORKDISTRIB_H */
00112 

Generated on Sun Sep 7 04:07:42 2008 for NAMD by  doxygen 1.3.9.1