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 106 of file CudaPmeSolverUtil.C.

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

00106                                 {
00107   cudaCheck(cudaSetDevice(deviceID));
00108         cufftCheck(cufftDestroy(forwardPlan));
00109         cufftCheck(cufftDestroy(backwardPlan));
00110   if (dataSrcAllocated) deallocate_device<float>(&dataSrc);
00111   if (dataDstAllocated) deallocate_device<float>(&dataDst);
00112 }


Member Function Documentation

void CudaFFTCompute::backward (  )  [virtual]

Implements FFTCompute.

Definition at line 158 of file CudaPmeSolverUtil.C.

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

00158                               {
00159   cudaCheck(cudaSetDevice(deviceID));
00160   if (backwardType == CUFFT_C2R) {
00161     // if (ncall == 1) {
00162     //   if (plantype == 1)
00163     //     writeComplexToDisk((float2 *)data, 33*64*64, "data_fx_by_bz.txt");
00164     //   else
00165     //     writeComplexToDisk((float2 *)data, 33*64*64, "data_fx_fy_fz_2.txt");
00166     // }
00167 
00168     cufftCheck(cufftExecC2R(backwardPlan, (cufftComplex *)dataDst, (cufftReal *)dataSrc));
00169 
00170     // if (ncall == 1)
00171     //   if (plantype == 1)
00172     //     writeRealToDisk(data, 64*64*64, "data_bx_by_bz_1D.txt");
00173     //   else
00174     //     writeRealToDisk(data, 64*64*64, "data_bx_by_bz_3D.txt");
00175   } else if (backwardType == CUFFT_C2C) {
00176     // nc2cb++;
00177     // if (ncall == 1 && nc2cb == 1)
00178     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_fz_fx_fy_2.txt");
00179     // else if (ncall == 1 && nc2cb == 2)
00180     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_fy_bz_fx.txt");
00181     cufftCheck(cufftExecC2C(backwardPlan, (cufftComplex *)dataDst, (cufftComplex *)dataSrc, CUFFT_INVERSE));
00182     // if (ncall == 1 && nc2cb == 1)
00183     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_bz_fx_fy.txt");
00184     // else if (ncall == 1 && nc2cb == 2)
00185     //   writeComplexToDisk((float2 *)data, 33*64*64, "data_by_bz_fx.txt");
00186   } else {
00187     cudaNAMD_bug("CudaFFTCompute::backward(), unsupported FFT type");
00188   }
00189 }

void CudaFFTCompute::forward (  )  [virtual]

Implements FFTCompute.

Definition at line 123 of file CudaPmeSolverUtil.C.

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

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


The documentation for this class was generated from the following files:
Generated on Sat Sep 23 01:17:19 2017 for NAMD by  doxygen 1.4.7