Skip to content

Commit 4c78f7a

Browse files
authored
Merge branch 'main' into fix-pixi
2 parents ed54a2a + 46470ca commit 4c78f7a

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

cuda_core/cuda/core/_device.pyx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ cdef class DeviceProperties:
5858
cdef inline _get_attribute(self, cydriver.CUdevice_attribute attr):
5959
"""Retrieve the attribute value directly from the driver."""
6060
cdef int val
61+
cdef cydriver.CUresult err
6162
with nogil:
62-
HANDLE_RETURN(cydriver.cuDeviceGetAttribute(&val, attr, self._handle))
63+
err = cydriver.cuDeviceGetAttribute(&val, attr, self._handle)
64+
if err == cydriver.CUresult.CUDA_ERROR_INVALID_VALUE:
65+
return 0
66+
HANDLE_RETURN(err)
6367
return val
6468

6569
cdef _get_cached_attribute(self, attr):

cuda_core/tests/test_utils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,7 @@ def _check_view(self, view, in_arr):
9595
assert view.shape == in_arr.shape
9696
assert view.size == in_arr.size
9797
strides_in_counts = convert_strides_to_counts(in_arr.strides, in_arr.dtype.itemsize)
98-
if in_arr.flags.c_contiguous:
99-
assert view.strides is None
100-
else:
101-
assert view.strides == strides_in_counts
98+
assert (in_arr.flags.c_contiguous and view.strides is None) or view.strides == strides_in_counts
10299
assert view.dtype == in_arr.dtype
103100
assert view.device_id == -1
104101
assert view.is_device_accessible is False

0 commit comments

Comments
 (0)