dpctl.SyclDevice.create_sub_devices¶
- SyclDevice.create_sub_devices(partition=parition_spec)¶
Creates a list of sub-devices by partitioning a root device based on the provided partition specifier.
A partition specifier must be provided using a
partition
keyword argument. Possible values for the specifier are: an integer, a string specifying the affinity domain, or a collection of integers.- Example:
import dpctl cpu_d = dpctl.SyclDevice("cpu") cpu_count = cpu_d.max_compute_units sub_devs = cpu_d.create_sub_devices(partition=cpu_count // 2) for d in sub_devs: d.print_device_info() # Create sub-devices partitioning by affinity. try: sd = cpu_d.create_sub_devices(partition="numa") print( "{0} sub-devices were created with respective " "#EUs being {1}".format( len(sd), [d.max_compute_units for d in sd] ) ) except Exception: print("Device partitioning by affinity was not successful.")
- Parameters:
partition (Union[int, str, List[int]]) –
Specification to partition the device as follows:
- Specifying an int (
count
) The returned list contains as many sub-devices as can be created such that each sub-device contains
count
compute units. If the device’s total number of compute units is not evenly divided bycount
, then the remaining compute units are not included in any of the sub-devices.
- Specifying an int (
- Specifying an affinity domain as a string
The supported values are:
"numa"
,"L4_cache"
,"L3_cache"
,"L2_cache"
,"L1_cache"
,"next_partitionable"
.
- Specifying a collection of integral values
For each non-zero value
M
in the collection, a sub-device withM
compute units is created.
- Returns:
Created sub-devices.
- Return type:
List[
dpctl.SyclDevice
]- Raises:
TypeError – If the
partition
keyword argument is not specified or the affinity domain string is not legal or is not one of the three supported options.dpctl.SyclSubdeviceCreationError – If sub-devices can not be created.