I am a new comer to the CUDA and I have no idea of the differences between .c and .cu files.
Because when I read the codes in SDK, I find that some “main” function are in .cu while some are in .c files.
So how can I decide where to put my “main” function, in .c or .cu file?
You can put ‘main’ in either place. The point is that ‘.cu’ files, compiled by [font=“Courier New”]nvcc[/font] can contain the CUDA kernels which do the work. AIUI, for the host code contained within a ‘.cu’ file, [font=“Courier New”]nvcc[/font] just does a pass-through to [font=“Courier New”]gcc[/font] anyway.
As I understand it, you need to name your file with a .cu extension if you want nvcc (the cuda compiler) to recognise it as a cuda file and compile it accordingly. You will be able to compile a .c file with nvcc too… But only the CPU code will be compiled, cuda specific functions will not be able to be compiled. Atleast, thats my understanding.