Wednesday 10 October 2012

OpenCL API Commonly Used Functions and Sequence

OpenCL API Commonly Used Functions and Sequence
  


ØGetPlunctatForm                        input: NULL

ØGetDeviceID                         input :PlatForm, Type of Device

ØCreateContext                      input: num of Devices, DeviceIds

ØCreateCommandQueue      input: Context

ØCreateProgram                     input: Context, DeviceId

ØBuildProgram                        input: Program, num of Devices, DeviceIds

ØCreateKernel                         input: Program, kernelname

ØCreateBuffer                         input: Context, read/write/read&write flags

ØEnqueueWriteBuffer           input: CommandQueue, Buffer, size, Host ptr

ØclSetKernelArg                     input: kernel, arg index, arg size, arg_value

ØclEnqueueNDRangeKernel   input: CommandQueue, kernel, num. of Dimensions, global threads in each dimension, local threads in each dimension

ØEnqueueReadBuffer             input: CommandQueue, Buffer, size, Host ptr




Generally there may be one or more platforms on host like either AMD platform for GPU/CPU and Nvidia Platform for GPU. Each platform implementation will be different but usage is same. so we need to query first platform.
Once platform is found we need to find the Devices of type either GPU or CPU or any thing else including FPGA, Accelerator if platform supports.
Once we got Devices and their Device Ids we need to create a context.
 Within the context we need to create command queue. This command queue will be used to submit the commands like createbuffer, writebuffer etc

No comments:

Post a Comment