Skip to main content

OpenCL Basics


Ref:

Platform model

Execution model

  • kernel: A kernel is a small unit of execution that performs a clearly defined function and that can be executed in parallel.
  • work-item: A instance in which one kernel run.
  • work-group: A group of work-items. Work-items grouped into a work-group are executed simultaneously.
  • NDRagne: An index space.
  • OpenCL application: Host program running on host + Kernels running on Compute device.

In the global NDRange index space, work-item has a unique coordinate(global ID), and work-group has a work-group ID. In a local work-group index space, work-item has a unique coordinate(local ID).

Therefore, one work-item can be accessed by global ID or work-group ID + local ID.

With plaform model

Context

Command-Queues

Interaction between a host and an OpenCL device is caused by commands. The host uses command-queue to transmit commands to the device.

Memory model

Hardware

Software

Programming models

OpenCL information

clinfo installation

sudo apt install -y clinfo ocl-icd-libopencl1
sudo mkdir -p /etc/OpenCL/vendors
$ sudo vim /etc/OpenCL/vendors/<vendor>.icd
<path>/libOpenCL.so
clinfo