File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ cdef class _HelperCUpointer_attribute:
5050 # Return values
5151 cdef driver.CUcontext _ctx
5252 cdef unsigned int _uint
53+ cdef int _int
5354 cdef driver.CUdeviceptr _devptr
5455 cdef void** _void
5556 cdef driver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS _token
Original file line number Diff line number Diff line change @@ -247,12 +247,14 @@ cdef class _HelperCUpointer_attribute:
247247 else:
248248 self._cptr = <void*><void_ptr>init_value.getPtr()
249249 elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_MEMORY_TYPE'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_TYPE,{{endif}}
250- {{if 'CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL,{{endif}}
251250 {{if 'CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES,{{endif}}
252251 {{if 'CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE,{{endif}}
253252 {{if 'CU_POINTER_ATTRIBUTE_ACCESS_FLAGS'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS,{{endif}}):
254253 self._uint = init_value
255254 self._cptr = <void*>&self._uint
255+ elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL,{{endif}}):
256+ self._int = init_value
257+ self._cptr = <void*>&self._int
256258 elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_DEVICE_POINTER'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_POINTER,{{endif}}
257259 {{if 'CU_POINTER_ATTRIBUTE_RANGE_START_ADDR'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR,{{endif}}):
258260 if self._is_getter:
Original file line number Diff line number Diff line change 1+ .. SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+ .. SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
3+
4+ .. module :: cuda.bindings
5+
6+ ``cuda-bindings `` 13.1.X Release notes
7+ ======================================
8+
9+ Highlights
10+ ----------
11+
12+ Experimental
13+ ------------
14+
15+ Bugfixes
16+ --------
17+
18+ * Fixed an issue where the ``CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL `` attribute was
19+ retrieved as an unsigned int, rather than a signed int.
20+ (`PR #1336 <https://github.com/NVIDIA/cuda-python/pull/1336 >`_)
21+
22+ Known issues
23+ ------------
24+
25+ * Updating from older versions (v12.6.2.post1 and below) via ``pip install -U cuda-python `` might not work. Please do a clean re-installation by uninstalling ``pip uninstall -y cuda-python `` followed by installing ``pip install cuda-python ``.
26+ * The graphics APIs in ``cuda.bindings.runtime `` are inadvertently disabled in 13.0.2. Users needing these APIs should update to 13.0.3.
Original file line number Diff line number Diff line change @@ -370,6 +370,22 @@ def test_cuda_pointer_attr():
370370 assert err == cuda .CUresult .CUDA_SUCCESS
371371
372372
373+ @pytest .mark .skipif (
374+ driverVersionLessThan (11030 ) or not supportsManagedMemory (), reason = "When new attributes were introduced"
375+ )
376+ def test_pointer_get_attributes_device_ordinal ():
377+ attributes = [
378+ cuda .CUpointer_attribute .CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL ,
379+ ]
380+
381+ attrs = cuda .cuPointerGetAttributes (len (attributes ), attributes , 0 )
382+
383+ # device ordinals are always small numbers. A large number would indicate
384+ # an overflow error.
385+
386+ assert abs (attrs [1 ][0 ]) < 256
387+
388+
373389@pytest .mark .skipif (not supportsManagedMemory (), reason = "When new attributes were introduced" )
374390def test_cuda_mem_range_attr (device ):
375391 size = 0x1000
You can’t perform that action at this time.
0 commit comments