2
2
#
3
3
# SPDX-License-Identifier: Apache-2.0
4
4
5
+ import dpctl
5
6
import dpnp
6
7
import pytest
7
8
from numba .core .errors import LoweringError
@@ -26,6 +27,9 @@ def input_arrays(request):
26
27
def test_print_scalar_with_string (input_arrays , capfd ):
27
28
"""Tests if we can print a scalar value with a string."""
28
29
30
+ if dpctl .SyclDevice ().device_type == dpctl .device_type .cpu :
31
+ pytest .xfail ("Printing scalars on OpenCL CPU devices is unsupported." )
32
+
29
33
@dpex .kernel
30
34
def print_scalar_val (s ):
31
35
print ("printing ..." , s [0 ])
@@ -40,6 +44,9 @@ def print_scalar_val(s):
40
44
def test_print_scalar (input_arrays , capfd ):
41
45
"""Tests if we can print a scalar value."""
42
46
47
+ if dpctl .SyclDevice ().device_type == dpctl .device_type .cpu :
48
+ pytest .xfail ("Printing scalars on OpenCL CPU devices is unsupported." )
49
+
43
50
@dpex .kernel
44
51
def print_scalar_val (s ):
45
52
print (s [0 ])
@@ -48,6 +55,7 @@ def print_scalar_val(s):
48
55
49
56
print_scalar_val [dpex .Range (1 )](a )
50
57
captured = capfd .readouterr ()
58
+
51
59
assert "10" in captured .out
52
60
53
61
@@ -73,7 +81,9 @@ def print_string(a):
73
81
74
82
75
83
def test_print_array (input_arrays ):
76
- """Negative test to capture LoweringError as printing arrays is unsupported."""
84
+ """Negative test to capture LoweringError as printing arrays
85
+ is unsupported.
86
+ """
77
87
78
88
@dpex .kernel
79
89
def print_string (a ):
0 commit comments