OpenCL编程:编译程序

很多厂商的编程框架并没有包含独立的OpenCL编译器,都是运行时编译器,通过函数clBuildProgram进行访问。

函数clBuildProgram可以针对同一平台的不同设备,编译和链接cl_program。

其函数原型如下:

clBuildProgram(cl_program program, cl_uint num_devices, const cl_device_id *devices, const char* options,

(void CL_CALLBACK *notify_func)(...), void *user_data);

options为编译选项,如下是一些可选的。

const char options[] = "-cl-finite-math-only -cl-no-signed-zeros";
clBuildProgram(program, 1, &device[0], options, NULL, NULL);

猜你喜欢

转载自blog.csdn.net/heiheiya/article/details/81173723