Skip to content

Commit 0c64722

Browse files
committed
Applied review comments
1 parent fe8fe11 commit 0c64722

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

dpnp/dpnp_iface.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,14 +760,14 @@ def get_usm_ndarray_or_scalar(a):
760760

761761
def is_cuda_backend(obj=None):
762762
"""
763-
Checks that object has a cuda backend.
763+
Checks that object has a CUDA backend.
764764
765765
Parameters
766766
----------
767767
obj : {Device, SyclDevice, SyclQueue, dpnp.ndarray, usm_ndarray, None},
768768
optional
769769
An input object with sycl_device property to check device backend.
770-
If obj is ``None``, device backend will be checked for the default
770+
If `obj` is ``None``, device backend will be checked for the default
771771
queue.
772772
Default: ``None``.
773773
@@ -784,7 +784,10 @@ def is_cuda_backend(obj=None):
784784
sycl_device = obj
785785
else:
786786
sycl_device = getattr(obj, "sycl_device", None)
787-
if sycl_device is not None and "cuda" in sycl_device.backend.name:
787+
if (
788+
sycl_device is not None
789+
and sycl_device.backend == dpctl.backend_type.cuda
790+
):
788791
return True
789792
return False
790793

tests/conftest.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,12 @@ def pytest_collection_modifyitems(config, items):
6565
)
6666

6767
# global skip file for cuda backend
68-
test_exclude_file_cuda = os.path.join(
69-
test_path, "skipped_tests_cuda.tbl"
70-
)
68+
test_exclude_file_cuda = os.path.join(test_path, "skipped_tests_cuda.tbl")
7169

7270
dev = dpctl.select_default_device()
7371
is_cpu = dev.is_cpu
7472
is_gpu_no_fp64 = not dev.has_aspect_fp64
75-
is_cuda = "cuda" in str(dev.backend.name)
73+
is_cuda = dpnp.is_cuda_backend(dev)
7674

7775
print("")
7876
print(f"DPNP current device is CPU: {is_cpu}")
@@ -89,9 +87,7 @@ def pytest_collection_modifyitems(config, items):
8987
get_excluded_tests(test_exclude_file_gpu_no_fp64)
9088
)
9189
if is_cuda:
92-
excluded_tests.extend(
93-
get_excluded_tests(test_exclude_file_cuda)
94-
)
90+
excluded_tests.extend(get_excluded_tests(test_exclude_file_cuda))
9591
else:
9692
excluded_tests.extend(get_excluded_tests(test_exclude_file))
9793

tests/skipped_tests_cuda.tbl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ tests/test_random_state.py::TestNormal::test_distr[host-float32]
379379
tests/test_random_state.py::TestNormal::test_distr[host-float64]
380380
tests/test_random_state.py::TestNormal::test_distr[host-None]
381381
tests/test_random_state.py::TestNormal::test_distr[device-float32]
382-
tests/test_random_state.py::TestNormal::test_distr[device-float64]
382+
tests/test_random_state.py::TestNormal::test_distr[device-float64]
383383
tests/test_random_state.py::TestNormal::test_distr[device-None]
384384
tests/test_random_state.py::TestNormal::test_distr[shared-float32]
385385
tests/test_random_state.py::TestNormal::test_distr[shared-float64]
@@ -391,7 +391,7 @@ tests/test_random_state.py::TestNormal::test_scale[device-float32]
391391
tests/test_random_state.py::TestNormal::test_scale[device-float64]
392392
tests/test_random_state.py::TestNormal::test_scale[device-None]
393393
tests/test_random_state.py::TestNormal::test_scale[shared-float32]
394-
tests/test_random_state.py::TestNormal::test_scale[shared-float64]
394+
tests/test_random_state.py::TestNormal::test_scale[shared-float64]
395395
tests/test_random_state.py::TestNormal::test_scale[shared-None]
396396
tests/test_random_state.py::TestNormal::test_inf_loc[numpy.inf]
397397
tests/test_random_state.py::TestNormal::test_inf_loc[-numpy.inf]

0 commit comments

Comments
 (0)