What is the most easy to understand/efficient etc. code organization for cuda. After some investigation i found that cuda function declarations should be in .cuh file and implementations reside in .cu file and kernel function implementations in .curnel files. Other c++ stuff in .cpp and .h files ordinarily. Recently i posted a question visual studio .cu file shows syntax error but compile successfully . Is this organization correct? where .cpp calls .cu and it calls kernel function that in .curnel.
As an example, suppose to have a GPU-based FDTD code. I usually do the following (Visual Studio 2010).
extern "C" void E_update(...)
function which contains the kernel <<< >>>
call;extern "C" void E_update(...)
prototype;__global__ void E_update_kernel(...)
function.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With