Difference between revisions of "FFT Cuda"

From ElphelWiki
Jump to: navigation, search
Line 17: Line 17:
 
To use the GPU memory use cudaMalloc.
 
To use the GPU memory use cudaMalloc.
  
How to copy from 'CPU' memory to 'GPU' memory?
+
=== How to copy from 'CPU' memory to 'GPU' memory? ===
 +
 
 +
cudaMemcpy(dstcudaMallocLocation, srchostTiffLocation, counthost, cudaMemcpyHostToDevice)

Revision as of 18:13, 4 November 2010

Input

  • Image is presented in TIFF file structure
  • Array of, FFT of kernels (64x64)

Todo

  • Take a windows 128x128, step by 32 pixels
  • Make a FFT (DFT_2D)
  • Get nth-kernel, pad 32px zero's to each side
  • Multiply FFT with kernel
  • Inverse FFT of the result
  • Save 128x128 window to the n'th position in the TIFF


Knowledge required

CuFFT is modeled after FFTW. To create a new operation we start with cufftPlan2d. The actual operation happens wth cufftExecC2C. cufftExecC2C takes input and output data, respectivily idata and odata in GPU memory.

To use the GPU memory use cudaMalloc.

How to copy from 'CPU' memory to 'GPU' memory?

cudaMemcpy(dstcudaMallocLocation, srchostTiffLocation, counthost, cudaMemcpyHostToDevice)