What is OpenCL?
A standard parallel-programming framework for GPUs, CPUs, FPGAs and more from multiple vendors, defined by the Khronos Group industry consortium.
Japanese name: OpenCL
A standard parallel-programming framework for GPUs, CPUs, FPGAs and more from multiple vendors, defined by the Khronos Group industry consortium.
Japanese name: OpenCL
An OpenCL program is split into a host program running on the CPU and kernels executed in parallel on devices such as GPUs. Through the OpenCL API, the host discovers the available devices, allocates memory buffers, transfers data and places kernel launches in a command queue. Kernels are written in OpenCL C, a language based on C, and are often compiled for the target device at run time. This is what lets the same program run on devices from different vendors.
A kernel runs as many work-items at once, one for each point of an index space called the NDRange. Work-items are grouped into work-groups; within a group they share fast local memory and can synchronize with barriers. Memory is divided into global memory shared by all, read-only constant memory, local memory shared within a work-group, and private memory for each work-item. These map closely to CUDA's threads, thread blocks and shared memory.
OpenCL's strength is that the same code runs on GPUs, CPUs, FPGAs and other devices. Running is not the same as running fast, however: work-group size and memory access patterns must be tuned for each device to get good performance. For FPGAs, there are tools that compile kernels into hardware ahead of time. The Khronos Group also defines SYCL, which lets host and device code be written in a single C++ source, and Vulkan, which covers graphics and compute.
Answer: C. OpenCL
CUDA targets NVIDIA GPUs, while OpenCL is an industry-consortium standard that runs on GPUs, CPUs and FPGAs from multiple vendors. Others include SYCL, written in C++, and HIP, which targets AMD GPUs with CUDA-like syntax. The syntax differs, but the principles, such as the thread hierarchy, shared memory, coalescing and keeping branches uniform, are common to all.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.