Intel® FPGA SDK for OpenCL™ Standard Edition: Programming Guide
Visible to Intel only — GUID: gec1521053480162
Ixiasoft
Visible to Intel only — GUID: gec1521053480162
Ixiasoft
12.1.6. Specifying an OpenCL Library when Compiling an OpenCL Kernel
You may include multiple instances of -l <library file name> and -L <library directory> in the offline compiler command.
For example, if you create a library that includes the functions my_div_fd(), my_sqrtfd(), and myrsqrtfd(), the OpenCL kernel code might resemble the following:
#include “lib_header.h” kernel void test_lib ( global double * restrict in, global double * restrict out, int N) { int i = get_global_id(0); for (int k =0; k < N; k++) { double x = in[i*N + k]; out[i*N + k] = my_divfd (my_rsqrtfd(x), my_sqrtfd(my_rsqrtfd (x))); } }
The corresponding lib_header.h file might resemble the following:
double my_sqrtfd (double x); double my_rsqrtfd(double x); double my_divfd(double a, double b);