NAMD
Public Member Functions | List of all members
CudaPmePencilX Class Reference

#include <CudaPmeSolver.h>

Inheritance diagram for CudaPmePencilX:

Public Member Functions

CudaPmePencilX_SDAG_CODE CudaPmePencilX ()
 
 CudaPmePencilX (CkMigrateMessage *m)
 
 ~CudaPmePencilX ()
 
void initialize (CudaPmeXInitMsg *msg)
 
void initializeDevice (InitDeviceMsg *msg)
 

Detailed Description

Definition at line 112 of file CudaPmeSolver.h.

Constructor & Destructor Documentation

CudaPmePencilX_SDAG_CODE CudaPmePencilX::CudaPmePencilX ( )
inline

Definition at line 115 of file CudaPmeSolver.h.

115 : numGetDeviceBuffer(0), eventCreated(false) {}
CudaPmePencilX::CudaPmePencilX ( CkMigrateMessage *  m)
inline

Definition at line 116 of file CudaPmeSolver.h.

116 : numGetDeviceBuffer(0), eventCreated(false) {}
CudaPmePencilX::~CudaPmePencilX ( )

Definition at line 268 of file CudaPmeSolver.C.

References cudaCheck.

268  {
269  if (eventCreated) cudaCheck(cudaEventDestroy(event));
270 }
#define cudaCheck(stmt)
Definition: CudaUtils.h:79

Member Function Documentation

void CudaPmePencilX::initialize ( CudaPmeXInitMsg msg)

Definition at line 257 of file CudaPmeSolver.C.

References CudaPmeXInitMsg::pmeGrid, CudaPmeXInitMsg::pmePencilY, and CudaPmeXInitMsg::yMap.

257  {
258  pmeGrid = msg->pmeGrid;
259  pmePencilY = msg->pmePencilY;
260  yMap = msg->yMap;
261 
262  delete msg;
263 
264  initBlockSizes();
265 
266 }
CProxy_CudaPmePencilY pmePencilY
Definition: CudaPmeSolver.h:34
CProxy_PmePencilXMap yMap
Definition: CudaPmeSolver.h:37
void CudaPmePencilX::initializeDevice ( InitDeviceMsg msg)

Definition at line 275 of file CudaPmeSolver.C.

References cudaCheck, InitDeviceMsg::deviceProxy, Perm_cX_Y_Z, and x.

275  {
276  // Store device proxy
277  deviceProxy = msg->deviceProxy;
278  delete msg;
279  deviceID = deviceProxy.ckLocalBranch()->getDeviceID();
280  stream = deviceProxy.ckLocalBranch()->getStream();
281  CProxy_ComputePmeCUDAMgr mgrProxy = deviceProxy.ckLocalBranch()->getMgrProxy();
282  // Setup fftCompute and pmeKSpaceCompute
283  fftCompute = new CudaFFTCompute(deviceID, stream);
284  pmeTranspose = new CudaPmeTranspose(pmeGrid, Perm_cX_Y_Z, thisIndex.y, thisIndex.z, deviceID, stream);
285 
286  // Create event. NOTE: Events are tied to devices, hence the cudaSetDevice() here
287  cudaCheck(cudaSetDevice(deviceID));
288  cudaCheck(cudaEventCreateWithFlags(&event, cudaEventDisableTiming));
289  eventCreated = true;
290 
291  deviceBuffers.resize(pmeGrid.xBlocks, DeviceBuffer(-1, false, NULL));
292  numDeviceBuffers = 0;
293 
294  for (int x=0;x < pmeGrid.xBlocks;x++) {
295  int pe = yMap.ckLocalBranch()->procNum(0, CkArrayIndex3D(x,0,thisIndex.z));
296  if (CkNodeOf(pe) == CkMyNode()) {
297  int deviceID0 = mgrProxy.ckLocalBranch()->getDeviceIDPencilY(x, thisIndex.z);
298  numDeviceBuffers++;
299  deviceBuffers[x] = DeviceBuffer(deviceID0, false, NULL);
300  pmePencilY(x,0,thisIndex.z).getDeviceBuffer(thisIndex.y, (deviceID0 == deviceID), thisProxy);
301  }
302  }
303 
304 }
CProxy_ComputePmeCUDADevice deviceProxy
Definition: CudaPmeSolver.h:44
__thread cudaStream_t stream
#define cudaCheck(stmt)
Definition: CudaUtils.h:79
gridSize x

The documentation for this class was generated from the following files: