关于CUDA核函数运行限制的问题
我使用CUDA对一张图片进行简单的操作:全部涂成一种颜色.代码如下:
int rx = 800;
int ry = 600;
float* image;
size_t image_size = rx*ry*sizeof(float)*3;
cudaMalloc((void**)&image, image_size);
fill_color<<<rx*ry, 1>>>(image);
......
核函数:
__globle__
void fill_color(float* image)
{
int idx = 3*blockIdx.x;
image[idx + 0] = 1.0f;//r
image[idx + 1] = 0.0f;//g
image[idx + 2] = 1.0f;//b
}
结果测试表明,当分辨率rx*ry小于65535时,运行正常.当大于这个数,最后生成的图片就是全黑的.
我用的是模拟设备运行的程序(没钱买显卡...).设备的属性如下:
The CUDA device count is 1
device name:Device Emulation (CPU)
total global memory:-1
shared memory per block:16384
regs per block:8192
warp size:32
mem pitch:262144
max threads per block:512
max threads dim:512*512*64
max grid size:65535*65535*1
total const memory:65536
major version:-1
minor version:-1
clock rate:1350000
texture alignment:256
请教发生这种问题是以上哪个容量到达上限了?或者是其他问题?
另外问一下,grid,block,thread这几个东西和他们对应的硬件设备是什么关系?