I’m trying to build a simple kernel, but it fails when I use write_imageui. The kernel should just copy an image to another. I know that there isn’t probably any sense in making such kernel, but I’m just trying to learn the language. Anyway, here is the kernel:
If I put it like above, clBuildProgram gives me error code -42 (btw how can I determine what error that is?). But if I comment the last line out it compiles just fine. Any idea what is going on?
You could check error numbers in your system CL/cl.h header file; specifically, -42 is CL_INVALID_BINARY (and clBuildProgram() documentation is stating that this one is returned “… if program is created with clCreateWithProgramBinary and
devices listed in device_list do not have a valid program binary loaded”). I ran your kernel quickly through AMD CL compiler (easier to check for syntax errors with an existing external program), and some errors get reported, so I’d suggest you use clGetProgramBuildInfo() to check what NVIDIA compiler is going to report; also I’d check for potential errors of OpenCL calls before this one (it doesn’t seem logical for above error to get reported, as you provided the kernel source, so I guess you used clCreateProgramWithSource() when creating the program object).