Platform
A platform abstracts a device driver for one or more XPUs that is connected to
a host. The dpctl.SyclPlatform
class represents a platform and
abstracts the sycl::platform SYCL runtime class.
Listing Available Platforms
To require the platforms available on a system, use
dpctl.lsplatform()
function.
It is possible to print out metadata about a platform:
1import dpctl
2
3
4def print_available_platforms():
5 """
6 Print information about SYCL platforms visible to runtime.
7
8 Environment variable `SYCL_DEVICE_FILTER` affects this list.
9 """
10 dpctl.lsplatform()
11
12
13def list_available_platforms():
14 """
15 Get a list of SyclPlatform instances corresponding to platforms
16 visible to SYCL runtime.
17
18 Environment variable `SYCL_DEVICE_FILTER` affects this list.
19 """
20 for p in dpctl.get_platforms():
21 print(p)
22
To execute the example, run:
python dpctl/examples/python/lsplatform.py -r all
The possible output for the example:
INFO: Executing example print_available_platforms
Intel(R) FPGA Emulation Platform for OpenCL(TM) OpenCL 1.2 Intel(R) FPGA SDK for OpenCL(TM), Version 20.3
Intel(R) OpenCL OpenCL 3.0 LINUX
INFO: ===========================
INFO: Executing example list_available_platforms
<dpctl.SyclPlatform [Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) Corporation, OpenCL 1.2 Intel(R) FPGA SDK for OpenCL(TM), Version 20.3] at 0x7fa60d0cfeb0>
<dpctl.SyclPlatform [Intel(R) OpenCL, Intel(R) Corporation, OpenCL 3.0 LINUX] at 0x7fa60d106370>
INFO: ===========================
Note
To control the verbosity for the output, use the verbosity
keyword argument. Refer to dpctl.lsplatform()
for more information.