On Sun, Feb 6, 2011 at 10:19 AM, Nikos Chantziaras <rea...@arcor.de> wrote:
<SNIP>
>
>> As for the C vs C++ issue, I only say C because the NVidia nvcc
>> compiler seems to be primarily a C compiler. It's not until you get to
>> Appendix D in the programming guide that they even mention C++ in the
>> context of CUDA.
>
> I started studying CUDA development recently too.  While reading the
> examples that come with the SDK, I found out that they're all C++ though.
>  The reason you can use C is that C is actually valid C++ (most of the
> time.)
>

OK, I suspect I'm being limited by an include file which was supplied
with the exercises for the book CUDA By Design. Nice little book, easy
& fun to read, good discussion of the basics for an entry level
programmer like me. Works fine if the file compiled is main.cu, but
fails if I rename that file main.cpp.

If I can figure out what is non-C++ in those files then I'll try to
focus on being C+ compatible because it seems all these IDE tools
expect that anyway.

I glazed over looking at the SDK examples myself because they are
frankly far beyond my programming skills without some text to
understand what they are trying to accomplish.

CUDA programming itself hasn't been all that hard. I'm luck that I
have a problem to solve that I think fits it pretty well.

>
>> That said, however, my understanding of what nvcc does is that what it
>> really does breaks apart the *.cu input files into portions that are
>> sent to the CUDA compiler, and portions that are sent to gcc. I
>> suspect the gcc/host computing side can be whatever is legal for gcc.
>> All I need, as best I understand it today, is to call nvcc instead of
>> gcc.
>
> nvcc compiles into C++.  The end result is then compiled with g++ and linked
> with the CUDA libraries.  This is normally done automatically by nvcc,
> unless you use the --cuda option.  For example, to suppress that automation,
> you can compile a CUDA program with:
>
>  nvcc --cuda myprogram.cu
>
> "myprogram.cu" can be something as simple as:
>
>  int main()
>  { return 0; }
>
> This will "compile" the program into "myprogram.cu.cpp".  This can then be
> compiled manually with g++:
>
>  g++ myprogram.cu.cpp -L/opt/cuda/lib64/ -lcudart
>
> It's just that nvcc does that automatically for you.
>

Really good info, thanks!

As for qt-creator, I tried the binary installer but after installing
it didn't run complaining that it cannot be mixed with the Qt
libraries that are on my system. I'll stick with the 1.3 version for
now and wait for portage to catch up.

Cheers,
Mark

P.S. - If you (or anyone else) wants to talk about CUDA, contact me
off list. I'm always interested and available. - MWK

Reply via email to