[Solved]add CUDA
-
thank you ,
and
what's the settings for compiler.cu like since it requires nvcc ?or how to combine other .o file in Qt?
-
[quote author="devroyc" date="1293824069"]thank you ,
and
what's the settings for compiler.cu like since it requires nvcc ?or how to combine other .o file in Qt?[/quote]
With some clever QMAKE_EXTRA_COMPILERS black magic. See
http://doc.qt.nokia.com/latest/qmake-environment-reference.html#customizing
http://forums.nvidia.com/index.php?showtopic=29539 -
There's also some additional information here: http://www.qtcentre.org/wiki/index.php?title=Undocumented_qmake#Custom_tools
-
Two comments:
-
Regarding using Cuda from Qt. That was a major concern of the project
I am consulting on, and it turns out to be straightforward. The Cuda code
that I have written is designed to be used from a Qt application. It (the Cuda
portion) is compiled in its own project directory using nvcc where appropriate
and .o files are created. These are packaged using ar into a lib<whatever>.a
archive. Then, in a different directory (for what that is worth) I have my Qt
application, which uses qmake and a <whatever>.pro file, and it adds the
location of the lib<whatever>.a, a -l<whatever> to the library switches, and a
reference to the location and name of the cuda run time libraries. It all seems
to compile and run just fine. -
Regarding the comment on OpenCL vs Cuda. Although OpenCL may be the
future, it may not be as well. Cuda is far more mature and is used, my guess,
for 95% of all serious GPU development. There are good reasons why OpenCL
might actually be a little nicer for development, but at an inherently slower speed.
It all depends on how practical your needs are. If you need to write something
that works today, and is more mature, and dont mind using Nvidia (and I like Nvidia),
then Cuda is the way to go. Ultimately, in the long run, well we will have to see.
They are very similar, but not identical, but its not too bad. If you learn one, the
other will be straightforward.
MW
-