printf函数在OpenCL内核中不起作用 [英] printf function doesn't work in OpenCL kernel

查看:1591
本文介绍了printf函数在OpenCL内核中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在PS3上调试OpenCL内核代码。这是代码:

  #pragma OPENCL EXTENSION cl_khr_byte_addressable_store:enable 

int offset(){
return'A' - 'a';
}

__kernel void tKernel(__全局unsigned char * in,__global unsigned char * out){
size_t i;
printf(var); (i = 0; i< 10; i ++)
out [i] = in [i] + offset();
}

在第18页的4.3.3节中的IBM OpenCL_guide.pdf中有用printf方法描述调试内核。
所以我将printf函数添加到我的内核并尝试测试。但是OpenCL编译给了我这个错误:



IBM_OpenCL_kernel.cl,第9.15行:1506-766(S)通用字符名称?不能在标识符的允许范围内。



我还导出了 LD_LIBRARY_PATH变量。任何人都可以有此问题? / p>

解决方案

我不知道IBM的实现,但是printf()是一个非标准的OpenCL函数。在AMD平台上,您必须通过以下方式启用扩展:

  #pragma OPENCL EXTENSION cl_amd_printf:enable 
<在printf()之前,code>

。也许扩展需要在IBM平台上启用?



(更新)从此页面,可能使用的扩展名称可能是cl_intel_printf,因此请尝试:

  #pragma OPENCL EXTENSION cl_intel_printf:enable 


Hi I trying to debug OpenCL kernel code on PS3. Here is the code:

#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable

int offset() {
    return 'A' - 'a';
}

__kernel void tKernel(__global unsigned char *in, __global unsigned char *out) {    
    size_t i;
    printf("var");
    for (i = 0; i < 10; i++)
        out[i] = in[i] + offset();
}

In IBM OpenCL_guide.pdf in section 4.3.3 on page 18, there are describe debugging kernel with printf method. So I add the printf function to my kernel and trying test it. But OpenCL compile gave me this error:

"IBM_OpenCL_kernel.cl", line 9.15: 1506-766 (S) The universal character name "?" is not in the allowable range for an identifier.

I also have exported LD_LIBRARY_PATH variable. Can anyone have this problem?

解决方案

I don't know about the IBM implementation, but printf() is a non-standard OpenCL function. On the AMD platform, you have to enable the extension through:

#pragma OPENCL EXTENSION cl_amd_printf : enable

before printf() will work. Perhaps an extension needs to be enabled on the IBM platform as well?

(Update) From this page, the possible extension name to use might be cl_intel_printf, so try:

#pragma OPENCL EXTENSION cl_intel_printf : enable

这篇关于printf函数在OpenCL内核中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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