DPC++ Device Selection in the Host Code
Host code can explicitly select a device type. To do select a device, select a queue and initialize its device with one of the following:
is used, the kernel runs based on a heuristic that chooses from available compute devices (all, or a subset based on the value of the
If a specific device type (such as
) is used, then it is expected that the specified device type is available in the platform or included in the filter specified by
. If such a device is not available, then the runtime system throws an exception indicating that the requested device is not available. This error can be thrown in the situation where an ahead-of-time (AOT) compiled binary is run in a platform that does not contain the specified device type.
applications can run on any supported target hardware, tuning is required to derive the best performance advantage on a given target architecture. For example, code tuned for a CPU likely will not run as fast on a GPU accelerator without modification.
is a complex environment variable that allows you to limit the runtimes, compute device types, and compute device IDs that may be used by the DPC++ runtime to a subset of all available combinations. The compute device IDs correspond to those returned by the SYCL API,
(with the numbering starting at 0). They have no relation to whether the device with that ID is of a certain type or supports a specific runtime. Using a programmatic special selector (like
) to request a filtered out device will cause an exception to be thrown. Refer to the environment variable description in GitHub for details on use and example values:
tool enumerates a list of devices available in the system. It is strongly recommended to run this tool before running any SYCL or DPC++ programs to make sure the system is configured properly. As a part of enumeration,
string as a prefix of each device listing. The format of the
[SYCL_DEVICE_FILTER] Platform_name, Device_name, Device_version [driver_version]
. In the following example, the string enclosed in the bracket ([ ]) at the beginning of each line is the
string used to designate the specific device on which the program will run.
[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2021.12.9.0.24_005321]
[opencl:gpu:1] Intel(R) OpenCL HD Graphics, Intel(R) UHD Graphics 630 [0x3e92] 3.0 [21.37.20939]
[opencl:cpu:2] Intel(R) OpenCL, Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.0 [2021.12.9.0.24_005321]
[level_zero:gpu:0] Intel(R) Level-Zero, Intel(R) UHD Graphics 630 [0x3e92] 1.1 [1.2.20939]
[host:host:0] SYCL host platform, SYCL host device 1.2 [1.2]