libcuvs-cu12 25.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,265 @@
1
+ Metadata-Version: 2.1
2
+ Name: libcuvs-cu12
3
+ Version: 25.2.0
4
+ Summary: cuVS: Vector Search on the GPU (C++)
5
+ Author: NVIDIA Corporation
6
+ License: Apache 2.0
7
+ Classifier: Intended Audience :: Developers
8
+ Project-URL: Homepage, https://github.com/rapidsai/cuvs
9
+ Project-URL: Documentation, https://docs.rapids.ai/api/cuvs/stable/
10
+ Requires-Python: >=3.10
11
+ Requires-Dist: libraft-cu12==25.2.*
12
+ Requires-Dist: nvidia-cublas-cu12
13
+ Requires-Dist: nvidia-curand-cu12
14
+ Requires-Dist: nvidia-cusolver-cu12
15
+ Requires-Dist: nvidia-cusparse-cu12
16
+ Description-Content-Type: text/markdown
17
+
18
+ # <div align="left"><img src="https://rapids.ai/assets/images/rapids_logo.png" width="90px"/>&nbsp;cuVS: Vector Search and Clustering on the GPU</div>
19
+
20
+ > [!note]
21
+ > cuVS is a new library mostly derived from the approximate nearest neighbors and clustering algorithms in the [RAPIDS RAFT](https://github.com/rapidsai/raft) library of machine learning and data mining primitives. As of version 24.10 (Release in October 2024), cuVS contains the most fully-featured versions of the approximate nearest neighbors and clustering algorithms from RAFT. The algorithms which have been migrated over to cuVS will be removed from RAFT in version 24.12 (released in December 2024).
22
+
23
+ ## Contents
24
+
25
+ 1. [Useful Resources](#useful-resources)
26
+ 2. [What is cuVS?](#what-is-cuvs)
27
+ 3. [Installing cuVS](#installing-cuvs)
28
+ 4. [Getting Started](#getting-started)
29
+ 5. [Contributing](#contributing)
30
+ 6. [References](#references)
31
+
32
+ ## Useful Resources
33
+
34
+ - [Documentation](https://docs.rapids.ai/api/cuvs/nightly/): Library documentation.
35
+ - [Build and Install Guide](https://docs.rapids.ai/api/cuvs/nightly/build): Instructions for installing and building cuVS.
36
+ - [Getting Started Guide](https://docs.rapids.ai/api/cuvs/nightly/getting_started): Guide to getting started with cuVS.
37
+ - [Code Examples](https://github.com/rapidsai/cuvs/tree/HEAD/examples): Self-contained Code Examples.
38
+ - [API Reference Documentation](https://docs.rapids.ai/api/cuvs/nightly/api_docs): API Documentation.
39
+ - [RAPIDS Community](https://rapids.ai/community.html): Get help, contribute, and collaborate.
40
+ - [GitHub repository](https://github.com/rapidsai/cuvs): Download the cuVS source code.
41
+ - [Issue tracker](https://github.com/rapidsai/cuvs/issues): Report issues or request features.
42
+
43
+ ## What is cuVS?
44
+
45
+ cuVS contains state-of-the-art implementations of several algorithms for running approximate nearest neighbors and clustering on the GPU. It can be used directly or through the various databases and other libraries that have integrated it. The primary goal of cuVS is to simplify the use of GPUs for vector similarity search and clustering.
46
+
47
+ Vector search is an information retrieval method that has been growing in popularity over the past few years, partly because of the rising importance of multimedia embeddings created from unstructured data and the need to perform semantic search on the embeddings to find items which are semantically similar to each other.
48
+
49
+ Vector search is also used in _data mining and machine learning_ tasks and comprises an important step in many _clustering_ and _visualization_ algorithms like [UMAP](https://arxiv.org/abs/2008.00325), [t-SNE](https://lvdmaaten.github.io/tsne/), K-means, and [HDBSCAN](https://hdbscan.readthedocs.io/en/latest/how_hdbscan_works.html).
50
+
51
+ Finally, faster vector search enables interactions between dense vectors and graphs. Converting a pile of dense vectors into nearest neighbors graphs unlocks the entire world of graph analysis algorithms, such as those found in [GraphBLAS](https://graphblas.org/) and [cuGraph](https://github.com/rapidsai/cugraph).
52
+
53
+ Below are some common use-cases for vector search
54
+
55
+
56
+ - ### Semantic search
57
+ - Generative AI & Retrieval augmented generation (RAG)
58
+ - Recommender systems
59
+ - Computer vision
60
+ - Image search
61
+ - Text search
62
+ - Audio search
63
+ - Molecular search
64
+ - Model training
65
+
66
+
67
+ - ### Data mining
68
+ - Clustering algorithms
69
+ - Visualization algorithms
70
+ - Sampling algorithms
71
+ - Class balancing
72
+ - Ensemble methods
73
+ - k-NN graph construction
74
+
75
+ ## Why cuVS?
76
+
77
+ There are several benefits to using cuVS and GPUs for vector search, including
78
+
79
+ 1. Fast index build
80
+ 2. Latency critical and high throughput search
81
+ 3. Parameter tuning
82
+ 4. Cost savings
83
+ 5. Interoperability (build on GPU, deploy on CPU)
84
+ 6. Multiple language support
85
+ 7. Building blocks for composing new or accelerating existing algorithms
86
+
87
+ In addition to the items above, cuVS takes on the burden of keeping non-trivial accelerated code up to date as new NVIDIA architectures and CUDA versions are released. This provides a delightful development experience, guaranteeing that any libraries, databases, or applications built on top of it will always be getting the best performance and scale.
88
+
89
+ ## cuVS Technology Stack
90
+
91
+ cuVS is built on top of the RAPIDS RAFT library of high performance machine learning primitives and provides all the necessary routines for vector search and clustering on the GPU.
92
+
93
+ ![cuVS is built on top of low-level CUDA libraries and provides many important routines that enable vector search and clustering on the GPU](img/tech_stack.png "cuVS Technology Stack")
94
+
95
+
96
+
97
+ ## Installing cuVS
98
+
99
+ cuVS comes with pre-built packages that can be installed through [conda](https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-python) and [pip](https://pip.pypa.io/en/stable/). Different packages are available for the different languages supported by cuVS:
100
+
101
+ | Python | C/C++ |
102
+ |--------|-----------|
103
+ | `cuvs` | `libcuvs` |
104
+
105
+ ### Stable release
106
+
107
+ It is recommended to use [mamba](https://conda.github.io/conda-libmamba-solver/user-guide/) to install the desired packages. The following command will install the Python package. You can substitute `cuvs` for any of the packages in the table above:
108
+
109
+ ```bash
110
+ conda install -c conda-forge -c nvidia -c rapidsai cuvs
111
+ ```
112
+
113
+ The cuVS Python package can also be `installed through pip <https://docs.rapids.ai/install#pip>`_.
114
+
115
+ For CUDA 11 packages:
116
+ ```bash
117
+ pip install cuvs-cu11 --extra-index-url=https://pypi.nvidia.com
118
+ ````
119
+
120
+ And CUDA 12 packages:
121
+ ```bash
122
+ pip install cuvs-cu12 --extra-index-url=https://pypi.nvidia.com
123
+ ```
124
+
125
+ ### Nightlies
126
+ If installing a version that has not yet been released, the `rapidsai` channel can be replaced with `rapidsai-nightly`:
127
+
128
+ ```bash
129
+ conda install -c conda-forge -c nvidia -c rapidsai-nightly cuvs=25.02
130
+ ```
131
+
132
+ cuVS also has `pip` wheel packages that can be installed. Please see the [Build and Install Guide](https://docs.rapids.ai/api/cuvs/nightly/build/) for more information on installing the available cuVS packages and building from source.
133
+
134
+ ## Getting Started
135
+
136
+ The following code snippets train an approximate nearest neighbors index for the CAGRA algorithm in the various different languages supported by cuVS.
137
+
138
+ ### Python API
139
+
140
+ ```python
141
+ from cuvs.neighbors import cagra
142
+
143
+ dataset = load_data()
144
+ index_params = cagra.IndexParams()
145
+
146
+ index = cagra.build(build_params, dataset)
147
+ ```
148
+
149
+ ### C++ API
150
+
151
+ ```c++
152
+ #include <cuvs/neighbors/cagra.hpp>
153
+
154
+ using namespace cuvs::neighbors;
155
+
156
+ raft::device_matrix_view<float> dataset = load_dataset();
157
+ raft::device_resources res;
158
+
159
+ cagra::index_params index_params;
160
+
161
+ auto index = cagra::build(res, index_params, dataset);
162
+ ```
163
+
164
+ For more code examples of the C++ APIs, including drop-in Cmake project templates, please refer to the [C++ examples](https://github.com/rapidsai/cuvs/tree/HEAD/examples) directory in the codebase.
165
+
166
+ ### C API
167
+
168
+ ```c
169
+ #include <cuvs/neighbors/cagra.h>
170
+
171
+ cuvsResources_t res;
172
+ cuvsCagraIndexParams_t index_params;
173
+ cuvsCagraIndex_t index;
174
+
175
+ DLManagedTensor *dataset;
176
+ load_dataset(dataset);
177
+
178
+ cuvsResourcesCreate(&res);
179
+ cuvsCagraIndexParamsCreate(&index_params);
180
+ cuvsCagraIndexCreate(&index);
181
+
182
+ cuvsCagraBuild(res, index_params, dataset, index);
183
+
184
+ cuvsCagraIndexDestroy(index);
185
+ cuvsCagraIndexParamsDestroy(index_params);
186
+ cuvsResourcesDestroy(res);
187
+ ```
188
+
189
+ For more code examples of the C APIs, including drop-in Cmake project templates, please refer to the [C examples](https://github.com/rapidsai/cuvs/tree/branch-25.02/examples/c)
190
+
191
+ ### Rust API
192
+
193
+ ```rust
194
+ use cuvs::cagra::{Index, IndexParams, SearchParams};
195
+ use cuvs::{ManagedTensor, Resources, Result};
196
+
197
+ use ndarray::s;
198
+ use ndarray_rand::rand_distr::Uniform;
199
+ use ndarray_rand::RandomExt;
200
+
201
+ /// Example showing how to index and search data with CAGRA
202
+ fn cagra_example() -> Result<()> {
203
+ let res = Resources::new()?;
204
+
205
+ // Create a new random dataset to index
206
+ let n_datapoints = 65536;
207
+ let n_features = 512;
208
+ let dataset =
209
+ ndarray::Array::<f32, _>::random((n_datapoints, n_features), Uniform::new(0., 1.0));
210
+
211
+ // build the cagra index
212
+ let build_params = IndexParams::new()?;
213
+ let index = Index::build(&res, &build_params, &dataset)?;
214
+ println!(
215
+ "Indexed {}x{} datapoints into cagra index",
216
+ n_datapoints, n_features
217
+ );
218
+
219
+ // use the first 4 points from the dataset as queries : will test that we get them back
220
+ // as their own nearest neighbor
221
+ let n_queries = 4;
222
+ let queries = dataset.slice(s![0..n_queries, ..]);
223
+
224
+ let k = 10;
225
+
226
+ // CAGRA search API requires queries and outputs to be on device memory
227
+ // copy query data over, and allocate new device memory for the distances/ neighbors
228
+ // outputs
229
+ let queries = ManagedTensor::from(&queries).to_device(&res)?;
230
+ let mut neighbors_host = ndarray::Array::<u32, _>::zeros((n_queries, k));
231
+ let neighbors = ManagedTensor::from(&neighbors_host).to_device(&res)?;
232
+
233
+ let mut distances_host = ndarray::Array::<f32, _>::zeros((n_queries, k));
234
+ let distances = ManagedTensor::from(&distances_host).to_device(&res)?;
235
+
236
+ let search_params = SearchParams::new()?;
237
+
238
+ index.search(&res, &search_params, &queries, &neighbors, &distances)?;
239
+
240
+ // Copy back to host memory
241
+ distances.to_host(&res, &mut distances_host)?;
242
+ neighbors.to_host(&res, &mut neighbors_host)?;
243
+
244
+ // nearest neighbors should be themselves, since queries are from the
245
+ // dataset
246
+ println!("Neighbors {:?}", neighbors_host);
247
+ println!("Distances {:?}", distances_host);
248
+ Ok(())
249
+ }
250
+ ```
251
+
252
+ For more code examples of the Rust APIs, including a drop-in project templates, please refer to the [Rust examples](https://github.com/rapidsai/cuvs/tree/branch-25.02/examples/rust).
253
+
254
+ ## Contributing
255
+
256
+ If you are interested in contributing to the cuVS library, please read our [Contributing guidelines](docs/source/contributing.md). Refer to the [Developer Guide](docs/source/developer_guide.md) for details on the developer guidelines, workflows, and principles.
257
+
258
+ ## References
259
+
260
+ For the interested reader, many of the accelerated implementations in cuVS are also based on research papers which can provide a lot more background. We also ask you to please cite the corresponding algorithms by referencing them in your own research.
261
+ - [CAGRA: Highly Parallel Graph Construction and Approximate Nearest Neighbor Search](https://arxiv.org/abs/2308.15136)
262
+ - [Top-K Algorithms on GPU: A Comprehensive Study and New Methods](https://dl.acm.org/doi/10.1145/3581784.3607062)
263
+ - [Fast K-NN Graph Construction by GPU Based NN-Descent](https://dl.acm.org/doi/abs/10.1145/3459637.3482344?casa_token=O_nan1B1F5cAAAAA:QHWDEhh0wmd6UUTLY9_Gv6c3XI-5DXM9mXVaUXOYeStlpxTPmV3nKvABRfoivZAaQ3n8FWyrkWw>)
264
+ - [cuSLINK: Single-linkage Agglomerative Clustering on the GPU](https://arxiv.org/abs/2306.16354)
265
+ - [GPU Semiring Primitives for Sparse Neighborhood Methods](https://arxiv.org/abs/2104.06357)
@@ -0,0 +1,10 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2
3
+
4
+ [build-system]
5
+ requires = ["wheel-stub"]
6
+ build-backend = "wheel_stub.buildapi"
7
+
8
+ [tool.wheel_stub]
9
+ index_url = "https://pypi.nvidia.com/"
10
+ include_cuda_debuginfo = true