dpctl.get_num_devices

dpctl.get_num_devices(backend=backend_type.all, device_type=device_type.all)

A helper function to return the number of SYCL devices of a given dpctl.device_type and dpctl.backend_type.

Parameters:
  • backend (optional) – A dpctl.backend_type enum value or a string that specifies a SYCL backend. Currently, accepted values are: “cuda”, “opencl”, “level_zero”, or “all”. Default: dpctl.backend_type.all.

  • device_type (optional) – A dpctl.device_type enum value or a string that specifies a SYCL device type. Currently, accepted values are: “gpu”, “cpu”, “accelerator”, “host”, or “all”. Default: dpctl.device_type.all.

Returns:

The number of available SYCL devices that satisfy the provided dpctl.backend_type and dpctl.device_type values.

Return type:

int