简体   繁体   中英

“invalid configuration argument” error when calling CUDA kernel

I have GeForce 620M and my code is:

int threadsPerBlock = 256;                  
int blocksPerGrid = Number_AA_GPU / threadsPerBlock; 
for(it=0;it<Number_repeatGPU;it++)
{
    Kernel_Update<<<blocksPerGrid,threadsPerBlock>>>(A, B, C, D, rand(), rand());     
}

I get:

invalid configuration argument.

What could be the reason?

The kernel configuration arguments are the arguments between the <<<...>>> symbols.

Your GeForce 620M is a compute capability 2.1 device.

A compute capability 2.1 device is limited to 65535 when you pass a 1-dimensional parameter for the blocks per grid parameter (the first of the two arguments you are passing.)

Since the other parameter you are passing (256, threadsPerBlock ) is definitely in-bounds, I conclude that your first parameter is out of bounds:

int blocksPerGrid = Number_AA_GPU / threadsPerBlock; 

ie Number_AA_GPU is either greater than 65535*256 (greater than or equal to 65536*256 would trigger a failure), or it is zero (actually Number_AA_GPU less than 256 would fail, due to integer division), or it is negative.

In the future, you can write more easily decipherable questions if you provide a complete example. In this case, telling us what Number_AA_GPU is could make my answer more definite.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM