我的内核调用因"内存不足"而失败.它大量使用了堆栈框架,我想知道这是否是它失败的原因.
使用--ptxas-options = -v调用nvcc时,它会打印以下配置文件信息:
150352 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info : Used 59 registers, 40 bytes cmem[0]
Run Code Online (Sandbox Code Playgroud)
硬件:GTX480,sm20,1.5GB设备内存,48KB共享内存/多处理器.
我的问题是分配的堆栈帧在哪里:在共享,全局内存,常量内存,......?
我尝试了每个块1个线程,以及每个块32个线程.同样"内存不足".
另一个问题:如果寄存器的总数不超过多处理器上的可用寄存器数(我的卡为32k),则只能扩大驻留在一个多处理器上的线程数.类似的东西是否适用于堆栈帧大小?
我在NVIDIA文档(http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#features-and-technical-specifications,table#12)中读到每个线程的本地内存量我的GPU是512 Ko(GTX 580,计算能力2.0).
我尝试用CUDA 6.5检查Linux上的这个限制是不成功的.
这是我使用的代码(它的唯一目的是测试本地内存限制,它不会进行任何有用的计算):
#include <iostream>
#include <stdio.h>
#define MEMSIZE 65000 // 65000 -> out of memory, 60000 -> ok
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=false)
{
if (code != cudaSuccess)
{
fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
if( abort )
exit(code);
}
}
inline void gpuCheckKernelExecutionError( const char *file, int line)
{
gpuAssert( cudaPeekAtLastError(), file, line);
gpuAssert( cudaDeviceSynchronize(), file, line);
}
__global__ void kernel_test_private(char *output)
{
int c = …
Run Code Online (Sandbox Code Playgroud)