CudaComputeGBISKernel Class Reference

#include <CudaComputeGBISKernel.h>

List of all members.

Public Member Functions

 CudaComputeGBISKernel (int deviceID)
 ~CudaComputeGBISKernel ()
void updateIntRad (const int atomStorageSize, float *intRad0H, float *intRadSH, cudaStream_t stream)
void updateBornRad (const int atomStorageSize, float *bornRadH, cudaStream_t stream)
void update_dHdrPrefix (const int atomStorageSize, float *dHdrPrefixH, cudaStream_t stream)
void GBISphase1 (CudaTileListKernel &tlKernel, const int atomStorageSize, const float3 lata, const float3 latb, const float3 latc, const float a_cut, float *h_psiSum, cudaStream_t stream)
void GBISphase2 (CudaTileListKernel &tlKernel, const int atomStorageSize, const bool doEnergy, const bool doSlow, const float3 lata, const float3 latb, const float3 latc, const float r_cut, const float scaling, const float kappa, const float smoothDist, const float epsilon_p, const float epsilon_s, float4 *d_forces, float *h_dEdaSum, cudaStream_t stream)
void GBISphase3 (CudaTileListKernel &tlKernel, const int atomStorageSize, const float3 lata, const float3 latb, const float3 latc, const float a_cut, float4 *d_forces, cudaStream_t stream)

Detailed Description

Definition at line 5 of file CudaComputeGBISKernel.h.


Constructor & Destructor Documentation

CudaComputeGBISKernel::CudaComputeGBISKernel ( int  deviceID  ) 

Definition at line 423 of file CudaComputeGBISKernel.cu.

References cudaCheck.

00423                                                          : deviceID(deviceID) {
00424   cudaCheck(cudaSetDevice(deviceID));
00425 
00426   intRad0 = NULL;
00427   intRad0Size = 0;
00428 
00429   intRadS = NULL;
00430   intRadSSize = 0;
00431 
00432   psiSum = NULL;
00433   psiSumSize = 0;
00434 
00435   bornRad = NULL;
00436   bornRadSize = 0;
00437 
00438   dEdaSum = NULL;
00439   dEdaSumSize = 0;
00440 
00441   dHdrPrefix = NULL;
00442   dHdrPrefixSize = 0;
00443 
00444 }

CudaComputeGBISKernel::~CudaComputeGBISKernel (  ) 

Definition at line 449 of file CudaComputeGBISKernel.cu.

References cudaCheck.

00449                                               {
00450   cudaCheck(cudaSetDevice(deviceID));
00451   if (intRad0 != NULL) deallocate_device<float>(&intRad0);
00452   if (intRadS != NULL) deallocate_device<float>(&intRadS);
00453   if (psiSum != NULL) deallocate_device<float>(&psiSum);
00454   if (bornRad != NULL) deallocate_device<float>(&bornRad);
00455   if (dEdaSum != NULL) deallocate_device<float>(&dEdaSum);
00456   if (dHdrPrefix != NULL) deallocate_device<float>(&dHdrPrefix);
00457 }


Member Function Documentation

void CudaComputeGBISKernel::GBISphase1 ( CudaTileListKernel tlKernel,
const int  atomStorageSize,
const float3  lata,
const float3  latb,
const float3  latc,
const float  a_cut,
float *  h_psiSum,
cudaStream_t  stream 
)

Definition at line 491 of file CudaComputeGBISKernel.cu.

References GBISParam< 1 >::a_cut, cudaCheck, deviceCUDA, FS_MAX, GBISKERNEL_NUM_WARP, CudaTileListKernel::get_xyzq(), DeviceCUDA::getMaxNumBlocks(), CudaTileListKernel::getNumTileListsGBIS(), CudaTileListKernel::getPatchPairs(), CudaTileListKernel::getTileJatomStartGBIS(), CudaTileListKernel::getTileListsGBIS(), and WARPSIZE.

00493                        {
00494 
00495   reallocate_device<float>(&psiSum, &psiSumSize, atomStorageSize, 1.2f);
00496   clear_device_array<float>(psiSum, atomStorageSize, stream);
00497 
00498   int nwarp = GBISKERNEL_NUM_WARP;
00499   int nthread = WARPSIZE*nwarp;
00500   int nblock = min(deviceCUDA->getMaxNumBlocks(), (tlKernel.getNumTileListsGBIS()-1)/nwarp+1);
00501 
00502   GBISParam<1> param;
00503   param.a_cut = a_cut;
00504 
00505   float cutoff2 = (a_cut + FS_MAX)*(a_cut + FS_MAX);
00506 
00507   GBIS_Kernel<false, false, 1> <<< nblock, nthread, 0, stream >>>
00508   (tlKernel.getNumTileListsGBIS(), tlKernel.getTileListsGBIS(), tlKernel.getTileJatomStartGBIS(),
00509     tlKernel.getPatchPairs(), lata, latb, latc, tlKernel.get_xyzq(), cutoff2,
00510     param, intRad0, intRadS, NULL, psiSum, NULL, NULL);
00511 
00512   cudaCheck(cudaGetLastError());
00513 
00514   copy_DtoH<float>(psiSum, h_psiSum, atomStorageSize, stream);
00515 }

void CudaComputeGBISKernel::GBISphase2 ( CudaTileListKernel tlKernel,
const int  atomStorageSize,
const bool  doEnergy,
const bool  doSlow,
const float3  lata,
const float3  latb,
const float3  latc,
const float  r_cut,
const float  scaling,
const float  kappa,
const float  smoothDist,
const float  epsilon_p,
const float  epsilon_s,
float4 *  d_forces,
float *  h_dEdaSum,
cudaStream_t  stream 
)

Definition at line 520 of file CudaComputeGBISKernel.cu.

References CALL, cudaCheck, deviceCUDA, GBISParam< 2 >::epsilon_p_i, GBISParam< 2 >::epsilon_s_i, GBISKERNEL_NUM_WARP, DeviceCUDA::getMaxNumBlocks(), CudaTileListKernel::getNumTileListsGBIS(), GBISParam< 2 >::kappa, GBISParam< 2 >::r_cut2, GBISParam< 2 >::r_cut_2, GBISParam< 2 >::r_cut_4, GBISParam< 2 >::scaling, CudaTileListKernel::setTileListVirialEnergyGBISLength(), GBISParam< 2 >::smoothDist, and WARPSIZE.

00525                                                            {
00526 
00527   reallocate_device<float>(&dEdaSum, &dEdaSumSize, atomStorageSize, 1.2f);
00528   clear_device_array<float>(dEdaSum, atomStorageSize, stream);
00529 
00530   if (doEnergy) {
00531     tlKernel.setTileListVirialEnergyGBISLength(tlKernel.getNumTileListsGBIS());
00532   }
00533 
00534   int nwarp = GBISKERNEL_NUM_WARP;
00535   int nthread = WARPSIZE*nwarp;
00536 
00537   int nblock = min(deviceCUDA->getMaxNumBlocks(), (tlKernel.getNumTileListsGBIS()-1)/nwarp+1);
00538 
00539   GBISParam<2> param;
00540   param.r_cut2      = r_cut*r_cut;
00541   param.r_cut_2     = 1.f / param.r_cut2;
00542   param.r_cut_4     = 4.f*param.r_cut_2*param.r_cut_2;
00543   param.epsilon_s_i = 1.f / epsilon_s;
00544   param.epsilon_p_i = 1.f / epsilon_p;
00545   param.scaling     = scaling;
00546   param.kappa       = kappa;
00547   param.smoothDist  = smoothDist;
00548 
00549 #define CALL(DOENERGY, DOSLOW) GBIS_Kernel<DOENERGY, DOSLOW, 2> \
00550      <<< nblock, nthread, 0, stream >>> \
00551     (tlKernel.getNumTileListsGBIS(), tlKernel.getTileListsGBIS(), tlKernel.getTileJatomStartGBIS(), \
00552       tlKernel.getPatchPairs(), lata, latb, latc, tlKernel.get_xyzq(), param.r_cut2, \
00553       param, bornRad, NULL, NULL, dEdaSum, d_forces, tlKernel.getTileListVirialEnergy())
00554 
00555   if (!doEnergy && !doSlow) CALL(false, false);
00556   if (!doEnergy &&  doSlow) CALL(false, true);
00557   if ( doEnergy && !doSlow) CALL(true,  false);
00558   if ( doEnergy &&  doSlow) CALL(true,  true);
00559 
00560   cudaCheck(cudaGetLastError());
00561 
00562   copy_DtoH<float>(dEdaSum, h_dEdaSum, atomStorageSize, stream);
00563 }

void CudaComputeGBISKernel::GBISphase3 ( CudaTileListKernel tlKernel,
const int  atomStorageSize,
const float3  lata,
const float3  latb,
const float3  latc,
const float  a_cut,
float4 *  d_forces,
cudaStream_t  stream 
)

Definition at line 568 of file CudaComputeGBISKernel.cu.

References GBISParam< 3 >::a_cut, cudaCheck, deviceCUDA, FS_MAX, GBISKERNEL_NUM_WARP, CudaTileListKernel::get_xyzq(), DeviceCUDA::getMaxNumBlocks(), CudaTileListKernel::getNumTileListsGBIS(), CudaTileListKernel::getPatchPairs(), CudaTileListKernel::getTileJatomStartGBIS(), CudaTileListKernel::getTileListsGBIS(), and WARPSIZE.

00570                                          {
00571 
00572   int nwarp = GBISKERNEL_NUM_WARP;
00573   int nthread = WARPSIZE*nwarp;
00574   int nblock = min(deviceCUDA->getMaxNumBlocks(), (tlKernel.getNumTileListsGBIS()-1)/nwarp+1);
00575 
00576   GBISParam<3> param;
00577   param.a_cut = a_cut;
00578 
00579   float cutoff2 = (a_cut + FS_MAX)*(a_cut + FS_MAX);
00580 
00581   GBIS_Kernel<false, false, 3> <<< nblock, nthread, 0, stream >>>
00582   (tlKernel.getNumTileListsGBIS(), tlKernel.getTileListsGBIS(), tlKernel.getTileJatomStartGBIS(),
00583     tlKernel.getPatchPairs(), lata, latb, latc, tlKernel.get_xyzq(), cutoff2,
00584     param, intRad0, intRadS, dHdrPrefix, NULL, d_forces, NULL);
00585 
00586   cudaCheck(cudaGetLastError());
00587 }

void CudaComputeGBISKernel::update_dHdrPrefix ( const int  atomStorageSize,
float *  dHdrPrefixH,
cudaStream_t  stream 
)

Definition at line 483 of file CudaComputeGBISKernel.cu.

00483                                                                                                                 {
00484   reallocate_device<float>(&dHdrPrefix, &dHdrPrefixSize, atomStorageSize, 1.2f);
00485   copy_HtoD<float>(dHdrPrefixH, dHdrPrefix, atomStorageSize, stream);
00486 }

void CudaComputeGBISKernel::updateBornRad ( const int  atomStorageSize,
float *  bornRadH,
cudaStream_t  stream 
)

Definition at line 475 of file CudaComputeGBISKernel.cu.

00475                                                                                                          {
00476   reallocate_device<float>(&bornRad, &bornRadSize, atomStorageSize, 1.2f);
00477   copy_HtoD<float>(bornRadH, bornRad, atomStorageSize, stream);
00478 }

void CudaComputeGBISKernel::updateIntRad ( const int  atomStorageSize,
float *  intRad0H,
float *  intRadSH,
cudaStream_t  stream 
)

Definition at line 462 of file CudaComputeGBISKernel.cu.

00463                        {
00464 
00465   reallocate_device<float>(&intRad0, &intRad0Size, atomStorageSize, 1.2f);
00466   reallocate_device<float>(&intRadS, &intRadSSize, atomStorageSize, 1.2f);
00467 
00468   copy_HtoD<float>(intRad0H, intRad0, atomStorageSize, stream);
00469   copy_HtoD<float>(intRadSH, intRadS, atomStorageSize, stream);
00470 }


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

Generated on 24 Feb 2020 for NAMD by  doxygen 1.6.1