Version 3.0.23.01.25
[clinfo] / man1 / clinfo.1
1 .TH CLINFO 1 "2023-01-25" "clinfo 3.0.23.01.25"
2
3 .SH NAME
4
5 clinfo \- show OpenCL platforms and devices
6
7 .SH SYNOPSIS
8 .B clinfo
9 .RI [ "options ..." ]
10
11 .SH DESCRIPTION
12 .B clinfo
13 prints all available information about all OpenCL platforms
14 available on the system and the devices they expose.
15
16 .SH OPTIONS
17 .B clinfo
18 accepts the following options:
19 .TP 2
20 .BR -a ", " --all-props
21 try to retrieve all properties, even those not officially supported
22 (e.g. because they require specific extensions), but only show them
23 if the property could be retrieved successfully; see also the
24 .B LIMITATIONS
25 section below; note that even though this may reveal hidden properties,
26 there is no guarantee that the returned values are meaningful, nor that
27 the corresponding feature is actually available at all;
28 .TP
29 .BR -A ", " --always-all-props
30 like
31 .BR -a ,
32 but also show errors;
33 .TP
34 .B --human
35 produce human-friendly output; this is the default (except
36 as noted below);
37 .TP
38 .B --raw
39 produce machine-friendly output; this is the default if
40 .B clinfo
41 is invoked with a name that contains the string
42 .RI \*(lq raw \*(rq;
43 .TP
44 .B --json
45 outputs the raw data (cf. the
46 .B --raw
47 option) in JSON format; support for this option is experimental,
48 as the representation of some of the values is not finalized;
49 .TP
50 .B --offline
51 shows also offline devices for platforms that expose this feature;
52 .TP
53 .B --null-platform
54 tries to handle the NULL platform as a normal platform,
55 retrieving and showing its properties and devices;
56 this is in addition to the NULL platform behavior tests done at the end,
57 and can be useful on systems where there are no ICD platforms,
58 but there is a platform hard-coded in the OpenCL library itself;
59 .TP
60 .BR -l ", " --list
61 list platforms and devices by name, with no (other) properties;
62 .TP
63 .BI -d platform_index : device_index
64 .TQ
65 .BI --device " platform_index" : device_index
66 only show properties for the specified device in the specified platform;
67 .TP
68 .BI --prop " property-name"
69 only show properties whose symbolic name matches
70 (contains as a substring) the given
71 .IR property-name ;
72 the name is normalized as upper-case and with minus sign (-)
73 replaced by underscore signs (_); when this flag is specified,
74 raw mode is forced;
75 .TP
76 .BR -h ", " -?
77 show usage;
78 .TP
79 .BR --version ", " -v
80 show program version.
81
82 .SH CONFORMING TO
83
84 OpenCL 1.1, OpenCL 1.2, OpenCL 2.0, OpenCL 2.1, OpenCL 2.2, OpenCL 3.0.
85
86 .SH EXTENSIONS
87
88 Supported OpenCL extensions:
89 .TP 2
90 .B cl_khr_device_uuid
91 for the UUID, LUID and node mask of the device;
92 .TP
93 .B cl_khr_extended_versioning
94 for the extended platform, device, extension and IL versioned properties
95 backported from OpenCL 3.0 to previous OpenCL versions;
96 .TP
97 .BR cl_khr_fp16 ", " cl_khr_fp64 ", " cl_amd_fp64 ", " cl_APPLE_fp64_basic_ops
98 for information about support for half-precision and double-precision
99 floating-point data types;
100 .TP
101 .B cl_khr_image2d_from_buffer
102 for information about the base address and pitch alignment requirements
103 of buffers to be used as base for 2D images;
104 .TP
105 .B cl_khr_il_program
106 for information about the supported IL (Intermediate Language) representations;
107 .TP
108 .B cl_khr_spir
109 for information about the supported SPIR (Standard Portable Intermediate
110 Representation) versions;
111 .TP
112 .B cl_khr_icd
113 for the suffix of vendor extensions functions;
114 .TP
115 .B cl_khr_subgroup_named_barrier
116 for the maximum number of named sub-group barriers;
117 .TP
118 .BI cl_khr_terminate_context ", " cl_arm_controlled_kernel_termination
119 for the terminate capabilities for the device;
120 .TP
121 .B cl_ext_device_fission
122 for device fission support in OpenCL 1.1 devices;
123 .TP
124 .B cl_khr_pci_bus_info
125 for the PCI bus information (see also
126 .BR cl_nv_device_attribute_query " and"
127 .BR cl_amd_device_attribute_query )
128 .TP
129 .B cl_ext_atomic_counters_32
130 .TQ
131 .B cl_ext_atomic_counters_64
132 for the atomic counter extension;
133 .TP
134 .B cl_ext_cxx_for_opencl
135 for the version of the C++ for OpenCL language supported by the device compiler;
136 .TP
137 .B cl_amd_device_attribute_query
138 for AMD-specific device attributes;
139 .TP
140 .B cl_amd_object_metadata
141 to show the maximum number of keys supported by the platform;
142 .TP
143 .B cl_amd_offline_devices
144 to show offline devices exposed by the platform, if requested (see
145 .B --offline
146 option);
147 .TP
148 .B cl_amd_copy_buffer_p2p
149 to show the number and IDs of available P2P devices;
150 .TP
151 .B cl_amd_svm
152 .TQ
153 .B cl_arm_shared_virtual_memory
154 for Shared Virtual Memory (SVM) capabilities in OpenCL 1.2 devices;
155 .TP
156 .B cl_arm_core_id
157 to show the (potentially sparse) list of the core IDs that the device may
158 return;
159 .TP
160 .B cl_arm_job_slot_selection
161 to show the (potentially sparse) list of available job slots for command
162 submission;
163 .TP
164 .B cl_arm_scheduling_controls
165 to show the supported work scheduling controls and the available sets of register allocations;
166 .TP
167 .B cl_nv_device_attribute_query
168 for NVIDIA-specific device attributes;
169 .TP
170 .B cl_intel_device_attribute_query
171 for Intel-specific device attributes;
172 .TP
173 .B cl_intel_exec_by_local_thread
174 for the Intel extension allowing CPU devices to run kernels as part of
175 the current host thread;
176 .TP
177 .B cl_intel_advanced_motion_estimation
178 for the version of the Intel Motion Estimation accelerator version;
179 .TP
180 .B cl_intel_device_side_avc_motion_estimation
181 for the version and supported features of Intel's device-side AVC Motion;
182 .TP
183 .B cl_intel_planar_yuv
184 for the maximum dimensions of planar YUV images;
185 .TP
186 .B cl_intel_simultaneous_sharing
187 for simultaneous CL/GL/DirectX context sharing (only partial support);
188 .TP
189 .B cl_intel_required_subgroup_size
190 to enumerate allowed sub-group sizes;
191 .TP
192 .B cl_intel_command_queue_families
193 to enumerate the available command queues and their properties and capabilities;
194 .TP
195 .B cl_altera_device_temperature
196 for the Altera extension to query the core temperature of the device;
197 .TP
198 .B cl_qcom_ext_host_ptr
199 for the QUALCOMM extension to query page size and required padding in external
200 memory allocation.
201
202 .SH NOTES
203 Some information is duplicated when available from multiple sources.
204 Examples:
205 .IP \(bu 2
206 supported device partition types and domains as obtained using the
207 .B cl_ext_device_fission
208 extension typically match the ones obtained using
209 the core OpenCL 1.2 device partition feature;
210 .IP \(bu
211 the preferred work-group size multiple matches the NVIDIA warp size (on
212 NVIDIA devices) or the AMD wavefront width (on AMD devices).
213
214 .P
215 Some floating-point configuration flags may only be meaningful for
216 specific precisions and/or specific OpenCL versions. For example,
217 .B CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
218 is only relevant for single precision in OpenCL 1.2 devices.
219
220 .P
221 The implementation-defined behavior for NULL platform or context
222 properties is tested for the following API calls:
223 .TP 2
224 .B clGetPlatformInfo()
225 by trying to show the platform name;
226 .TP
227 .B clGetDeviceIDs()
228 by trying to enumerate devices; the corresponding platform (if any)
229 is then detected by querying the device platform of the first device;
230 .TP
231 .B clCreateteContext()
232 by trying to create a context from a device from the previous
233 list (if any), and a context from a device from a different platform;
234 .TP
235 .B clCreateteContextFromType()
236 by trying to create contexts for each device type (except DEFAULT).
237
238 .SH EXPERIMENTAL FEATURES
239 .P
240 Support for OpenCL 2.x properties is not fully tested.
241
242 .P
243 Support for
244 .B cl_khr_subgroup_named_barrier
245 is experimental due to missing definitions in the official OpenCL headers.
246
247 .P
248 Raw (machine-parsable) output is considered experimental, the output format
249 might still undergo changes.
250
251 .P
252 The properties of the ICD loader will also be queried if the
253 .B clGetICDLoaderInfoOCLICD
254 extension function is found.
255
256 .P
257 Support for the properties exposed by
258 .B cl_amd_copy_buffer_p2p
259 is experimental.
260
261 .P
262 Support for some (documented and undocumented) properties exposed by
263 .B cl_amd_device_attribute_query
264 is experimental (see also
265 .BR LIMITATIONS ).
266
267 .P
268 Support for the interop lists exposed by
269 .B cl_intel_simultaneous_sharing
270 is experimental.
271
272 .P
273 The highest OpenCL version supported by the ICD loader is detected
274 with some trivial heuristics (symbols found); a notice is output
275 if this is lower than the highest platform OpenCL version, or
276 if the detected version doesn't match the one declared by the ICD
277 loader itself.
278
279 .SH LIMITATIONS
280
281 .P
282 OpenCL provides no explicit mean to detect the supported version
283 of any extension exposed by a device, which makes it impossible to
284 determine a priori if it will be possible to successfully query
285 a device about a specific property.
286 Additionally, the actual size and meaning of some properties are not
287 officially declared anywhere.
288
289 .P
290 Most notably, this affects extensions such as
291 .BR cl_amd_device_attribute_query ,
292 .B cl_nv_device_attribute_query
293 and
294 .BR cl_arm_core_id .
295 Heuristics based on standard version support are partially used in the code to
296 determine which version may be supported.
297
298 .P
299 Properties which are known to be affected by these limitations include:
300
301 .TP 2
302 .B CL_DEVICE_GLOBAL_FREE_MEMORY_AMD
303 documented in v3 of the
304 .B cl_amd_device_attribute_query
305 extension specification as being the global free memory in KBytes, without
306 any explanation given on why there are two values, although in the source code
307 of the
308 .B ROCm
309 stack the second value is documented as being the largest free block;
310 .TP
311 .B CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD
312 documented in v3 of the
313 .B cl_amd_device_attribute_query
314 extension specification, but not reported by drivers supporting other v3
315 properties. This has now been enabled for drivers
316 .I assumed
317 to support v4 of the same extension;
318 .TP
319 .B CL_DEVICE_TERMINATE_CAPABILITY_KHR
320 exposed by the
321 .B cl_khr_terminate_context
322 has changed value between OpenCL 1.x and 2.x, and it's
323 .I allegedly
324 a bitfield, whose values are however not defined anywhere.
325
326 .SH BUGS
327
328 .SS General
329
330 .P
331 Please report any issues on
332 .UR http://github.com/Oblomov/clinfo
333 the project tracker on GitHub
334 .UE .
335
336 .SS LLVM CommandLine errors
337
338 .P
339 If multiple OpenCL platforms using shared
340 .B LLVM
341 libraries are present in the system,
342 .B clinfo
343 (and other OpenCL application) may crash with errors
344 to the tune of
345 .PP
346 .nf
347 .RS
348 .B : CommandLine Error: Option '(some option name)' registered more than once!
349 .B LLVM ERROR: inconsistency in registered CommandLine options
350 .RE
351 .fi
352 .PP
353 or similar. This is not an issue in
354 .BR clinfo ","
355 or in any OpenCL platform or application, but it is due to the way
356 .B LLVM
357 handles its own command-line options parsing.
358 The issue has been reported upstream
359 .UR https://bugs.llvm.org/show_bug.cgi?id=30587
360 as issue #30587
361 .UE .
362 See the next point for possible workarounds and assistance in identifying the
363 conflicting platforms.
364
365 .SS Segmentation faults
366
367 .P
368 Faulty OpenCL platforms may cause segmentation faults in
369 .B clinfo
370 during the information gathering phase, sometimes even
371 before any output is shown. There is very little
372 .B clinfo
373 can do to avoid this. If you see this happening,
374 try disabling all platforms and then re-enabling
375 them one by one until you experience the crash again.
376 Chances are the last platform you enabled is defective
377 in some way (either by being incompatible with other
378 platforms or by missing necessary components and
379 not handling their absence gracefully).
380
381 .P
382 To selectively enable/disable platforms, one
383 way is to move or rename the
384 .I *.icd
385 files present in
386 .I /etc/OpenCL/vendors/
387 and then restoring them one by one. When using
388 the free-software
389 .B ocl-icd
390 OpenCL library, a similar effect can be achieved
391 by setting the
392 .B OPENCL_VENDOR_PATH
393 or
394 .B OCL_ICD_VENDORS
395 environment variables, as documented in
396 .BR libOpenCL (7).
397 Other implementations of
398 .B libOpenCL
399 are known to support
400 .B OPENCL_VENDOR_PATH
401 too.
402
403 .TP 2
404 .B Example
405 find /etc/OpenCL/vendors/ -name '*.icd' | while read OPENCL_VENDOR_PATH ; do clinfo -l > /dev/null ; echo "$? ${OPENCL_VENDOR_PATH}" ; done
406
407 .P
408 This one liner will run
409 .B clinfo -l
410 for each platform individually (hiding the normal output),
411 and report the
412 .I .icd
413 path prefixed by
414 .B 0
415 for successful runs, and a non-zero value for faulty
416 platforms.