From ce62bb98ca5e074123df966753971120efefa1f3 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 28 Jun 2022 14:02:32 -0500 Subject: [PATCH] update expected exception type when creating devices --- examples/python/device_selection.py | 2 +- examples/python/filter_selection.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/python/device_selection.py b/examples/python/device_selection.py index 2278183c94..5fa0e4c91b 100644 --- a/examples/python/device_selection.py +++ b/examples/python/device_selection.py @@ -48,7 +48,7 @@ def create_gpu_device(): d2 = dpctl.select_gpu_device() assert d1 == d2 d1.print_device_info() - except ValueError: + except dpctl.SyclDeviceCreationError: print("A GPU device is not available on the system") diff --git a/examples/python/filter_selection.py b/examples/python/filter_selection.py index af6dc91fc0..06e1d187c2 100644 --- a/examples/python/filter_selection.py +++ b/examples/python/filter_selection.py @@ -28,13 +28,13 @@ def select_using_filter(): try: d1 = dpctl.SyclDevice("cpu") d1.print_device_info() - except ValueError: + except dpctl.SyclDeviceCreationError: print("A CPU type device is not available on the system") try: d1 = dpctl.SyclDevice("opencl:cpu:0") d1.print_device_info() - except ValueError: + except dpctl.SyclDeviceCreationError: print("An OpenCL CPU driver needs to be installed on the system") d1 = dpctl.SyclDevice("0") @@ -43,7 +43,7 @@ def select_using_filter(): try: d1 = dpctl.SyclDevice("gpu") d1.print_device_info() - except ValueError: + except dpctl.SyclDeviceCreationError: print("A GPU type device is not available on the system")