Common
Python module: cuvs.common
auto_sync_resources
Decorator to automatically call sync on a cuVS Resources object when it isn’t passed to a function.
When a resources=None is passed to the wrapped function, this decorator will automatically create a default resources for the function, and call sync on that resources when the function exits.
This will also insert the appropriate docstring for the resources parameter
Resources
Resources is a lightweight python wrapper around the corresponding C++ class of resources exposed by RAFT’s C++ interface. Refer to the header file raft/core/resources.hpp for interface level details of this struct.
Parameters
Examples
Basic usage:
Using a cuPy stream with cuVS Resources:
Tracking memory allocations to a CSV file:
Members
sync
set_memory_pool
Set a memory pool on the device used by these resources.
Call this before the first operation that configures or uses a
workspace or large workspace resource. RAFT captures the allocator
when it registers either resource, so later pool changes are rejected.
This method is unavailable for a handle created with
memory_tracking_csv_path; calling it raises CuvsException.
Parameters
set_stream_pool
Set a CUDA stream pool on these resources.
Parameters
get_c_obj
Return the pointer to the underlying c_obj as a size_t
MultiGpuResources
Multi-GPU Resources is a lightweight python wrapper around the corresponding C++ class of multi-GPU resources exposed by RAFT’s C++ interface. This class provides a handle for multi-GPU operations across all available GPUs.
Parameters
Examples
Basic usage:
Using a cuPy stream with cuVS Multi-GPU Resources:
Using specific device IDs:
Members
sync
set_memory_pool
Set a memory pool on all devices managed by these resources.
Call this before the first operation that configures or uses a workspace or large workspace resource on the handle or any managed device. Later pool changes are rejected.
Parameters
Examples
set_stream_pool
Set a CUDA stream pool on all devices managed by these resources.
Parameters
get_c_obj
Return the pointer to the underlying c_obj as a size_t
auto_sync_multi_gpu_resources
Decorator to automatically call sync on a cuVS Multi-GPU Resources object when it isn’t passed to a function.
When a resources=None is passed to the wrapped function, this decorator will automatically create a default multi-GPU resources for the function, and call sync on that resources when the function exits.
This will also insert the appropriate docstring for the resources parameter
Dataset
Wrapper around a cuvsDataset handle.
Members
memory_type
layout
is_owning
dtype
make_device_padded_dataset
@auto_sync_resources
Create a device-padded Dataset from a host or device array.
The input must be a row-major 2-D matrix. Host arrays are always copied into
newly allocated device-padded storage (is_owning is True). Device
arrays are copied when their row stride does not already match the
required padded width; if the stride is already correct, a non-owning
padded view of the input is returned and the caller must keep dataset
alive for as long as the Dataset is used.
Parameters
Returns
Examples
make_device_pq_dataset
@auto_sync_resources
Create an owning device PQ dataset.