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

#include <CudaPmeSolver.h>

Inheritance diagram for CudaPmePencilZ:

Public Member Functions

CudaPmePencilZ_SDAG_CODE CudaPmePencilZ ()
 
 CudaPmePencilZ (CkMigrateMessage *m)
 
 ~CudaPmePencilZ ()
 
void initialize (CudaPmeXInitMsg *msg)
 
void initialize (CudaPmeXYInitMsg *msg)
 
void initializeDevice (InitDeviceMsg2 *msg)
 
void energyAndVirialDone ()
 

Detailed Description

Definition at line 175 of file CudaPmeSolver.h.

Constructor & Destructor Documentation

CudaPmePencilZ_SDAG_CODE CudaPmePencilZ::CudaPmePencilZ ( )
inline

Definition at line 178 of file CudaPmeSolver.h.

178 : numGetDeviceBufferY(0), numGetDeviceBufferXY(0), eventCreated(false) {}
CudaPmePencilZ::CudaPmePencilZ ( CkMigrateMessage *  m)
inline

Definition at line 179 of file CudaPmeSolver.h.

179 : numGetDeviceBufferY(0), numGetDeviceBufferXY(0), eventCreated(false) {}
CudaPmePencilZ::~CudaPmePencilZ ( )

Definition at line 732 of file CudaPmeSolver.C.

References cudaCheck.

732  {
733  if (eventCreated) cudaCheck(cudaEventDestroy(event));
734 }
#define cudaCheck(stmt)
Definition: CudaUtils.h:79

Member Function Documentation

void CudaPmePencilZ::energyAndVirialDone ( )

Definition at line 932 of file CudaPmeSolver.C.

932  {
933  submitReductions();
934 }
void CudaPmePencilZ::initialize ( CudaPmeXInitMsg msg)

Definition at line 710 of file CudaPmeSolver.C.

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

710  {
711  useXYslab = false;
712  pmeGrid = msg->pmeGrid;
713  pmePencilY = msg->pmePencilY;
714  yMap = msg->yMap;
715 
716  delete msg;
717 
718  initBlockSizes();
719 }
CProxy_CudaPmePencilY pmePencilY
Definition: CudaPmeSolver.h:34
CProxy_PmePencilXMap yMap
Definition: CudaPmeSolver.h:37
void CudaPmePencilZ::initialize ( CudaPmeXYInitMsg msg)

Definition at line 721 of file CudaPmeSolver.C.

References CudaPmeXYInitMsg::pmeGrid, CudaPmeXYInitMsg::pmePencilXY, and CudaPmeXYInitMsg::xyMap.

721  {
722  useXYslab = true;
723  pmeGrid = msg->pmeGrid;
724  pmePencilXY = msg->pmePencilXY;
725  xyMap = msg->xyMap;
726 
727  delete msg;
728 
729  initBlockSizes();
730 }
CProxy_PmePencilXYMap xyMap
Definition: CudaPmeSolver.h:22
CProxy_CudaPmePencilXY pmePencilXY
Definition: CudaPmeSolver.h:19
void CudaPmePencilZ::initializeDevice ( InitDeviceMsg2 msg)

Definition at line 739 of file CudaPmeSolver.C.

References cudaCheck, InitDeviceMsg2::deviceID, ComputeNonbondedUtil::ewaldcof, InitDeviceMsg2::mgrProxy, Perm_Z_cX_Y, InitDeviceMsg2::stream, and z.

739  {
740  // Get device proxy
741  // CProxy_ComputePmeCUDADevice deviceProxy = msg->deviceProxy;
742  deviceID = msg->deviceID;
743  stream = msg->stream;
744  CProxy_ComputePmeCUDAMgr mgrProxy = msg->mgrProxy;
745  delete msg;
746  // deviceID = deviceProxy.ckLocalBranch()->getDeviceID();
747  // cudaStream_t stream = deviceProxy.ckLocalBranch()->getStream();
748  // CProxy_ComputePmeCUDAMgr mgrProxy = deviceProxy.ckLocalBranch()->getMgrProxy();
749  // Setup fftCompute and pmeKSpaceCompute
750  fftCompute = new CudaFFTCompute(deviceID, stream);
751  pmeTranspose = new CudaPmeTranspose(pmeGrid, Perm_Z_cX_Y, thisIndex.x, thisIndex.y, deviceID, stream);
752  pmeKSpaceCompute = new CudaPmeKSpaceCompute(pmeGrid, Perm_Z_cX_Y, thisIndex.x, thisIndex.y,
754 
755  // Create event. NOTE: Events are tied to devices, hence the cudaSetDevice() here
756  cudaCheck(cudaSetDevice(deviceID));
757  cudaCheck(cudaEventCreateWithFlags(&event, cudaEventDisableTiming));
758  eventCreated = true;
759 
760  deviceBuffers.resize(pmeGrid.zBlocks, DeviceBuffer(-1, false, NULL));
761  numDeviceBuffers = 0;
762 
763  if (useXYslab) {
764  for (int z=0;z < pmeGrid.zBlocks;z++) {
765  int pe = xyMap.ckLocalBranch()->procNum(0, CkArrayIndex3D(0,0,z));
766  if (CkNodeOf(pe) == CkMyNode()) {
767  int deviceID0 = mgrProxy.ckLocalBranch()->getDeviceIDPencilX(0, z);
768  // Check for Peer-to-Peer access
769  int canAccessPeer = 0;
770  if (deviceID != deviceID0) {
771  cudaCheck(cudaSetDevice(deviceID));
772  cudaCheck(cudaDeviceCanAccessPeer(&canAccessPeer, deviceID, deviceID0));
773  }
774 #ifdef DISABLE_P2P
775  canAccessPeer = 0;
776 #endif
777  numDeviceBuffers++;
778  deviceBuffers[z] = DeviceBuffer(deviceID0, canAccessPeer, NULL);
779  pmePencilXY(0,0,z).getDeviceBuffer(thisIndex.x, (deviceID0 == deviceID) || canAccessPeer, thisProxy);
780  }
781  }
782  } else {
783  for (int z=0;z < pmeGrid.zBlocks;z++) {
784  int pe = yMap.ckLocalBranch()->procNum(0, CkArrayIndex3D(thisIndex.x,0,z));
785  if (CkNodeOf(pe) == CkMyNode()) {
786  int deviceID0 = mgrProxy.ckLocalBranch()->getDeviceIDPencilY(thisIndex.x, z);
787  numDeviceBuffers++;
788  deviceBuffers[z] = DeviceBuffer(deviceID0, false, NULL);
789  pmePencilY(thisIndex.x,0,z).getDeviceBuffer(thisIndex.y, (deviceID0 == deviceID), thisProxy);
790  }
791  }
792  }
793 
794 }
__thread cudaStream_t stream
gridSize z
cudaStream_t stream
Definition: CudaPmeSolver.h:52
CProxy_ComputePmeCUDAMgr mgrProxy
Definition: CudaPmeSolver.h:53
#define cudaCheck(stmt)
Definition: CudaUtils.h:79

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