For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
GitHubCUDA-X
    • Home
    • Installation
  • Getting Started
    • Introduction
    • Integrations
    • Use-cases
  • User Guide
    • API Guide
    • Benchmarking Guide
    • Compatibility
    • Integration Patterns
    • Advanced Topics
    • References
  • Developer Guide
    • Coding Guidelines
    • ABI Stability
    • Link-time Optimization
    • Contributing
  • API Reference
    • C API Documentation
    • Cpp API Documentation
      • Cluster Agglomerative
      • Cluster Kmeans
      • Cluster Spectral
      • Common Types
        • Execution Resources
        • Dense Array Views
        • Dense View Factories
        • Owning Dense Arrays
        • Owning Array Factories
        • Layouts and Extents
        • Sparse Array Types
        • Copy, Serialization, and Utility APIs
        • Errors and Logging
      • Distance Distance
      • Distance Grammian
      • Neighbors All Neighbors
      • Neighbors Ball Cover
      • Neighbors Brute Force
      • Neighbors Cagra
      • Neighbors Common
      • Neighbors Dynamic Batching
      • Neighbors Epsilon Neighborhood
      • Neighbors HNSW
      • Neighbors Composite Index
      • Neighbors IVF Flat
      • Neighbors IVF PQ
      • Neighbors NN Descent
      • Neighbors Refine
      • Neighbors Scann
      • Neighbors Tiered Index
      • Neighbors Vamana
      • Preprocessing Quantize Binary
      • Preprocessing PCA
      • Preprocessing Quantize PQ
      • Preprocessing Quantize Scalar
      • Preprocessing Spectral Embedding
      • Selection Select K
      • Stats Silhouette Score
      • Stats Trustworthiness Score
      • Util Cutlass Utils
      • Util File Io
    • Python API Documentation
    • Java API Documentation
    • Rust API Documentation
    • Go API Documentation
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Manage My Privacy | Do Not Sell or Share My Data | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogocuVS
GitHubCUDA-X
On this page
  • raft::resources
  • raft::resource::get_cuda_stream
  • raft::resource::sync_stream
  • raft::resource::set_cuda_stream_pool
  • raft::resource::get_stream_from_stream_pool
  • raft::resource::sync_stream_pool
  • raft::resource::set_workspace_to_pool_resource
  • raft::resource::comms_initialized
  • raft::resource::is_multi_gpu
  • raft::device_resources
  • raft::device_resources::device_resources
  • raft::device_resources::sync_stream
  • raft::device_resources::get_stream
  • raft::device_resources::is_stream_pool_initialized
  • raft::device_resources::get_stream_pool
  • raft::device_resources::get_stream_from_stream_pool
  • raft::device_resources::get_next_usable_stream
  • raft::device_resources::sync_stream_pool
  • raft::device_resources::wait_stream_pool_on_stream
  • raft::device_resources_snmg
  • raft::device_resources_snmg::device_resources_snmg
  • raft::device_resources_snmg::set_memory_pool
  • raft::device_resources_snmg::has_resource_factory
API ReferenceCpp API DocumentationCommon Types

Execution Resources

||View as Markdown|
Previous

Common Types

Next

Dense Array Views

Most NVIDIA cuVS C++ APIs accept raft::resources const& as the first argument. Resource objects carry execution state such as CUDA streams, CUDA library handles, memory resources, stream pools, and communication resources.

raft::resources

Source header: raft/core/resources.hpp

Primary execution context passed to most NVIDIA cuVS C++ APIs. The object gives algorithms access to shared CUDA streams, library handles, memory resources, and other lazily-created state.

1class resources;

raft::resource::get_cuda_stream

Source header: raft/core/resource/cuda_stream.hpp

Returns the CUDA stream associated with a resources object.

1rmm::cuda_stream_view get_cuda_stream(raft::resources const& res);

Parameters

NameTypeDescription
resraft::resources const&Resources object to query.

Returns

rmm::cuda_stream_view

raft::resource::sync_stream

Source header: raft/core/resource/cuda_stream.hpp

Synchronizes the CUDA stream associated with a resources object.

1void sync_stream(raft::resources const& res);
2void sync_stream(raft::resources const& res, rmm::cuda_stream_view stream);

Parameters

NameTypeDescription
resraft::resources const&Resources object to synchronize.
streamrmm::cuda_stream_viewOptional stream to synchronize instead of the main stream.

Returns

void

raft::resource::set_cuda_stream_pool

Source header: raft/core/resource/cuda_stream_pool.hpp

Attaches a CUDA stream pool to a resources object so algorithms can issue independent work on multiple streams.

1void set_cuda_stream_pool(raft::resources const& res,
2 std::shared_ptr<rmm::cuda_stream_pool> pool);

Parameters

NameTypeDescription
resraft::resources const&Resources object to configure.
poolstd::shared_ptr<rmm::cuda_stream_pool>Stream pool to attach.

Returns

void

raft::resource::get_stream_from_stream_pool

Source header: raft/core/resource/cuda_stream_pool.hpp

Returns a stream from the configured stream pool.

1rmm::cuda_stream_view get_stream_from_stream_pool(raft::resources const& res);

Parameters

NameTypeDescription
resraft::resources const&Resources object to query.

Returns

rmm::cuda_stream_view

raft::resource::sync_stream_pool

Source header: raft/core/resource/cuda_stream_pool.hpp

Synchronizes streams in the configured stream pool.

1void sync_stream_pool(raft::resources const& res);

Parameters

NameTypeDescription
resraft::resources const&Resources object to synchronize.

Returns

void

raft::resource::set_workspace_to_pool_resource

Source header: raft/core/resource/workspace_resource.hpp

Configures workspace allocation for algorithms that need temporary device memory.

1void set_workspace_to_pool_resource(
2 raft::resources const& res,
3 std::optional<std::size_t> allocation_limit = std::nullopt);

Parameters

NameTypeDescription
resraft::resources const&Resources object to configure.
allocation_limitstd::optional<std::size_t>Optional temporary workspace allocation limit in bytes.

Returns

void

raft::resource::comms_initialized

Source header: raft/core/resource/comms.hpp

Reports whether communication resources have been initialized.

1bool comms_initialized(raft::resources const& res);

Parameters

NameTypeDescription
resraft::resources const&Resources object to query.

Returns

bool

raft::resource::is_multi_gpu

Source header: raft/core/resource/comms.hpp

Reports whether a resources object is configured for multi-GPU use.

1bool is_multi_gpu(raft::resources const& res);

Parameters

NameTypeDescription
resraft::resources const&Resources object to query.

Returns

bool

raft::device_resources

Source header: raft/core/device_resources.hpp

Convenience raft::resources implementation for single-GPU applications and examples.

1class device_resources;

raft::device_resources::device_resources

Constructs a single-GPU resources object.

1device_resources(
2 rmm::cuda_stream_view stream_view = rmm::cuda_stream_per_thread,
3 std::shared_ptr<rmm::cuda_stream_pool> stream_pool = nullptr,
4 std::shared_ptr<rmm::mr::device_memory_resource> workspace_resource = nullptr,
5 std::optional<std::size_t> allocation_limit = std::nullopt);

Parameters

NameTypeDescription
stream_viewrmm::cuda_stream_viewDefault CUDA stream used by algorithms.
stream_poolstd::shared_ptr<rmm::cuda_stream_pool>Optional CUDA stream pool.
workspace_resourcestd::shared_ptr<rmm::mr::device_memory_resource>Optional workspace memory resource.
allocation_limitstd::optional<std::size_t>Optional temporary workspace allocation limit in bytes.

raft::device_resources::sync_stream

Synchronizes either the main stream or a specific CUDA stream.

1void sync_stream() const;
2void sync_stream(rmm::cuda_stream_view stream) const;

Parameters

NameTypeDescription
streamrmm::cuda_stream_viewStream to synchronize. Omit to synchronize the main stream.

Returns

void

raft::device_resources::get_stream

Returns the main CUDA stream associated with the resources object.

1rmm::cuda_stream_view get_stream() const;

Returns

rmm::cuda_stream_view

raft::device_resources::is_stream_pool_initialized

Reports whether a CUDA stream pool is configured.

1bool is_stream_pool_initialized() const;

Returns

bool

raft::device_resources::get_stream_pool

Returns the configured CUDA stream pool.

1rmm::cuda_stream_pool const& get_stream_pool() const;

Returns

rmm::cuda_stream_pool const&

raft::device_resources::get_stream_from_stream_pool

Returns a stream from the configured CUDA stream pool.

1rmm::cuda_stream_view get_stream_from_stream_pool() const;
2rmm::cuda_stream_view get_stream_from_stream_pool(std::size_t stream_idx) const;

Parameters

NameTypeDescription
stream_idxstd::size_tOptional index of the stream in the stream pool.

Returns

rmm::cuda_stream_view

raft::device_resources::get_next_usable_stream

Returns a stream from the pool when one exists; otherwise returns the main stream.

1rmm::cuda_stream_view get_next_usable_stream() const;
2rmm::cuda_stream_view get_next_usable_stream(std::size_t stream_idx) const;

Parameters

NameTypeDescription
stream_idxstd::size_tOptional stream pool index to use when a stream pool is configured.

Returns

rmm::cuda_stream_view

raft::device_resources::sync_stream_pool

Synchronizes all streams in the pool or a subset of stream indices.

1void sync_stream_pool() const;
2void sync_stream_pool(std::vector<std::size_t> stream_indices) const;

Parameters

NameTypeDescription
stream_indicesstd::vector<std::size_t>Optional stream indices to synchronize.

Returns

void

raft::device_resources::wait_stream_pool_on_stream

Makes the stream pool wait on work submitted to the main stream.

1void wait_stream_pool_on_stream() const;

Returns

void

raft::device_resources_snmg

Source header: raft/core/device_resources_snmg.hpp

Single-node multi-GPU resources object used by C++ APIs that operate over more than one local GPU.

1class device_resources_snmg;

raft::device_resources_snmg::device_resources_snmg

Constructs single-node multi-GPU resources for all GPUs or a subset.

1device_resources_snmg();
2device_resources_snmg(std::vector<int> const& device_ids);
3device_resources_snmg(device_resources_snmg const& world);

Parameters

NameTypeDescription
device_idsstd::vector<int> const&Optional list of local GPU device IDs to use.
worlddevice_resources_snmg const&Existing single-node multi-GPU resources object to copy.

raft::device_resources_snmg::set_memory_pool

Configures a memory pool on all GPUs managed by the resources object.

1void set_memory_pool(int percent_of_free_memory);

Parameters

NameTypeDescription
percent_of_free_memoryintPercentage of free memory to reserve for each memory pool.

Returns

void

raft::device_resources_snmg::has_resource_factory

Reports whether a resource factory is registered for a resource type.

1bool has_resource_factory(raft::resource::resource_type resource_type) const;

Parameters

NameTypeDescription
resource_typeraft::resource::resource_typeResource type to check.

Returns

bool