I think something has changed in the OpenCL.jl package about how to link header files to GPU kernels. It’s either that or I’m missing something crucial about how julia looks for packages and header files and what needs to be included in the path.
I have some code that is about 1.5 years old (v0.6 or so) with the OpenCL.jl package. It works great. The generic format is that I have a kernel defined like
kernelsource = "
#include <foo.cl>"
using OpenCL
device, ctx, queue = cl.create_compute_context()
p = cl.Program(ctx, source=kernelsource)
program = cl.build!(p) #crashes here
with foo.cl
only defined as
//**contents of foo.cl**
__kernel void plusone(
__global int* c)
{
unsigned int i = get_global_id(0);
c[i] = i+1;
}
I updated and then rerun this code with v1.4. It crashes while trying to build the program:
Couldn't compile kernel:
1 : #include "foo.cl"
2 :
With following build error:
<program source>:1:10: fatal error: 'foo.cl' file not found
#include "foo.cl"
^
OpenCL Error: | [CL_DEVICE_NOT_AVAILABLE] : OpenCL Error : Error: Build Program driver returned (10015) |
ERROR: LoadError: OpenCL Error: | OpenCL Warning : clBuildProgram failed: could not build program for 0x1024500 ([my GPU]) (err:-2) |
CLError(code=-11, CL_BUILD_PROGRAM_FAILURE)
The same is true if I use v1.x. If I copy in the contents of the kernel, it runs, but I need to call a different header file to use a separate library. Like I said, I used to be able to do this without any special pathing requirements.
Clearly, the program is having a hard time finding the header file that I’m pointing to. I have veriried that the file is actually there and at the correct address (i.e., copying the file’s location and trying to open it with emacs or vim or nano opens the correct file. It doesn’t seem to matter what style of address I put there.
I looked through the code and tried to find if there was any flags that I could define for making the program, but all I could find was program = cl.build!(p,options=" -I [path]")
but this did not make things any better.
How do you include header files into GPU kernels for OpenCL?
Edit: running readdir()
in julia gives
2-element Array{String,1}:
"foo.cl"
"gtest.jl"
So the file is definitely there.