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

Constructor & Destructor Documentation

◆ CudaPmePencilY() [1/2]

CudaPmePencilY_SDAG_CODE CudaPmePencilY::CudaPmePencilY ( )
inline

Definition at line 158 of file CudaPmeSolver.h.

158 : numGetDeviceBufferZ(0), numGetDeviceBufferX(0), eventCreated(false) {}

◆ CudaPmePencilY() [2/2]

CudaPmePencilY::CudaPmePencilY ( CkMigrateMessage *  m)
inline

Definition at line 159 of file CudaPmeSolver.h.

159 : numGetDeviceBufferZ(0), numGetDeviceBufferX(0), eventCreated(false) {}

◆ ~CudaPmePencilY()

CudaPmePencilY::~CudaPmePencilY ( )

Definition at line 531 of file CudaPmeSolver.C.

References cudaCheck.

531  {
532  if (eventCreated) cudaCheck(cudaEventDestroy(event));
533 }
#define cudaCheck(stmt)
Definition: CudaUtils.h:233

Member Function Documentation

◆ initialize()

void CudaPmePencilY::initialize ( CudaPmeXInitMsg msg)

Definition at line 519 of file CudaPmeSolver.C.

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

519  {
520  pmeGrid = msg->pmeGrid;
521  pmePencilX = msg->pmePencilX;
522  pmePencilZ = msg->pmePencilZ;
523  xMap = msg->xMap;
524  zMap = msg->zMap;
525 
526  delete msg;
527 
528  initBlockSizes();
529 }
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

◆ initializeDevice()

void CudaPmePencilY::initializeDevice ( InitDeviceMsg2 msg)

Definition at line 538 of file CudaPmeSolver.C.

References cudaCheck, InitDeviceMsg2::deviceID, InitDeviceMsg2::deviceProxy, InitDeviceMsg2::mgrProxy, NUM_GRID_MAX, Perm_Y_Z_cX, and InitDeviceMsg2::stream.

538  {
539  // Get device proxy
540  CProxy_ComputePmeCUDADevice deviceProxy = msg->deviceProxy;
541  deviceID = msg->deviceID;
542  stream = msg->stream;
543  CProxy_ComputePmeCUDAMgr mgrProxy = msg->mgrProxy;
544  delete msg;
545  // deviceID = deviceProxy.ckLocalBranch()->getDeviceID();
546  // cudaStream_t stream = deviceProxy.ckLocalBranch()->getStream();
547  // CProxy_ComputePmeCUDAMgr mgrProxy = deviceProxy.ckLocalBranch()->getMgrProxy();
548  // Setup fftCompute and pmeKSpaceCompute
549  for (unsigned int iGrid = 0; iGrid < NUM_GRID_MAX; ++iGrid) {
550  if (deviceProxy.ckLocalBranch()->isGridEnabled(iGrid) == true) {
551  fftComputes[iGrid] = new CudaFFTCompute(deviceID, stream);
552  pmeTransposes[iGrid] = new CudaPmeTranspose(pmeGrid, Perm_Y_Z_cX, thisIndex.z, thisIndex.x, deviceID, stream);
553  } else {
554  fftComputes[iGrid] = NULL;
555  pmeTransposes[iGrid] = NULL;
556  }
557  }
558 
559  // Create event. NOTE: Events are tied to devices, hence the cudaSetDevice() here
560  cudaCheck(cudaSetDevice(deviceID));
561  cudaCheck(cudaEventCreateWithFlags(&event, cudaEventDisableTiming));
562  eventCreated = true;
563 
564  deviceBuffersZ.resize(pmeGrid.yBlocks, DeviceBuffer(-1, false));
565  deviceBuffersX.resize(pmeGrid.yBlocks, DeviceBuffer(-1, false));
566  numDeviceBuffersZ = 0;
567  numDeviceBuffersX = 0;
568 
569  for (int y=0;y < pmeGrid.yBlocks;y++) {
570  int pe;
571  pe = zMap.ckLocalBranch()->procNum(0, CkArrayIndex3D(thisIndex.x, y, 0));
572  if (CkNodeOf(pe) == CkMyNode()) {
573  int deviceID0 = mgrProxy.ckLocalBranch()->getDeviceIDPencilZ(thisIndex.x, y);
574  numDeviceBuffersZ++;
575  deviceBuffersZ[y] = DeviceBuffer(deviceID0, false);
576  pmePencilZ(thisIndex.x, y, 0).getDeviceBuffer(thisIndex.z, (deviceID0 == deviceID), thisProxy);
577  }
578  pe = xMap.ckLocalBranch()->procNum(0, CkArrayIndex3D(0, y, thisIndex.z));
579  if (CkNodeOf(pe) == CkMyNode()) {
580  int deviceID0 = mgrProxy.ckLocalBranch()->getDeviceIDPencilX(y, thisIndex.z);
581  numDeviceBuffersX++;
582  deviceBuffersX[y] = DeviceBuffer(deviceID0, false);
583  pmePencilX(0, y, thisIndex.z).getDeviceBuffer(thisIndex.x, (deviceID0 == deviceID), thisProxy);
584  }
585  }
586 
587 }
CProxy_ComputePmeCUDADevice deviceProxy
Definition: CudaPmeSolver.h:54
const unsigned int NUM_GRID_MAX
Definition: PmeSolverUtil.h:9
cudaStream_t stream
Definition: CudaPmeSolver.h:52
CProxy_ComputePmeCUDAMgr mgrProxy
Definition: CudaPmeSolver.h:53
#define cudaCheck(stmt)
Definition: CudaUtils.h:233

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