clBuildProgram返回CL_BUILD_PROGRAM_FAILURE,但没有发生错误

时间:2015-06-29 07:46:40

标签: opencl

我的程序在我的机器上运行良好。用户遇到奇怪的错误,目前我不知道如何调试。

clBuildProgram返回-11,表示CL_BUILD_PROGRAM_FAILURE

使用clGetProgramBuildInfo致电CL_PROGRAM_BUILD_STATUS,返回CL_SUCCESS,构建状态为CL_BUILD_SUCCESS

使用clGetProgramBuildInfo致电CL_PROGRAM_BUILD_LOG,它会返回CL_SUCCESS,并在下方粘贴日志:

Compilation started
1:817:22: warning: array index -1 is before the beginning of the array
1:315:5: note: array 'event' declared here
1:884:20: warning: array index -1 is before the beginning of the array
1:315:5: note: array 'event' declared here
1:1095:40: warning: use of logical '||' with constant operand
1:1095:40: note: use '|' for a bitwise operation
1:1095:69: warning: use of logical '||' with constant operand
1:1095:69: note: use '|' for a bitwise operation
1:1109:42: warning: use of logical '||' with constant operand
1:1109:42: note: use '|' for a bitwise operation
1:1109:69: warning: use of logical '||' with constant operand
1:1109:69: note: use '|' for a bitwise operation
1:1372:71: warning: use of logical '||' with constant operand
1:1372:71: note: use '|' for a bitwise operation
Compilation done
Linking started
Linking done
Device build started
Device build done
Kernel <sim_iterate> was not vectorized
Done.

正如构建日志所说,编译&amp;链接完成没有任何错误。那可能是什么问题?

该设备为Intel(R) Core(TM) i3-3240 CPU @ 3.40GHz

1 个答案:

答案 0 :(得分:1)

我解决了这个问题。 clBuildProgram的参数不正确。

// Before:
clBuildProgram(program, 0, 0, "-cl-single-precision-constant -cl-denorms-are-zero -cl-fast-relaxed-math", 0, 0)
// After:
clBuildProgram(program, 1, &device, "-cl-single-precision-constant -cl-denorms-are-zero -cl-fast-relaxed-math", 0, 0)