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 enqueueExcls(LocalWorkMsg *msg);
00047   void enqueueBonds(LocalWorkMsg *msg);
00048   void enqueueAngles(LocalWorkMsg *msg);
00049   void enqueueDihedrals(LocalWorkMsg *msg);
00050   void enqueueImpropers(LocalWorkMsg *msg);
00051   void enqueueCrossterms(LocalWorkMsg *msg);
00052   void enqueuePme(LocalWorkMsg *msg);
00053   void enqueueSelfA(LocalWorkMsg *msg);
00054   void enqueueSelfB(LocalWorkMsg *msg);
00055   void enqueueWorkA(LocalWorkMsg *msg);
00056   void enqueueWorkB(LocalWorkMsg *msg);
00057   void enqueueWorkC(LocalWorkMsg *msg);
00058   void enqueueCUDA(LocalWorkMsg *msg);
00059 
00060   void mapComputes(void);
00061   void sendMaps(void);
00062   void saveComputeMapChanges(int,CkGroupID);
00063   void recvComputeMapChanges(ComputeMapChangeMsg *);
00064   void doneSaveComputeMap();
00065 
00066   FullAtomList *createAtomLists(void);
00067   void createHomePatches(void);
00068 
00069   int *caclNumAtomsInEachPatch(void);
00070   //create home patches without populating them with atoms' data
00071   //the only data set is the number atoms the patch contains
00072   void preCreateHomePatches(void);
00073   void fillOnePatchAtoms(int patchId, FullAtomList *onePatchAtoms, Vector *velocities);
00074 
00075   void distributeHomePatches(void);
00076   //populate the home patch with actual atom data
00077   void initAndSendHomePatch(void);
00078 
00079   void reinitAtoms(void);
00080   void patchMapInit(void);
00081   void assignNodeToPatch(void);
00082 
00083   void saveMaps(MapDistribMsg *msg);
00084 
00085 private:
00086   void mapComputeNonbonded(void);
00087   void mapComputeNode(ComputeType);
00088   void mapComputeHomePatches(ComputeType);
00089   void mapComputeHomeTuples(ComputeType);
00090   void mapComputePatch(ComputeType);
00091   void assignPatchesToLowestLoadNode(void);
00092   void assignPatchesRecursiveBisection(void);
00093   void assignPatchesRoundRobin(void);
00094   void assignPatchesSpaceFillingCurve(void);
00095   void assignPatchesBitReversal(void);
00096   int  assignPatchesTopoGridRecBisection();
00097 
00098   void sortNodesAndAssign(int *assignedNode, int baseNodes = 0);
00099   void velocities_from_PDB(char *filename, 
00100                            Vector *v, int totalAtoms);
00101   void velocities_from_binfile(char *fname, Vector *vels, int n);
00102   void random_velocities(BigReal Temp, Molecule *structure,
00103                          Vector *v, int totalAtoms);
00104   void remove_com_motion(Vector *vel, Molecule *structure, int n);
00105 
00106   bool mapsArrived;
00107   bool awaitingMaps;
00108   CthThread awaitingMapsTh;
00109 
00110   int saveComputeMapReturnEP;
00111   CkGroupID saveComputeMapReturnChareID;
00112   int saveComputeMapCount;
00113 };
00114 
00115 #endif /* WORKDISTRIB_H */
00116 

Generated on Tue Nov 24 04:07:46 2009 for NAMD by  doxygen 1.3.9.1