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?
Share
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, andintdata types have predictable sizes on all platforms that CUDA supports (8, 16, and 32 bits respectively). However the size oflongvaries from platform to platform.