Beginner CUDA Programming Question

I am getting started with CUDA programming, mainly to use the cuFFT libraries for rapid image processing and fourier transforms on the GPU.

I am looking to accomplish the following: capture an image from a Point Grey camera, and apply a fast fourier transform (FFT) to the image on the GPU.

I have a camera driver program already programmed in c++ with Flycapture (camera) and OpenCV libraries that will capture an image and convert the image to a usable 2D matrix. The CUDA program I am looking to create will include the FFT algorithm I am looking to implement.

My main question: is it considered bad programming practice to include everything into a single CUDA file? Should the camera driver program (.cpp) be kept separate from the FFT program (.cu), and then compiled together? Does this make a big difference whether they are separate files? If kept separate, can someone point me in the right direction for sharing image data between the c++ and CUDA file?

Hi,

Please make sure you implement cuda kernel with .cu file.
And you can choose a single .cu file or separate files with personal preference.
Generally, we choose one for better maintenance.

I will answer the data transfer question in another topic.
https://devtalk.nvidia.com/default/topic/1014332/jetson-tx2/data-sharing-between-c-and-cuda-programs/

Thanks.