Skip to main content
2 of 4
deleted 11 characters in body
Cosmo
  • 950
  • 1
  • 14
  • 28

CUDA "invalid argument" error when starting kernel

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?

Cosmo
  • 950
  • 1
  • 14
  • 28