CudaPmeSolver.h

Go to the documentation of this file.
00001 #ifndef CUDAPMESOLVER_H
00002 #define CUDAPMESOLVER_H
00003 #include "PmeSolver.h"
00004 #include "CudaPmeSolver.decl.h"
00005 
00006 #ifdef NAMD_CUDA
00007 class CudaPmeXYZInitMsg : public CMessage_CudaPmeXYZInitMsg {
00008 public:
00009         CudaPmeXYZInitMsg(PmeGrid& pmeGrid) : pmeGrid(pmeGrid) {}
00010         PmeGrid pmeGrid;
00011 };
00012 
00013 class CudaPmeXYInitMsg : public CMessage_CudaPmeXYInitMsg {
00014 public:
00015         CudaPmeXYInitMsg(PmeGrid& pmeGrid, CProxy_CudaPmePencilXY& pmePencilXY, CProxy_CudaPmePencilZ& pmePencilZ,
00016                 CProxy_PmePencilXYMap& xyMap, CProxy_PmePencilXMap& zMap) : 
00017                 pmeGrid(pmeGrid), pmePencilXY(pmePencilXY), pmePencilZ(pmePencilZ), xyMap(xyMap), zMap(zMap) {}
00018         PmeGrid pmeGrid;
00019   CProxy_CudaPmePencilXY pmePencilXY;
00020   CProxy_CudaPmePencilZ pmePencilZ;
00021   CProxy_PmePencilXMap zMap;
00022   CProxy_PmePencilXYMap xyMap;
00023 };
00024 
00025 class CudaPmeXInitMsg : public CMessage_CudaPmeXInitMsg {
00026 public:
00027         CudaPmeXInitMsg(PmeGrid& pmeGrid,
00028                 CProxy_CudaPmePencilX& pmePencilX, CProxy_CudaPmePencilY& pmePencilY, CProxy_CudaPmePencilZ& pmePencilZ,
00029                 CProxy_PmePencilXMap& xMap, CProxy_PmePencilXMap& yMap, CProxy_PmePencilXMap& zMap) : 
00030                 pmeGrid(pmeGrid), pmePencilX(pmePencilX), pmePencilY(pmePencilY), pmePencilZ(pmePencilZ),
00031                 xMap(xMap), yMap(yMap), zMap(zMap) {}
00032         PmeGrid pmeGrid;
00033   CProxy_CudaPmePencilX pmePencilX;
00034   CProxy_CudaPmePencilY pmePencilY;
00035   CProxy_CudaPmePencilZ pmePencilZ;
00036   CProxy_PmePencilXMap xMap;
00037   CProxy_PmePencilXMap yMap;
00038   CProxy_PmePencilXMap zMap;
00039 };
00040 
00041 class InitDeviceMsg : public CMessage_InitDeviceMsg {
00042 public:
00043         InitDeviceMsg(CProxy_ComputePmeCUDADevice deviceProxy) : deviceProxy(deviceProxy) {}
00044         CProxy_ComputePmeCUDADevice deviceProxy;
00045 };
00046 
00047 class InitDeviceMsg2 : public CMessage_InitDeviceMsg2 {
00048 public:
00049         InitDeviceMsg2(int deviceID, cudaStream_t stream, CProxy_ComputePmeCUDAMgr mgrProxy) : 
00050         deviceID(deviceID), stream(stream), mgrProxy(mgrProxy) {}
00051         int deviceID;
00052         cudaStream_t stream;
00053         CProxy_ComputePmeCUDAMgr mgrProxy;
00054 };
00055 
00056 class CudaPmePencilXYZ : public CBase_CudaPmePencilXYZ {
00057 public:
00058         CudaPmePencilXYZ() {}
00059         CudaPmePencilXYZ(CkMigrateMessage *m) {}
00060         void initialize(CudaPmeXYZInitMsg *msg);
00061         void initializeDevice(InitDeviceMsg *msg);
00062         void energyAndVirialDone();
00063 private:
00064         void backwardDone();
00065   CProxy_ComputePmeCUDADevice deviceProxy;
00066 };
00067 
00068 struct DeviceBuffer {
00069         DeviceBuffer(int deviceID, bool isPeerDevice, float2* data) : deviceID(deviceID), isPeerDevice(isPeerDevice), data(data) {}
00070         bool isPeerDevice;
00071         int deviceID;
00072         cudaEvent_t event;
00073         float2 *data;
00074 };
00075 
00076 class DeviceDataMsg : public CMessage_DeviceDataMsg {
00077 public:
00078         DeviceDataMsg(int i, cudaEvent_t event, float2 *data) : i(i), event(event), data(data) {}
00079         int i;
00080         cudaEvent_t event;
00081         float2 *data;
00082 };
00083 
00084 class CudaPmePencilXY : public CBase_CudaPmePencilXY {
00085 public:
00086         CudaPmePencilXY_SDAG_CODE
00087         CudaPmePencilXY() : numGetDeviceBuffer(0), eventCreated(false) {}
00088         CudaPmePencilXY(CkMigrateMessage *m) : numGetDeviceBuffer(0), eventCreated(false) {}
00089         ~CudaPmePencilXY();
00090         void initialize(CudaPmeXYInitMsg *msg);
00091         void initializeDevice(InitDeviceMsg *msg);
00092 private:
00093         void forwardDone();
00094         void backwardDone();
00095         void recvDataFromZ(PmeBlockMsg *msg);
00096         void start();
00097         void setDeviceBuffers();
00098         float2* getData(const int i, const bool sameDevice);
00099         int deviceID;
00100         cudaStream_t stream;
00101         cudaEvent_t event;
00102         bool eventCreated;
00103         int imsgZ;
00104         int numDeviceBuffers;
00105         int numGetDeviceBuffer;
00106         std::vector<DeviceBuffer> deviceBuffers;
00107   CProxy_ComputePmeCUDADevice deviceProxy;
00108   CProxy_CudaPmePencilZ pmePencilZ;
00109   CProxy_PmePencilXMap zMap;
00110 };
00111 
00112 class CudaPmePencilX : public CBase_CudaPmePencilX {
00113 public:
00114         CudaPmePencilX_SDAG_CODE
00115         CudaPmePencilX() : numGetDeviceBuffer(0), eventCreated(false) {}
00116         CudaPmePencilX(CkMigrateMessage *m) : numGetDeviceBuffer(0), eventCreated(false) {}
00117         ~CudaPmePencilX();
00118         void initialize(CudaPmeXInitMsg *msg);
00119         void initializeDevice(InitDeviceMsg *msg);
00120 private:
00121         void forwardDone();
00122         void backwardDone();
00123         void recvDataFromY(PmeBlockMsg *msg);
00124         void start();
00125         void setDeviceBuffers();
00126         float2* getData(const int i, const bool sameDevice);
00127         int deviceID;
00128         cudaStream_t stream;
00129         cudaEvent_t event;
00130         bool eventCreated;
00131         int imsgY;
00132         int numDeviceBuffers;
00133         int numGetDeviceBuffer;
00134         std::vector<DeviceBuffer> deviceBuffers;
00135   CProxy_ComputePmeCUDADevice deviceProxy;
00136   CProxy_CudaPmePencilY pmePencilY;
00137   CProxy_PmePencilXMap yMap;
00138 };
00139 
00140 class CudaPmePencilY : public CBase_CudaPmePencilY {
00141 public:
00142         CudaPmePencilY_SDAG_CODE
00143         CudaPmePencilY() : numGetDeviceBufferZ(0), numGetDeviceBufferX(0), eventCreated(false) {}
00144         CudaPmePencilY(CkMigrateMessage *m) : numGetDeviceBufferZ(0), numGetDeviceBufferX(0), eventCreated(false) {}
00145         ~CudaPmePencilY();
00146         void initialize(CudaPmeXInitMsg *msg);
00147         void initializeDevice(InitDeviceMsg2 *msg);
00148 private:
00149         void forwardDone();
00150         void backwardDone();
00151         void recvDataFromX(PmeBlockMsg *msg);
00152         void recvDataFromZ(PmeBlockMsg *msg);
00153         void start();
00154         void setDeviceBuffers();
00155         float2* getDataForX(const int i, const bool sameDevice);
00156         float2* getDataForZ(const int i, const bool sameDevice);
00157         int deviceID;
00158         cudaStream_t stream;
00159         cudaEvent_t event;
00160         bool eventCreated;
00161         int imsgZ, imsgX;
00162         int imsgZZ, imsgXX;
00163         int numGetDeviceBufferZ;
00164         int numGetDeviceBufferX;
00165         int numDeviceBuffersZ;
00166         int numDeviceBuffersX;
00167         std::vector<DeviceBuffer> deviceBuffersZ;
00168         std::vector<DeviceBuffer> deviceBuffersX;
00169   CProxy_CudaPmePencilX pmePencilX;
00170   CProxy_CudaPmePencilZ pmePencilZ;
00171   CProxy_PmePencilXMap xMap;
00172   CProxy_PmePencilXMap zMap;
00173 };
00174 
00175 class CudaPmePencilZ : public CBase_CudaPmePencilZ {
00176 public:
00177         CudaPmePencilZ_SDAG_CODE
00178         CudaPmePencilZ() : numGetDeviceBufferY(0), numGetDeviceBufferXY(0), eventCreated(false) {}
00179         CudaPmePencilZ(CkMigrateMessage *m) : numGetDeviceBufferY(0), numGetDeviceBufferXY(0), eventCreated(false) {}
00180         ~CudaPmePencilZ();
00181         void initialize(CudaPmeXInitMsg *msg);
00182         void initialize(CudaPmeXYInitMsg *msg);
00183         void initializeDevice(InitDeviceMsg2 *msg);
00184         void energyAndVirialDone();
00185 private:
00186         void backwardDone();
00187         void recvDataFromY(PmeBlockMsg *msg);
00188         void start();
00189         void setDeviceBuffers();
00190         float2* getData(const int i, const bool sameDevice);
00191         int deviceID;
00192         cudaStream_t stream;
00193         cudaEvent_t event;
00194         bool eventCreated;
00195         int imsgY;
00196         int numDeviceBuffers;
00197         int numGetDeviceBufferY;
00198         std::vector<DeviceBuffer> deviceBuffers;
00199   CProxy_CudaPmePencilY pmePencilY;
00200   CProxy_PmePencilXMap yMap;
00201 
00202         bool useXYslab;
00203         int numGetDeviceBufferXY;
00204   CProxy_CudaPmePencilXY pmePencilXY;
00205   CProxy_PmePencilXYMap xyMap;
00206 };
00207 
00208 #endif // NAMD_CUDA
00209 #endif //CUDAPMESOLVER_H

Generated on Tue Sep 26 01:17:13 2017 for NAMD by  doxygen 1.4.7