ComputeNonbondedMIC.h

Go to the documentation of this file.
00001 #include "ComputeNonbondedUtil.h"
00002 #include "ComputeHomeTuples.h"
00003 #include "ComputeNonbondedMICKernel.h"
00004 #include <set>
00005 
00006 class ComputeMgr;
00007 
00008 class ComputeNonbondedMICKernel;
00009 
00010 class float4;
00011 class double4;
00012 
00013 int mic_device_pe();
00014 
00015 bool mic_device_shared_with_pe(int pe);
00016 
00017 class ComputeNonbondedMIC : public Compute, private ComputeNonbondedUtil {
00018   public:
00019 
00020   struct compute_record {
00021     ComputeID c;
00022     PatchID pid[2];
00023     Vector offset;
00024     int isSelf;
00025     int part;
00026     int numParts;
00027   };
00028 
00029   struct patch_record {
00030     int localIndex;
00031     int localStart;
00032     int numAtoms;
00033     int numFreeAtoms;
00034     int refCount;
00035     int isLocal;
00036     int hostPe;
00037     PatchID patchID;
00038     Patch *p;
00039     Box<Patch,CompAtom> *positionBox;
00040     Box<Patch,Results> *forceBox;
00041     Box<Patch,Real>   *intRadBox; //5 GBIS Boxes
00042     Box<Patch,GBReal> *psiSumBox;
00043     Box<Patch,Real>   *bornRadBox;
00044     Box<Patch,GBReal> *dEdaSumBox;
00045     Box<Patch,Real>   *dHdrPrefixBox;
00046     CompAtom *x;
00047     CompAtomExt *xExt;
00048     Results *r;
00049     Force *f;
00050     Real   *intRad; //5 GBIS arrays
00051     GBReal *psiSum;
00052     Real   *bornRad;
00053     GBReal *dEdaSum;
00054     Real   *dHdrPrefix;
00055 
00056     patch_record() { refCount = 0; }
00057   };
00058 
00059 
00060     ComputeNonbondedMIC(ComputeID c, ComputeMgr *mgr,
00061                 ComputeNonbondedMIC *m = 0, int idx = -1);
00062     ~ComputeNonbondedMIC();
00063 
00064     void atomUpdate();
00065     void doWork();
00066     int noWork();
00067     void skip();
00068 
00069     void recvYieldDevice(int pe);
00070     LocalWorkMsg *localWorkMsg2;
00071 
00072     int workStarted;
00073     Lattice lattice;
00074     int doSlow, doEnergy;
00075     int step;
00076     int finishWork();  // returns true when finished, false to continue
00077 
00078     static void bind_lj_table(int deviceNum);
00079     static void bind_force_table(int deviceNum);
00080     static void bind_constants(int deviceNum);
00081     static void bind_exclusions(int deviceNum);
00082 
00083     void build_exclusions();
00084 
00085     void requirePatch(int pid);
00086     void assignPatches();
00087     void registerPatches();
00088     ResizeArray<int> activePatches, localActivePatches, remoteActivePatches;
00089     ResizeArray<int> hostedPatches, localHostedPatches, remoteHostedPatches;
00090     ResizeArray<patch_record> patchRecords;
00091     ResizeArray<compute_record> computeRecords;
00092     ResizeArray<compute_record> localComputeRecords, remoteComputeRecords;
00093 
00094     int num_atom_records;
00095     int num_local_atom_records;
00096     int num_remote_atom_records;
00097     int num_force_records;
00098 
00099     int num_local_compute_records;
00100     int num_remote_compute_records;
00101     int num_local_patch_records;
00102     int num_remote_patch_records;
00103 
00104     double4 *forces;
00105     double4 *slow_forces;
00106     GBReal *psiSumH;
00107     GBReal *dEdaSumH;
00108 
00109     PatchMap *patchMap;
00110     AtomMap *atomMap;
00111     SubmitReduction *reduction;
00112 
00113     ComputeNonbondedMICKernel *kernel;
00114 
00115     ComputeNonbondedMIC *master;
00116     int masterPe;
00117     int slaveIndex;
00118     ComputeNonbondedMIC **slaves;
00119     int *slavePes;
00120     int numSlaves;
00121 
00122     int atomsChanged;
00123     int computesChanged;
00124 
00125     int pairlistsValid;
00126     float pairlistTolerance;
00127     int usePairlists;
00128     int savePairlists;
00129     float plcutoff2;
00130 
00131     #if MIC_SUBMIT_ATOMS_ON_ARRIVAL != 0
00132       int micDevice;
00133       int2 *exclusionsByAtom_ptr;
00134       std::set<void*> *atomSubmitSignals;
00135       virtual void patchReady(PatchID patchID, int doneMigration, int seq);
00136     #endif
00137 
00138     // DMK - NOTE : Moved some variables from global scope in ComputeNonbondedMIC to here
00139     // DMK - NOTE : For the following members, non-MIC builds will not have the types defined, but
00140     //   this class should also go unused.  So leave these members out of non-MIC builds.  May
00141     //   need to move them back to "__thread" variables or find a cleaner solution.
00142     #if defined(NAMD_MIC)
00143       ResizeArray<patch_pair> patch_pairs;
00144       ResizeArray<force_list> force_lists;
00145       atom * atoms;
00146       atom_param * atom_params;
00147     #endif
00148 
00149     int exclContrib;
00150 
00151     // DMK - DEBUG
00152     int timestep;
00153 };
00154 
00155 

Generated on Sat Sep 23 01:17:12 2017 for NAMD by  doxygen 1.4.7