def test_get_platforms(): try: platforms = dpctl.get_platforms() if platforms: assert has_sycl_platforms() except Exception: pytest.fail("Encountered an exception inside get_platforms().")
def list_available_platforms(): """ Get a list of SyclPlatform instances corresponding to platforms visible to SYCL runtime. Environment variable `SYCL_DEVICE_FILTER` affects this list. """ for p in dpctl.get_platforms(): print(p)
def has_sycl_platforms(): """ Checks if dpctl is able to identify a non-host SYCL platform. """ platforms = dpctl.get_platforms() for p in platforms: if p.backend is not dpctl.backend_type.host: return True return False
def has_sycl_platforms(): return bool(len(dpctl.get_platforms()))