Reputation: 131547
The CUDA programming guide gives non-device-specific maxima for grid dimensions in blocks: 2^31 - 1 for the x dimension, 2^16 - 1 for the y and z dimensions (table 15, as of CUDA 11.3).
My question: Where are these values defined, in code? I also looked at the driver API entry on cudaLaunchKernel, and it doesn't mention such constants either. I searched for 65535, for "<< 16" and for "<<16" in the CUDA header files, and no luck there either.
Upvotes: 0
Views: 120
Reputation: 151869
They are not defined in code. They are a property of the device, the checking is at runtime (this is easily demonstrable), and the checking is done against properties retrieved from the device in question.
You can study the deviceQuery
sample code to see how it might work.
Upvotes: 3