Skip to content

Commit 42afc0c

Browse files
Merge pull request #854 from IntelPython/fix-manual-examples
update expected exception type when creating devices
2 parents 16ed729 + ce62bb9 commit 42afc0c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/python/device_selection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def create_gpu_device():
4848
d2 = dpctl.select_gpu_device()
4949
assert d1 == d2
5050
d1.print_device_info()
51-
except ValueError:
51+
except dpctl.SyclDeviceCreationError:
5252
print("A GPU device is not available on the system")
5353

5454

examples/python/filter_selection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ def select_using_filter():
2828
try:
2929
d1 = dpctl.SyclDevice("cpu")
3030
d1.print_device_info()
31-
except ValueError:
31+
except dpctl.SyclDeviceCreationError:
3232
print("A CPU type device is not available on the system")
3333

3434
try:
3535
d1 = dpctl.SyclDevice("opencl:cpu:0")
3636
d1.print_device_info()
37-
except ValueError:
37+
except dpctl.SyclDeviceCreationError:
3838
print("An OpenCL CPU driver needs to be installed on the system")
3939

4040
d1 = dpctl.SyclDevice("0")
@@ -43,7 +43,7 @@ def select_using_filter():
4343
try:
4444
d1 = dpctl.SyclDevice("gpu")
4545
d1.print_device_info()
46-
except ValueError:
46+
except dpctl.SyclDeviceCreationError:
4747
print("A GPU type device is not available on the system")
4848

4949

0 commit comments

Comments
 (0)