Skip to content Skip to sidebar Skip to footer

Pyopencl, Opencl, Can't Build Program On Gpu

I have a piece of kernel source which runs on the G970 on my PC but won't compile on my early 2015 MacBook pro with Iris 6100 1536MB graphic. platform = cl.get_platforms()[0] devic

Solution 1:

You should try to query the error of the build in such cases. Another thing you can do in similar, kernel code errors is that you can use offline compilers. Every OpenCL implementer has offline compiler.

You can find Intel's OpenCL offline compiler here: https://software.intel.com/en-us/articles/programming-with-the-intel-sdk-for-opencl-applications-development-tools

AMD has a tool called CodeXL, in which you can also do offline compilation to see if your kernel code compiles.

Here is the ARM OpenCL offline compiler: https://developer.arm.com/products/software-development-tools/graphics-development-tools/mali-offline-compiler/downloads

Intel's support is up to OpenCL 2.1 while ARM supports up until 1.1. So, you can choose any of them to compile your kernel code to find out bugs or errors easily.

The problem in your kernel is the following line:

float v[dim];

OpenCL C specification does not allow variable length arrays and the offline compiler gives the following error:

ERROR: <source>:22:12: error: variable length arrays are not supported in OpenCL

You can fix that line to overcome the error and from now on, you can check if your kernel can be compiled with the offline compiler.

EDIT: In the specification, there is a footnote that explains the variable length arrays are not supported. You can see it here:

https://www.khronos.org/registry/OpenCL/specs/opencl-2.0-openclc.pdf#page=31

Post a Comment for "Pyopencl, Opencl, Can't Build Program On Gpu"