【问题标题】:“invalid configuration argument” error when calling CUDA kernel调用 CUDA 内核时出现“无效的配置参数”错误
【发布时间】:2018-01-07 09:42:56
【问题描述】:

我有 GeForce 620M,我的代码是:

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());     
}

我明白了:

配置参数无效。

可能是什么原因?

【问题讨论】:

  • 原因可能取决于Number_AA_GPU的值

标签: cuda gpu


【解决方案1】:

内核配置参数是&lt;&lt;&lt;...&gt;&gt;&gt; 符号之间的参数。

您的 GeForce 620M 是compute capability 2.1 设备。

计算能力 2.1 设备 is limited to 65535 当您为每个网格参数(您要传递的两个参数中的第一个)传递一个一维参数时。

由于您传递的另一个参数 (256, threadsPerBlock) 肯定是在界内,我断定您的第一个参数超出了界:

int blocksPerGrid = Number_AA_GPU / threadsPerBlock; 

Number_AA_GPU 要么大于 65535*256(大于等于 65536*256 会触发失败),要么为零(实际上Number_AA_GPU 小于 256 会失败,因为整数除法),或者是负数.

如果您提供完整的示例,将来您可以编写更容易理解的问题。在这种情况下,告诉我们Number_AA_GPU 是什么可以让我的答案更加明确。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-24
    • 1970-01-01
    • 1970-01-01
    • 2014-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多