Difference between revisions of "FFT Cuda"
From ElphelWiki
(3 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
* Inverse FFT of the result | * Inverse FFT of the result | ||
* Save 128x128 window to the n'th position in the TIFF | * 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) | ||
+ | |||
+ | === How to open a TIFF file? === | ||
+ | Start with: | ||
+ | * TIFFOpen | ||
+ | * TIFFReadRGBAImage | ||
+ | * Copy Host memory to GPU memory | ||
+ | |||
+ | === How to write a new TIFF file? === | ||
+ | Start with: | ||
+ | * Copy GPU memory to Hostmemory | ||
+ | * TIFFOpen | ||
+ | * TIFFWriteTile |
Latest revision as of 17:23, 4 November 2010
Contents
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)
How to open a TIFF file?
Start with:
- TIFFOpen
- TIFFReadRGBAImage
- Copy Host memory to GPU memory
How to write a new TIFF file?
Start with:
- Copy GPU memory to Hostmemory
- TIFFOpen
- TIFFWriteTile