atom_inc/atomic_inc 中的 cl_out_of_resources 错误
我在我的一个内核中使用atom_inc。或多或少像这样:
kernel exampleKernel(
global volatile int * x,
global const int maxX,
global const int * buf1,
global const int * buf2
)
{
if(x < maxX)
{
int y = atom_inc(x);
buf2[y] = buf1[get_global_id(0)];
}
}
但是当我调用它时,它给了我一个 CL_OUT_OF_RESOURCES 错误。 将atom_inc(x) 替换为0 可以解决这个问题……但会使内核变得无用。
有什么想法会导致该错误吗?
编辑:我已经在程序中包含了这些扩展:
#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable
Edit2:实际上我用以下内容初始化x:
kernel.setArgs(0,0);
我必须在这个地方使用内存对象吗?
亲切的问候, 弗洛里安
i am using atom_inc in one of my kernels. More or less like this:
kernel exampleKernel(
global volatile int * x,
global const int maxX,
global const int * buf1,
global const int * buf2
)
{
if(x < maxX)
{
int y = atom_inc(x);
buf2[y] = buf1[get_global_id(0)];
}
}
But it gives me an CL_OUT_OF_RESOURCES error when i call it.
Replacing atom_inc(x) with 0 resolves this problem ... but makes the kernel useless.
Any ideas what can cause that error?
Edit: i have included these extensions in the program:
#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable
Edit2: actually i initialize x with:
kernel.setArgs(0,0);
Do i have to use a memory object in this place?
Kind Regards,
Florian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊...好吧...看来在这种情况下你必须使用内存对象。
这里的解决方案是创建一个单元素 OpenCL 缓冲区并将其设置为第一个参数。
我将这个问题和答案留在这里,以免其他人犯同样的错误。
Ah ... ok ... it looks like you have to use memory objects in this case.
The solution here was to create a one element OpenCL buffer and set it as the first argument.
I'll leave this question and answer here so that others might not make the same fault.