OpenCl代码可在一台机器上运行,但是我在另一台机器上得到CL_INVALID_KERNEL_ARGS [英] OpenCl code works on a machine but I am getting CL_INVALID_KERNEL_ARGS on another

查看:110
本文介绍了OpenCl代码可在一台机器上运行,但是我在另一台机器上得到CL_INVALID_KERNEL_ARGS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码,该代码在一台计算机上运行良好,但是当我尝试在另一台具有更好显卡的计算机上运行该代码时,我会出错:

I had the following code, which works well on a machine but I when I try to run it on another machine with better graphics card I am getting errors:

global[0] = 512; global[1] = 512;
local [0] = 16; local [1] = 16;
ciErrNum = clEnqueueNDRangeKernel(commandQueue, myKernel, 2, NULL, global, local, 0, NULL, &event);

错误:

Error @ clEnqueueNDRangeKernel: CL_INVALID_KERNEL_ARGS
Error @ clWaitForEvents: CL_INVALID_KERNEL_ARGS

有什么问题吗?

推荐答案

您要传递的缓冲区对象有多大? __constant参数是从单独的内存空间分配的,而不是从全局内存分配的,因此您可能已经用完了恒定内存.

How large are the buffer objects you are passing? __constant arguments are allocated from separate memory space and not from global memory so therefore you have probably ran out of constant memory.

规范要求,在完整的配置文件中,设备必须至少支持4个__constant自变量,总大小为64kB.在嵌入式配置文件中,它已降至1kB.

The spec mandates that in full profile the device must support at minimum 4 __constant arguments with 64kB total in size. In embedded profile it's dropped to 1kB.

您可以通过使用clGetDeviceInfo检查CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE来查询可用的恒定内存量.您的设备最有可能超出此最低要求.

You can query the amount of constant memory available by checking the CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE using clGetDeviceInfo. Most likely your devices support way more than this minimum requirement.

在大多数情况下,如果可以的话,应该使用常量缓冲区,因为它通常比全局内存快很多.

In most cases you should use the constant buffer if you are able as in general it is quite a lot faster than global memory.

将来,您应该提供有关您问题的更多信息.因为如果错误是CL_INVALID_KERNEL_ARGS,则真的需要知道内核的参数是什么.

In future you should provide more information on your question. Because if the error is CL_INVALID_KERNEL_ARGS one really needs to know what are the arguments to your kernel.

这篇关于OpenCl代码可在一台机器上运行,但是我在另一台机器上得到CL_INVALID_KERNEL_ARGS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆