In CUDA programs, you can place only the GPU kernels in .cu files while keeping the rest of your code in .cpp files.

This organization confines CUDA-specific code to a limited set of files, making the overall program easier to maintain and understand.

File Structure

This example uses the following two files:

kernel.cu