I have a problem when kernel launches. I launch a kernel with a grid size of (3000000, 16), and CUDA reports an "invalid argument" runtime error here. I tried different maxPixelCount
value and found: when maxPixelCount
is 200000, the error is reported, while when it's 50000, it continues without error.
dim3 dimGrid(maxPixelCount, imageCount);
printf("grid: %d * %d * %d", dimGrid.x, dimGrid.y, dimGrid.z);
mcudaGetGrayDataKernel <<< dimGrid, 1 >>> (deviceDestDataPtrs, deviceImageDataPtrs, deviceSizes);
cudaStatus = cudaGetLastError();
if (cudaStatus != cudaSuccess) {
printf("cuda start kernel error\n%s", cudaGetErrorString(cudaStatus);
goto Error;
}
I checked the max grid size to ensure my card's ability, using the following sentence:
printf(" - max grid size: %d * %d * %d\n",
prop.maxGridSize[0],
prop.maxGridSize[1],
prop.maxGridSize[2]);
I got the following message:
- max grid size: 2147483647 * 65535 * 65535
I think this means my dim is in the proper range. But why does the error appears?
My IDE is Visual Studio 2013
This problem has been solved. To reach the max limit of grid size, the Device
->Code Generation
option has to be set to the proper version. For my GPU I modified it to compute_30,sm_30
.