NAMD
ComputePmeCUDA.h
Go to the documentation of this file.
1 #ifndef COMPUTEPMECUDA_H
2 #define COMPUTEPMECUDA_H
3 
4 #include <vector>
5 #include <list>
6 #include "PmeBase.h"
7 
8 #include "PatchTypes.h" // Results
9 #include "Compute.h"
10 #include "Box.h"
11 #include "OwnerBox.h"
12 #include "ComputePmeCUDAMgr.decl.h"
13 
14 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
15 class HomePatch;
16 
17 class ComputePmeCUDA : public Compute {
18 public:
21  virtual ~ComputePmeCUDA();
22  void initialize();
23  void atomUpdate();
24  int noWork();
25  void doWork();
26  bool storePmeForceMsg(PmeForceMsg *msg);
27 private:
28  struct PatchRecord {
29  PatchRecord() {
30  pmeForceMsg = NULL;
31  patch = NULL;
32  positionBox = NULL;
33  avgPositionBox = NULL;
34  forceBox = NULL;
35  }
36  // Message that contains the pointers to forces
37  PmeForceMsg* pmeForceMsg;
38  // Home pencil
39  int homePencilY;
40  int homePencilZ;
41  int homePencilNode;
42  // Pointer to patch
43  Patch *patch;
44  // Patch ID
45  PatchID patchID;
46  // Boxes
47  Box<Patch,CompAtom> *positionBox;
48  Box<Patch,CompAtom> *avgPositionBox;
49  Box<Patch,Results> *forceBox;
50  };
51 
52  void calcSelfEnergy(int numAtoms, CompAtom *x, bool isFirstStep);
53  void calcSelfEnergyFEP(int numAtoms, CompAtom *atoms, bool isFirstStep);
54  void calcSelfEnergyTI(int numAtoms, CompAtom *atoms, bool isFirstStep);
55  void sendAtoms();
56  void recvForces();
57  void setupActivePencils();
58 
59  CmiNodeLock lock;
60  int patchCounter;
61 
62  std::vector<PatchRecord> patches;
63 
64  SubmitReduction *reduction;
65 #ifdef NODEGROUP_FORCE_REGISTER
66  NodeReduction *nodeReduction;
67 #endif
68 
69  bool sendAtomsDone;
70 
71  PmeGrid pmeGrid;
72 
73  ComputePmeCUDAMgr *mgr;
74 
75  CProxy_ComputePmeCUDAMgr computePmeCUDAMgrProxy;
76 
77  bool atomsChanged;
78 
79  // saved self energies
80  double selfEnergy;
81  double selfEnergyFEP;
82  double selfEnergyTI1;
83  double selfEnergyTI2;
84 };
85 #endif // NAMD_CUDA
86 
87 #endif // COMPUTEPMECUDA_H
int32 ComputeID
Definition: NamdTypes.h:278
ComputePmeCUDA(ComputeID c, PatchIDList &pids)
Definition: Patch.h:35
bool storePmeForceMsg(PmeForceMsg *msg)
virtual ~ComputePmeCUDA()
int32 PatchID
Definition: NamdTypes.h:277