CudaFFTCompute Class Reference

#include <CudaPmeSolverUtil.h>

Inheritance diagram for CudaFFTCompute:

FFTCompute List of all members.

Public Member Functions

 CudaFFTCompute (int deviceID, cudaStream_t stream)
 ~CudaFFTCompute ()
void forward ()
void backward ()

Detailed Description

Definition at line 29 of file CudaPmeSolverUtil.h.


Constructor & Destructor Documentation

CudaFFTCompute::CudaFFTCompute ( int  deviceID,
cudaStream_t  stream 
) [inline]

Definition at line 47 of file CudaPmeSolverUtil.h.

00047 : deviceID(deviceID), stream(stream) {}

CudaFFTCompute::~CudaFFTCompute (  ) 

Definition at line 96 of file CudaPmeSolverUtil.C.

References cudaCheck, cufftCheck, FFTCompute::dataDst, FFTCompute::dataDstAllocated, FFTCompute::dataSrc, and FFTCompute::dataSrcAllocated.

00096                                 {
00097   cudaCheck(cudaSetDevice(deviceID));
00098         cufftCheck(cufftDestroy(forwardPlan));
00099         cufftCheck(cufftDestroy(backwardPlan));
00100   if (dataSrcAllocated) deallocate_device<float>(&dataSrc);
00101   if (dataDstAllocated) deallocate_device<float>(&dataDst);
00102 }


Member Function Documentation

void CudaFFTCompute::backward (  )  [virtual]

Implements FFTCompute.

Definition at line 148 of file CudaPmeSolverUtil.C.

References cudaCheck, cudaNAMD_bug(), cufftCheck, FFTCompute::dataDst, and FFTCompute::dataSrc.

00148                               {
00149   cudaCheck(cudaSetDevice(deviceID));
00150   if (backwardType == CUFFT_C2R) {
00151     // if (ncall == 1) {
00152     //   if (plantype == 1)
00153     //     writeComplexToDisk((float2 *)data, 33*64*64, "data_fx_by_bz.txt");
00154     //   else
00155     //     writeComplexToDisk((float2 *)data, 33*64*64, "data_fx_fy_fz_2.txt");
00156     // }
00157 
00158     cufftCheck(cufftExecC2R(backwardPlan, (cufftComplex *)dataDst, (cufftReal *)dataSrc));
00159 
00160     // if (ncall == 1)
00161     //   if (plantype == 1)
00162     //     writeRealToDisk(data, 64*64*64, "data_bx_by_bz_1D.txt");
00163     //   else
00164     //     writeRealToDisk(data, 64*64*64, "data_bx_by_bz_3D.txt");
00165   } else if (backwardType == CUFFT_C2C) {
00166     // nc2cb++;
00167     // if (ncall == 1 && nc2cb == 1)
00168     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_fz_fx_fy_2.txt");
00169     // else if (ncall == 1 && nc2cb == 2)
00170     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_fy_bz_fx.txt");
00171     cufftCheck(cufftExecC2C(backwardPlan, (cufftComplex *)dataDst, (cufftComplex *)dataSrc, CUFFT_INVERSE));
00172     // if (ncall == 1 && nc2cb == 1)
00173     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_bz_fx_fy.txt");
00174     // else if (ncall == 1 && nc2cb == 2)
00175     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_by_bz_fx.txt");
00176   } else {
00177     cudaNAMD_bug("CudaFFTCompute::backward(), unsupported FFT type");
00178   }
00179 }

void CudaFFTCompute::forward (  )  [virtual]

Implements FFTCompute.

Definition at line 113 of file CudaPmeSolverUtil.C.

References cudaCheck, cudaNAMD_bug(), cufftCheck, FFTCompute::dataDst, and FFTCompute::dataSrc.

00113                              {
00114   cudaCheck(cudaSetDevice(deviceID));
00115   // ncall++;
00116   if (forwardType == CUFFT_R2C) {
00117 
00118     cufftCheck(cufftExecR2C(forwardPlan, (cufftReal *)dataSrc, (cufftComplex *)dataDst));
00119 
00120     // if (ncall == 1) {
00121     //   writeComplexToDisk((float2 *)dataSrc, (isize/2+1)*jsize*ksize, "dataSrc.txt", stream);
00122     // }
00123 
00124     // if (ncall == 1 && plantype == 2) {
00125     //   writeComplexToDisk((float2 *)data, (isize/2+1)*jsize*ksize, "data_fx_fy_z.txt", stream);
00126     // }
00127 
00128   } else if (forwardType == CUFFT_C2C) {
00129     // nc2cf++;
00130     // if (ncall == 1 && nc2cf == 1)
00131     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_y_z_fx.txt");
00132     // else if (ncall == 1 && nc2cf == 2)
00133     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_z_fx_fy.txt");
00134     cufftCheck(cufftExecC2C(forwardPlan, (cufftComplex *)dataSrc, (cufftComplex *)dataDst, CUFFT_FORWARD));
00135     // fprintf(stderr, "ncall %d plantype %d\n", ncall, plantype);
00136     // if (ncall == 1 && plantype == 1 && isize == 62) {
00137     //   writeComplexToDisk((float2 *)data, isize*jsize*(ksize/2+1), "data_fy_z_fx.txt", stream);
00138     // }
00139     // if (ncall == 1 && nc2cf == 1)
00140     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_fy_z_fx.txt");
00141     // else if (ncall == 1 && nc2cf == 2)
00142     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_fz_fx_fy.txt");
00143   } else {
00144     cudaNAMD_bug("CudaFFTCompute::forward(), unsupported FFT type");
00145   }
00146 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 18 01:17:18 2018 for NAMD by  doxygen 1.4.7