In the new CUDA SDK 2.3 example there is a code section like this:
if (sizeof(int) == sizeof(void *))
{
// in this branch we use compilation with parameters
...
} else
{
// compile with default parameters
}
This is completely unnecessary, IMO. Compilation with parameters works perfectly fine on my 64 bit system, even though sizeof(int) isn’t sizeof(void).
I think the reason is a quite ugly workaround for this:
int jitLogBufferSize = 1024;
jitOptVals[0] = (void *)jitLogBufferSize;
But this works fine even if the sizes don’t match, as this kind of casting takes the sizes of the arguments into account, and drops precision or sign-extends based on this; even this would be correct
unsigned char jitLogBufferSize = 255;
jitOptVals[0] = (void *)jitLogBufferSize;