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().")
Beispiel #2
0
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)
Beispiel #3
0
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
Beispiel #4
0
def has_sycl_platforms():
    return bool(len(dpctl.get_platforms()))