How to manage VSC++ project files to use with CUDA? Where to put CUDA code? In which files?

Hello,

I am trying to write some libs using CUDA architecture. However program will use GP-GPU only if it will be found on computer.

My question is how to write an application that is a normal C++ program, but uses CUDA if it is possible.

All tutorials and info are using .cu files. But I am just using lets say msvcc and I place my code in *.h and *.cpp files.

Lets say i have a such a code:

int CountSomething(*arg1,*arg2,*result)

{

  if (HasCUDA()) return CudaFunction(*arg1,*arg2,*result);

  else return CPUFunction(*arg1,*arg2,*result); 

}

How sould the project look like? Should I make header and .cu file for CUDA functions, and include the header in my host code?

Can I call CUDA function from a normal *.h or *.cpp file?

Should I make *.dll’s with CUDA code, and then call it from the host code?

What is the proper/best way of solving this?

Thanks for any help,

Best Regards