c++ - CUDA 错误 : too much shared data (0x4018 bytes, 0x4000 最大值): where do the extra 0x18bytes come from?

标签 c++ pointers cuda size

我正在尝试实现这个 CUDA 示例: http://devblogs.nvidia.com/parallelforall/efficient-matrix-transpose-cuda-cc/ 因为我有 0x4000 字节可用,所以我尝试使用 TILE_DIM = 128 , 所以

<strong>shared</strong> unsigned char tile[TILE_DIM][TILE_DIM];

大小为 0x4000 字节 = 16384 字节 = 128*128 字节。

但是,这给了我以下错误:

CUDACOMPILE : ptxas error : Entry function '_Z18transposeCoalescedPh' uses too much shared data (0x4018 bytes, 0x4000 max)

所以我在共享内存中有 0x18 (24) 个额外字节。它们来自哪里,是否有可能将它们移除?

我可以针对计算版本 2.0+ 进行编译以消除错误(我的硬件是 3.0 版),但这会使用 L1 缓存中的内存,据称速度较慢。

最佳答案

So I have 0x18 (24) extra bytes in shared memory. Where do they come from, and is it possible to remove them?

引用programming guide :

The total amount of shared memory required for a block is equal to the sum of the amount of statically allocated shared memory, the amount of dynamically allocated shared memory, and for devices of compute capability 1.x, the amount of shared memory used to pass the kernel's arguments (see __noinline__ and __forceinline__).

只要是为cc1.x架构编译,就无法取消使用共享内存来承载内核参数。

我认为您已经指出的解决方案是针对 cc2.0 或 cc3.0 架构进行编译。目前尚不清楚您为什么不想这样做。

关于c++ - CUDA 错误 : too much shared data (0x4018 bytes, 0x4000 最大值): where do the extra 0x18bytes come from?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26504493/

相关文章:

C++ 链接错误与 linux 上的多个定义

c++ - 使用 typealias 代替定义中类中定义的 typedef

c++ - 如何从 std::strings 数组中检索特定元素作为 LPCSTR?

c - 跟踪C中链表的头节点

python - 像python中的c一样的指针类型转换

c++ - 是什么导致我的方法中堆损坏?

algorithm - 使用 CUDA 绘制三角形

cuda - 使用 Mathematica CUDADot 时提高 GPU 的利用率?

CUDA:没有 CUDA 工具包的 nvcc

c - 是否可以将 C 指针初始化为 NULL?