opencl (3), kernel, and

1: Program

1) Create a program from the context

cl_program clCreateProgramWithSource(

cl_context context, // context

cl_uint count, the number of text //

const char ** strings, // program text

const size_t * lengths, // length of each program text

cl_int * errcode_ret // error code

)

2) compiler

cl_int clBuildProgram(

cl_program program, // program

cl_uint num_devices, // number of devices

const cl_device_id * device_list, // device list

const char * options, // compiler options

void (* pfn_notify) (cl_program, void * user_data), // error message callback function

void * user_data // error message

)

3) obtain program information

cl_int clGetProgramInfo(

cl_program program, // program

cl_program_info param_name, // Information Type Name

size_t param_value_size, // size of information to be saved

void * param_value, // save the address information

size_t param_value_size_ret // access to information should be the size of the

)

 

4) obtain information compiled

cl_int clGetProgramBuildInfo(

cl_program program,

cl_device_id device,

cl_program_build_info param_name,

size_t param_value_size,

void *param_value,

size_t param_value_size_ret

)

Common variation information parameters CL_PROGRAM_LOG View build logs

 

2: Kernel

1) Create a program for each kernel function

cl_int clCreateKernelsInProgram(

cl_program program, // program

cl_uint num_kernels, // number of cores

cl_kernek * kernels, // kernel address

cl_uint * num_kernels_ret // get proper data

)

2) obtain core information

cl_int clGetKernelInfo(

cl_kernel kernel, // kernel

cl_kernel_info param_name, // type of information

size_t param_value_size, // size you want to get information

void * param_value, address information stored //

size_t * param_value_size_ret // should have information on the size

)

Guess you like

Origin www.cnblogs.com/pengtangtang/p/PengTangTang_OpenCL_numbertwo.html