My question is in a similar spirit if this question. However, what I want is to compile a shared library leveraged by OpenCL kernels that were compiled offline for the same video card. is it possible? what are the considerations in order to save the binaries for the kernels? What are the considerations for the Makefile? a simple example of how that works will be very appreciated.
Asked
Active
Viewed 242 times
1 Answers
0
It is possible.
You would need to write a simple program to create the binary and then dump it to a binary file, or use an offline compiler if your OpenCL SDK of choice provides one.
Follow this manual to embed the binary files into to your shared library: https://csl.name/post/embedding-binary-data/
Use
clCreateProgramWithBinary()
in your shared library with the embedded data objects.
As for the Makefile you can add a targets to create a kernel.bin
depending on a kernel.cl
source file using the offline compiler or self-written binary-generator. And then add the kernel.bin
as a dependency to your shared library target.
Hope that helps.

noma
- 1,171
- 6
- 15