clinfo: Enumerate OpenCL Platforms and Devices
clinfo enumerates every OpenCL platform and device visible on the machine, a vendor-neutral way to confirm a GPU is usable for OpenCL.
For OpenCL workloads (or just a cross-vendor sanity check), clinfo lists the platforms and devices an ICD loader can find, independent of CUDA or ROCm.
What it does
clinfo queries the OpenCL ICD loader (libOpenCL) and prints every platform (NVIDIA, AMD, Intel, POCL) and its devices with their capabilities: compute units, memory, and supported OpenCL version. A short summary mode fits in CI logs.
Common usage
clinfo
# compact list of platforms/devices
clinfo -l
# just the counts
clinfo | grep "Number of"Options
| Flag | What it does |
|---|---|
| (no args) | Full capability dump per device |
| -l | Short list of platforms and devices |
| --json | Machine-readable JSON output |
| OCL_ICD_VENDORS | Directory of ICD files the loader reads |
In CI
Use clinfo -l as a quick vendor-agnostic gate that at least one GPU device is exposed for OpenCL. In containers, the NVIDIA OpenCL ICD is only mounted when you request the appropriate capability, so verify clinfo sees a device before running OpenCL tests.
Common errors in CI
"Number of platforms: 0" means no OpenCL ICD is installed or registered; the vendor ICD file under /etc/OpenCL/vendors is missing. In a GPU container this happens when --gpus all did not request the compute+utility capabilities that mount the NVIDIA OpenCL library. "clinfo: command not found" means the clinfo package is not installed.