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 127 of file CudaPmeSolver.h.

Constructor & Destructor Documentation

◆ CudaPmePencilX() [1/2]

CudaPmePencilX_SDAG_CODE CudaPmePencilX::CudaPmePencilX ( )
inline

Definition at line 130 of file CudaPmeSolver.h.

130 : numGetDeviceBuffer(0), eventCreated(false) {}

◆ CudaPmePencilX() [2/2]

CudaPmePencilX::CudaPmePencilX ( CkMigrateMessage *  m)
inline

Definition at line 131 of file CudaPmeSolver.h.

131 : numGetDeviceBuffer(0), eventCreated(false) {}

◆ ~CudaPmePencilX()

CudaPmePencilX::~CudaPmePencilX ( )

Definition at line 320 of file CudaPmeSolver.C.

References cudaCheck.

320  {
321  if (eventCreated) cudaCheck(cudaEventDestroy(event));
322 }
#define cudaCheck(stmt)
Definition: CudaUtils.h:233

Member Function Documentation

◆ initialize()

void CudaPmePencilX::initialize ( CudaPmeXInitMsg msg)

Definition at line 309 of file CudaPmeSolver.C.

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

309  {
310  pmeGrid = msg->pmeGrid;
311  pmePencilY = msg->pmePencilY;
312  yMap = msg->yMap;
313 
314  delete msg;
315 
316  initBlockSizes();
317 
318 }
CProxy_CudaPmePencilY pmePencilY
Definition: CudaPmeSolver.h:34
CProxy_PmePencilXMap yMap
Definition: CudaPmeSolver.h:37

◆ initializeDevice()

void CudaPmePencilX::initializeDevice ( InitDeviceMsg msg)

Definition at line 327 of file CudaPmeSolver.C.

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

327  {
328  // Store device proxy
329  deviceProxy = msg->deviceProxy;
330  delete msg;
331  deviceID = deviceProxy.ckLocalBranch()->getDeviceID();
332  stream = deviceProxy.ckLocalBranch()->getStream();
333  CProxy_ComputePmeCUDAMgr mgrProxy = deviceProxy.ckLocalBranch()->getMgrProxy();
334  // Setup fftCompute and pmeKSpaceCompute
335 // fftCompute = new CudaFFTCompute(deviceID, stream);
336 // fftCompute2 = new CudaFFTCompute(deviceID, stream);
337 // pmeTranspose = new CudaPmeTranspose(pmeGrid, Perm_cX_Y_Z, thisIndex.y, thisIndex.z, deviceID, stream);
338 // pmeTranspose2 = new CudaPmeTranspose(pmeGrid, Perm_cX_Y_Z, thisIndex.y, thisIndex.z, deviceID, stream);
339  for (unsigned int iGrid = 0; iGrid < NUM_GRID_MAX; ++iGrid) {
340  if (deviceProxy.ckLocalBranch()->isGridEnabled(iGrid) == true) {
341  fftComputes[iGrid] = new CudaFFTCompute(deviceID, stream);
342  pmeTransposes[iGrid] = new CudaPmeTranspose(pmeGrid, Perm_cX_Y_Z, thisIndex.y, thisIndex.z, deviceID, stream);
343  } else {
344  fftComputes[iGrid] = NULL;
345  pmeTransposes[iGrid] = NULL;
346  }
347  }
348 
349  // Create event. NOTE: Events are tied to devices, hence the cudaSetDevice() here
350  cudaCheck(cudaSetDevice(deviceID));
351  cudaCheck(cudaEventCreateWithFlags(&event, cudaEventDisableTiming));
352  eventCreated = true;
353 
354  deviceBuffers.resize(pmeGrid.xBlocks, DeviceBuffer(-1, false));
355  numDeviceBuffers = 0;
356 
357  for (int x=0;x < pmeGrid.xBlocks;x++) {
358  int pe = yMap.ckLocalBranch()->procNum(0, CkArrayIndex3D(x,0,thisIndex.z));
359  if (CkNodeOf(pe) == CkMyNode()) {
360  int deviceID0 = mgrProxy.ckLocalBranch()->getDeviceIDPencilY(x, thisIndex.z);
361  numDeviceBuffers++;
362  deviceBuffers[x] = DeviceBuffer(deviceID0, false);
363  pmePencilY(x,0,thisIndex.z).getDeviceBuffer(thisIndex.y, (deviceID0 == deviceID), thisProxy);
364  }
365  }
366 
367 }
const unsigned int NUM_GRID_MAX
Definition: PmeSolverUtil.h:9
CProxy_ComputePmeCUDADevice deviceProxy
Definition: CudaPmeSolver.h:44
#define cudaCheck(stmt)
Definition: CudaUtils.h:233

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