Assembling a CUDA Project
I have been scanning the site for questions regarding large CUDA projects and I have found some good replies, anyway I have some开发者_StackOverflow中文版 doubts yet.
My program, for now(it is still half-way from being complete), outputs some arrays, that are then input for Thrust library functions.
So my main doubt is:
1-Given that I am using CUDA C, I have thrust functions declared as extern "C". I was unsure of the correct way to declare those functions in the header files, and after some googling I found the following code, which I wanted to be sure is right:
extern "C" {
void compact(float*intxc,float*intyc,float*intzc);
void sort(float*intxc,float*intyc,float*intzc);
}
2- I have seen some posts here in the forum, that used "Main.cpp" as the main file, is it wrong to use a "Main.cu" file or is it indifferent?
Edit: After some thought(and advice), I really think the older questions were a bit dull.
Thanks in advance and thanks talonmies for the advice
There's no need to declare your functions extern "C" in the most recent (post 2.3) versions of CUDA. Besides, those functions are just C functions, they have nothing to do with CUDA.
You can have your main function in a .cu file or a .cpp file. If you do the former, it must be compiled by nvcc. If you do the latter, it should be compiled by your C++ compiler. The file need not be named "Main".
精彩评论