i am developing with a Geforce 260M with compute capability level 1.1
It is strange that it is possible to use classes because the documentation says, that this is only possible with compute level 2.0.
Snippet of programming guide
Following code runs on the gpu properly on my machine with cc 1.1! How can that be - is the documentation wrong?
__host__ __device__ void render_scene(const unsigned int& tid, uchar4 *pixelBuffer, int threadNumber)
pinhole.render_scene(tid, pixelBuffer, threadNumber);
Yes, simple classes have been (unofficially) supported in CUDA for a long time. They are mainly a compile-time feature and don’t require run-time support. Fermi adds support for function pointers, which will be used in the future to support virtual functions.
does that mean that the code will be exactly the same either i use “struct” or “class” because the compiler will interpret it in the same way with capability 1.1?
or are there some speed issues?
class and struct keywords are pretty much the same thing in C++, they only differ semantically by the default visibility qualifier (private in class, public in struct). You can even mix inheritance between structs and classes.
It’s a common programming practice to use structs when the object is simple and has no methods and class otherwise, but it’s not enforced by the language and I believe it doesn’t make a difference for CUDA.
thanks a lot! my questions are answered now