编程 cuda 内核时整数的大小是多少
我似乎无法在 Cuda 编程指南中找到这个简单问题的答案:When compiling a kernel with nvcc, What size integer is statements byshort, int, long, and long long?它是否取决于我的主机架构,所以我应该使用 int16_t、int32_t 和 int64_t,还是它始终是固定大小?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于主机编译器。具体来说,nvcc 对这些类型的定义将与主机编译器的表示一致。
实际上,
char
、short
和int
数据类型在 CUDA 支持的所有平台(8、16 和 32 位)上具有可预测的大小分别)。然而,long
的大小因平台而异。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
, andint
data types have predictable sizes on all platforms that CUDA supports (8, 16, and 32 bits respectively). However the size oflong
varies from platform to platform.