i have the following information:
Maximum number of threads per block: 512 Maximum sizes of each dimension of a block: 512 x 512 x 64
does this mean that the maximum number of threads in a 2d thread block is 512x512 which gives me a 262144 threads in every block?
if yes, then is it a good practice to have this number of threads in a a kernel of minimum 256 blocks?
no, it means that the maximum threads pr block is 512,
You can decide how to lay that out over [1 ... 512] x [1 ... 512] x [1 ... 64].
For instance 16x16 would be ok i 2D.
As for the deciding on the size of the block, lots of things come into consideration, like the amount of mem a block needs and how big a half-warp is on the hardware(i don't remember if its alwais 16 on nVidia hardware).
No, that means that your block can have 512 maximum X/Y or 64 Z, but not all at the same time. In fact, your info already said the maximum block size is 512 threads. Now, there is no optimal block, as it depends on the hardware your code is running on, and also depends on your specific algorithm.
Does it mean if we define more than the maximum possible threads/block we get an error?