NAMD
ComputeNonbondedMIC.h
Go to the documentation of this file.
1 #include "ComputeNonbondedUtil.h"
2 #include "ComputeHomeTuples.h"
4 #include <set>
5 
6 class ComputeMgr;
7 
8 class ComputeNonbondedMICKernel;
9 
10 // WORKAROUND-HIP: vector types are "using", not struct, and cannot be forward-declared
11 #ifdef NAMD_HIP
12 #include <hip/hip_vector_types.h>
13 #else
14 class float4;
15 class double4;
16 #endif
17 
18 int mic_device_pe();
19 
20 bool mic_device_shared_with_pe(int pe);
21 
23  public:
24 
25  struct compute_record {
29  int isSelf;
30  int part;
31  int numParts;
32  };
33 
34  struct patch_record {
37  int numAtoms;
39  int refCount;
40  int isLocal;
41  int hostPe;
43  Patch *p;
46  Box<Patch,Real> *intRadBox; //5 GBIS Boxes
54  Force *f;
55  Real *intRad; //5 GBIS arrays
60 
62  };
63 
64 
66  ComputeNonbondedMIC *m = 0, int idx = -1);
68 
69  void atomUpdate();
70  void doWork();
71  int noWork();
72  void skip();
73 
74  void recvYieldDevice(int pe);
76 
80  int step;
81  int finishWork(); // returns true when finished, false to continue
82 
83  static void bind_lj_table(int deviceNum);
84  static void bind_force_table(int deviceNum);
85  static void bind_constants(int deviceNum);
86  static void bind_exclusions(int deviceNum);
87 
88  void build_exclusions();
89 
90  void requirePatch(int pid);
91  void assignPatches();
92  void registerPatches();
98 
103 
108 
109  double4 *forces;
110  double4 *slow_forces;
113 
117 
118  ComputeNonbondedMICKernel *kernel;
119 
121  int masterPe;
124  int *slavePes;
126 
129 
134  float plcutoff2;
135 
136  #if MIC_SUBMIT_ATOMS_ON_ARRIVAL != 0
137  int micDevice;
138  int2 *exclusionsByAtom_ptr;
139  std::set<void*> *atomSubmitSignals;
140  virtual void patchReady(PatchID patchID, int doneMigration, int seq);
141  #endif
142 
143  // DMK - NOTE : Moved some variables from global scope in ComputeNonbondedMIC to here
144  // DMK - NOTE : For the following members, non-MIC builds will not have the types defined, but
145  // this class should also go unused. So leave these members out of non-MIC builds. May
146  // need to move them back to "__thread" variables or find a cleaner solution.
147  #if defined(NAMD_MIC)
149  ResizeArray<force_list> force_lists;
150  atom * atoms;
151  atom_param * atom_params;
152  #endif
153 
155 
156  // DMK - DEBUG
157  int timestep;
158 };
159 
160 
static void bind_force_table(int deviceNum)
ResizeArray< compute_record > computeRecords
ResizeArray< int > localActivePatches
void recvYieldDevice(int pe)
Box< Patch, CompAtom > * positionBox
int ComputeID
Definition: NamdTypes.h:183
ComputeNonbondedMIC ** slaves
void requirePatch(int pid)
Definition: Vector.h:64
static __thread atom * atoms
static void bind_lj_table(int deviceNum)
float Real
Definition: common.h:109
LocalWorkMsg * localWorkMsg2
Definition: Patch.h:35
static __thread patch_pair * patch_pairs
bool mic_device_shared_with_pe(int pe)
ResizeArray< int > activePatches
ComputeNonbondedMIC(ComputeID c, ComputeMgr *mgr, ComputeNonbondedMIC *m=0, int idx=-1)
static void bind_exclusions(int deviceNum)
static void bind_constants(int deviceNum)
ResizeArray< compute_record > remoteComputeRecords
int PatchID
Definition: NamdTypes.h:182
SubmitReduction * reduction
ComputeNonbondedMICKernel * kernel
ResizeArray< int > remoteHostedPatches
ResizeArray< int > hostedPatches
ResizeArray< compute_record > localComputeRecords
ComputeNonbondedMIC * master
static __thread atom_param * atom_params
ResizeArray< patch_record > patchRecords
virtual void patchReady(PatchID, int doneMigration, int seq)
Definition: Compute.C:63
ResizeArray< int > remoteActivePatches
int mic_device_pe()
ResizeArray< int > localHostedPatches
float GBReal
Definition: ComputeGBIS.inl:17