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

#include <CudaPmeSolver.h>

Inheritance diagram for CudaPmePencilY:

Public Member Functions

CudaPmePencilY_SDAG_CODE CudaPmePencilY ()
 
 CudaPmePencilY (CkMigrateMessage *m)
 
 ~CudaPmePencilY ()
 
void initialize (CudaPmeXInitMsg *msg)
 
void initializeDevice (InitDeviceMsg2 *msg)
 

Detailed Description

Definition at line 140 of file CudaPmeSolver.h.

Constructor & Destructor Documentation

CudaPmePencilY_SDAG_CODE CudaPmePencilY::CudaPmePencilY ( )
inline

Definition at line 143 of file CudaPmeSolver.h.

143 : numGetDeviceBufferZ(0), numGetDeviceBufferX(0), eventCreated(false) {}
CudaPmePencilY::CudaPmePencilY ( CkMigrateMessage *  m)
inline

Definition at line 144 of file CudaPmeSolver.h.

144 : numGetDeviceBufferZ(0), numGetDeviceBufferX(0), eventCreated(false) {}
CudaPmePencilY::~CudaPmePencilY ( )

Definition at line 447 of file CudaPmeSolver.C.

References cudaCheck.

447  {
448  if (eventCreated) cudaCheck(cudaEventDestroy(event));
449 }
#define cudaCheck(stmt)
Definition: CudaUtils.h:79

Member Function Documentation

void CudaPmePencilY::initialize ( CudaPmeXInitMsg msg)

Definition at line 435 of file CudaPmeSolver.C.

References CudaPmeXInitMsg::pmeGrid, CudaPmeXInitMsg::pmePencilX, CudaPmeXInitMsg::pmePencilZ, CudaPmeXInitMsg::xMap, and CudaPmeXInitMsg::zMap.

435  {
436  pmeGrid = msg->pmeGrid;
437  pmePencilX = msg->pmePencilX;
438  pmePencilZ = msg->pmePencilZ;
439  xMap = msg->xMap;
440  zMap = msg->zMap;
441 
442  delete msg;
443 
444  initBlockSizes();
445 }
CProxy_CudaPmePencilZ pmePencilZ
Definition: CudaPmeSolver.h:35
CProxy_PmePencilXMap xMap
Definition: CudaPmeSolver.h:36
CProxy_CudaPmePencilX pmePencilX
Definition: CudaPmeSolver.h:33
CProxy_PmePencilXMap zMap
Definition: CudaPmeSolver.h:38
void CudaPmePencilY::initializeDevice ( InitDeviceMsg2 msg)

Definition at line 454 of file CudaPmeSolver.C.

References cudaCheck, InitDeviceMsg2::deviceID, InitDeviceMsg2::mgrProxy, Perm_Y_Z_cX, InitDeviceMsg2::stream, and y.

454  {
455  // Get device proxy
456  // CProxy_ComputePmeCUDADevice deviceProxy = msg->deviceProxy;
457  deviceID = msg->deviceID;
458  stream = msg->stream;
459  CProxy_ComputePmeCUDAMgr mgrProxy = msg->mgrProxy;
460  delete msg;
461  // deviceID = deviceProxy.ckLocalBranch()->getDeviceID();
462  // cudaStream_t stream = deviceProxy.ckLocalBranch()->getStream();
463  // CProxy_ComputePmeCUDAMgr mgrProxy = deviceProxy.ckLocalBranch()->getMgrProxy();
464  // Setup fftCompute and pmeKSpaceCompute
465  fftCompute = new CudaFFTCompute(deviceID, stream);
466  pmeTranspose = new CudaPmeTranspose(pmeGrid, Perm_Y_Z_cX, thisIndex.z, thisIndex.x, deviceID, stream);
467 
468  // Create event. NOTE: Events are tied to devices, hence the cudaSetDevice() here
469  cudaCheck(cudaSetDevice(deviceID));
470  cudaCheck(cudaEventCreateWithFlags(&event, cudaEventDisableTiming));
471  eventCreated = true;
472 
473  deviceBuffersZ.resize(pmeGrid.yBlocks, DeviceBuffer(-1, false, NULL));
474  deviceBuffersX.resize(pmeGrid.yBlocks, DeviceBuffer(-1, false, NULL));
475  numDeviceBuffersZ = 0;
476  numDeviceBuffersX = 0;
477 
478  for (int y=0;y < pmeGrid.yBlocks;y++) {
479  int pe;
480  pe = zMap.ckLocalBranch()->procNum(0, CkArrayIndex3D(thisIndex.x, y, 0));
481  if (CkNodeOf(pe) == CkMyNode()) {
482  int deviceID0 = mgrProxy.ckLocalBranch()->getDeviceIDPencilZ(thisIndex.x, y);
483  numDeviceBuffersZ++;
484  deviceBuffersZ[y] = DeviceBuffer(deviceID0, false, NULL);
485  pmePencilZ(thisIndex.x, y, 0).getDeviceBuffer(thisIndex.z, (deviceID0 == deviceID), thisProxy);
486  }
487  pe = xMap.ckLocalBranch()->procNum(0, CkArrayIndex3D(0, y, thisIndex.z));
488  if (CkNodeOf(pe) == CkMyNode()) {
489  int deviceID0 = mgrProxy.ckLocalBranch()->getDeviceIDPencilX(y, thisIndex.z);
490  numDeviceBuffersX++;
491  deviceBuffersX[y] = DeviceBuffer(deviceID0, false, NULL);
492  pmePencilX(0, y, thisIndex.z).getDeviceBuffer(thisIndex.x, (deviceID0 == deviceID), thisProxy);
493  }
494  }
495 
496 }
__thread cudaStream_t stream
cudaStream_t stream
Definition: CudaPmeSolver.h:52
CProxy_ComputePmeCUDAMgr mgrProxy
Definition: CudaPmeSolver.h:53
gridSize y
#define cudaCheck(stmt)
Definition: CudaUtils.h:79

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