I can't seem to find an answer to this simple question in the Cuda Programming Guide: When compiling a kernel with nvcc, What size integer is declared by short, int, long, and long long? Does it depend on my host architecture, so I should use int16_t, int32_t, and int64_t, or is it always a fixed size?
It depends on the host compiler. Specifically, nvcc
's definition of those types will agree with the host compiler's representation.
In practice, the char
, short
, and int
data types have predictable sizes on all platforms that CUDA supports (8, 16, and 32 bits respectively). However the size of long
varies from platform to platform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With