I have questions about : CUT_DEVICE_INIT and CUT_EXIT.
What are they for ?
Do you always have to use them in your program ?

For the CUT_DEVICE_INIT and CUT_EXIT take a look in “cutil.h”

In short. CUT_DEVICE_INIT will look if there is a device present. And if so if it is able to run cuda code.

and the CUT_EXIT is for letting the user press enter when finished

“Press ENTER to exit…”

Like you see in all the examples.

But no they are not needed. although the first one is good to check if your hardware is ok.

All functions in cutil.h are purely convenience and error checking macros. They are not part of CUDA. CUDA 1.1 SDK has a cutil_readme.txt that explains this.


Thanks for your help. :)

It seems that CUT_DEVICE_INIT initializes only the first device. What if I have two graphic cards (say, a GeForce 8600GTS and a TESLA C870) and I want to compute in the GPU 1 (not 0)?

In the CUDA 2.0 SDK we modified CUT_DEVICE_INIT so that you can specify the device to run on from the command line, e.g. “-device=1”.