Skip to content

Commit b6bd08a

Browse files
committed
Testing is adapted for cuda devices
1 parent 3f20511 commit b6bd08a

9 files changed

+863
-0
lines changed

dpnp/dpnp_iface.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"get_usm_ndarray_or_scalar",
7373
"is_supported_array_or_scalar",
7474
"is_supported_array_type",
75+
"not_implemented_for_cuda_backend",
7576
"synchronize_array_data",
7677
]
7778

@@ -800,6 +801,21 @@ def is_supported_array_type(a):
800801
return isinstance(a, (dpnp_array, dpt.usm_ndarray))
801802

802803

804+
def not_implemented_for_cuda_backend(obj):
805+
"""
806+
Raise NotImplementedError for cuda devices.
807+
808+
Parameters
809+
----------
810+
obj : {SyclDevice, SyclQueue, dpnp.ndarray, usm_ndarray}
811+
An input object with sycl_device property to check device backend.
812+
813+
"""
814+
sycl_device = getattr(obj, "sycl_device", None)
815+
if sycl_device is not None and "cuda" in sycl_device.backend.name:
816+
raise NotImplementedError("function not implemented for cuda backend")
817+
818+
803819
def synchronize_array_data(a):
804820
"""
805821
The dpctl interface was reworked to make asynchronous execution.

dpnp/dpnp_iface_indexing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ def choose(x1, choices, out=None, mode="raise"):
173173
:obj:`dpnp.take_along_axis` : Preferable if choices is an array.
174174
175175
"""
176+
177+
dpnp.not_implemented_for_cuda_backend(x1)
178+
176179
x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False)
177180

178181
choices_list = []

dpnp/dpnp_iface_libmath.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ def erf(in_array1):
7878
7979
"""
8080

81+
dpnp.not_implemented_for_cuda_backend(in_array1)
82+
8183
x1_desc = dpnp.get_dpnp_descriptor(
8284
in_array1, copy_when_strides=False, copy_when_nondefault_queue=False
8385
)

dpnp/dpnp_iface_mathematical.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,6 +2477,8 @@ def modf(x1, **kwargs):
24772477
24782478
"""
24792479

2480+
dpnp.not_implemented_for_cuda_backend(x1)
2481+
24802482
x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False)
24812483
if x1_desc and not kwargs:
24822484
return dpnp_modf(x1_desc)

dpnp/dpnp_iface_sorting.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ def partition(x1, kth, axis=-1, kind="introselect", order=None):
174174
175175
"""
176176

177+
dpnp.not_implemented_for_cuda_backend(x1)
178+
177179
x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False)
178180
if x1_desc:
179181
if not isinstance(kth, int):

dpnp/dpnp_iface_statistics.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ def correlate(x1, x2, mode="valid"):
371371
372372
"""
373373

374+
dpnp.not_implemented_for_cuda_backend(x1)
375+
374376
x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False)
375377
x2_desc = dpnp.get_dpnp_descriptor(x2, copy_when_nondefault_queue=False)
376378
if x1_desc and x2_desc:
@@ -655,6 +657,8 @@ def median(x1, axis=None, out=None, overwrite_input=False, keepdims=False):
655657
656658
"""
657659

660+
dpnp.not_implemented_for_cuda_backend(x1)
661+
658662
x1_desc = dpnp.get_dpnp_descriptor(x1, copy_when_nondefault_queue=False)
659663
if x1_desc:
660664
if axis is not None:

tests/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,20 @@ def pytest_collection_modifyitems(config, items):
6464
test_path, "skipped_tests_gpu_no_fp64.tbl"
6565
)
6666

67+
# global skip file for cuda backend
68+
test_exclude_file_cuda = os.path.join(
69+
test_path, "skipped_tests_cuda.tbl"
70+
)
71+
6772
dev = dpctl.select_default_device()
6873
is_cpu = dev.is_cpu
6974
is_gpu_no_fp64 = not dev.has_aspect_fp64
75+
is_cuda = "cuda" in str(dev.backend.name)
7076

7177
print("")
7278
print(f"DPNP current device is CPU: {is_cpu}")
7379
print(f"DPNP current device is GPU without fp64 support: {is_gpu_no_fp64}")
80+
print(f"DPNP current device is GPU with cuda backend: {is_cuda}")
7481
print(f"DPNP version: {dpnp.__version__}, location: {dpnp}")
7582
print(f"NumPy version: {numpy.__version__}, location: {numpy}")
7683
print(f"Python version: {sys.version}")
@@ -81,6 +88,10 @@ def pytest_collection_modifyitems(config, items):
8188
excluded_tests.extend(
8289
get_excluded_tests(test_exclude_file_gpu_no_fp64)
8390
)
91+
if is_cuda:
92+
excluded_tests.extend(
93+
get_excluded_tests(test_exclude_file_cuda)
94+
)
8495
else:
8596
excluded_tests.extend(get_excluded_tests(test_exclude_file))
8697

tests/skipped_tests_cuda.tbl

Lines changed: 820 additions & 0 deletions
Large diffs are not rendered by default.

tests/test_sycl_queue.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
for device in available_devices:
4040
if device.default_selector_score < 0:
4141
pass
42+
elif device.backend.name in "cuda":
43+
valid_devices = [device]
44+
break
4245
elif device.backend.name not in list_of_backend_str:
4346
pass
4447
elif device.device_type.name not in list_of_device_type_str:

0 commit comments

Comments
 (0)