编程 cuda 内核时整数的大小是多少

发布于 2024-09-27 04:16:41 字数 195 浏览 0 评论 0原文

我似乎无法在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不打扰别人 2024-10-04 04:16:41

这取决于主机编译器。具体来说,nvcc 对这些类型的定义将与主机编译器的表示一致。

实际上,charshortint 数据类型在 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, 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文