I am trying to compile OpenCL kernels on OS X. Everything is ok when there are just a few lines. However, after the code grows over 1.5k lines, clGetProgramBuildInfo with CL_PROGRAM_BUILD_LOG flag returned "Compile Server Error." every time. I googled but found nothing about it. Could anyone help me?
-
1Altough it is unlikely, you might run into the maximal allowed kernel length. Better check the compiled programm and its size. 1500 lines of OpenCL code compilation could lead to a large blow off.Christian– Christian2015-05-03 05:44:05 +00:00Commented May 3, 2015 at 5:44
-
@Christian Well, maybe you are right. Could you please tell me the way to check whether it's over the maximum allowed.Zhe Chen– Zhe Chen2015-05-04 04:17:51 +00:00Commented May 4, 2015 at 4:17
-
One way could be to compile the host programm on the command shell and check the code length with an editor. Just to make it simple, you might also check out some lines, compile it, add some more lines, compile again, ... At one point you compilation might fail due to the size, or you found your error.Christian– Christian2015-05-04 11:02:52 +00:00Commented May 4, 2015 at 11:02
2 Answers
You can learn the meaning of OpenCL error codes by searching in cl.h. In this case, -11 is just what you'd expect, CL_BUILD_PROGRAM_FAILURE. It's certainly curious that the build log is empty. Two questions:
1.) What is the return value from clGetProgramBuildInfo?
2.) What platform are you on? If you are using Apple's OpenCL implementation, you could try setting CL_LOG_ERRORS=stdout in your environment. For example, from Terminal:
$ CL_LOG_ERRORS=stdout ./myprog
It's also pretty easy to set this in Xcode (Edit Scheme -> Arguments -> Environment Variables).
Please find the original answer by @James
Comments
This unhelpful error message indicates that there is bug in Apple's compiler. You can inform them of such bugs by using the Apple Bug Reporting System.