File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#
2- # SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION.
2+ # SPDX-FileCopyrightText: Copyright (c) 2025-2026 , NVIDIA CORPORATION.
33# SPDX-License-Identifier: Apache-2.0
44#
55# cython: language_level=3
66
7- from cuda.bindings.cyruntime cimport cudaStream_t
7+ from libc.stdint cimport uintptr_t
88
99from cuvs.common.c_api cimport (
10+ cudaStream_t,
1011 cuvsMultiGpuResourcesCreate,
1112 cuvsMultiGpuResourcesCreateWithDeviceIds,
1213 cuvsMultiGpuResourcesDestroy,
@@ -84,11 +85,12 @@ cdef class MultiGpuResources:
8485 else :
8586 check_cuvs(cuvsMultiGpuResourcesCreate(& self .c_obj))
8687
87- if stream:
88- check_cuvs(cuvsStreamSet(self .c_obj, < cudaStream_t> stream))
88+ if stream is not None :
89+ check_cuvs(cuvsStreamSet(
90+ self .c_obj, < cudaStream_t>< uintptr_t> stream))
8991
9092 def sync (self ):
91- check_cuvs(cuvsStreamSync(self .c_obj))
93+ check_cuvs(cuvsStreamSync(self .c_obj))
9294
9395 def set_memory_pool (self , percent_of_free_memory ):
9496 """
Original file line number Diff line number Diff line change 11#
2- # SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION.
2+ # SPDX-FileCopyrightText: Copyright (c) 2024-2026 , NVIDIA CORPORATION.
33# SPDX-License-Identifier: Apache-2.0
44#
55# cython: language_level=3
66
77import functools
88
9- from cuda.bindings.cyruntime cimport cudaStream_t
9+ from libc.stdint cimport uintptr_t
1010
1111from cuvs.common.c_api cimport (
12+ cudaStream_t,
1213 cuvsResources_t,
1314 cuvsResourcesCreate,
1415 cuvsResourcesDestroy,
@@ -54,8 +55,8 @@ cdef class Resources:
5455
5556 def __cinit__ (self , stream = None ):
5657 check_cuvs(cuvsResourcesCreate(& self .c_obj))
57- if stream:
58- check_cuvs(cuvsStreamSet(self .c_obj, < cudaStream_t> stream))
58+ if stream is not None :
59+ check_cuvs(cuvsStreamSet(self .c_obj, < cudaStream_t>< uintptr_t > stream))
5960
6061 def sync (self ):
6162 check_cuvs(cuvsStreamSync(self .c_obj))
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
2+ # SPDX-License-Identifier: Apache-2.0
3+
4+ import gc
5+
6+ import cupy as cp
7+ import cuvs .common .resources as resources_mod
8+
9+ from cuvs .common import Resources
10+
11+
12+ def test_resources_syncs_cupy_stream_pointer ():
13+ # gh-issue: 1836 should not segfault when syncing a stream pointer from cupy
14+ stream = cp .cuda .Stream ()
15+ resources = Resources (stream = stream .ptr )
16+
17+ resources .sync ()
You can’t perform that action at this time.
0 commit comments