Reputation: 111
I am writing an opencl kernel with many helper function in the same .cl file. I want to package the helper function into a header file. I read the spec and see I should pass -I Dir
in the clCreateProgram
function call.
I am still confused here. When I crate a A.h file to be included in the .cl file. Should I create a corresponding A.c file or A.cl file? If I create a corresponding A.c file, some routines in .c file and .cl file might be different and might make the function cannot be used directly by the kernel.
Upvotes: 2
Views: 3735
Reputation: 8494
You can have a header file and #include that in the kernel file. So to include file1.h
in kernel.cl
you need to add #include "file1.h"
and as build option pass -I.
if header file is in the same folder as kernel file or i.e. -I./include
if in the include
folder.
Upvotes: 6