我正在尝试实现这个 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?
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/