Skip to content

Commit 9cd8b1f

Browse files
authored
Merge branch 'main' into cagra-extend-remove-unused
2 parents b220cd4 + 10f71c7 commit 9cd8b1f

109 files changed

Lines changed: 8491 additions & 1696 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 915 additions & 915 deletions
Large diffs are not rendered by default.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

44
# syntax=docker/dockerfile:1.5
@@ -34,7 +34,7 @@ RUN echo " Building cuVS Docker image with:" && \
3434
# Container metadata
3535
LABEL maintainer="RAPIDS cuVS Team"
3636
LABEL description="RAPIDS cuVS - Vector Search and Clustering on GPU"
37-
LABEL org.opencontainers.image.source="https://github.com/rapidsai/cuvs"
37+
LABEL org.opencontainers.image.source="https://github.com/nvidia/cuvs"
3838
LABEL org.opencontainers.image.usage="docker run --gpus all -it <image>"
3939

4040
# Environment setup

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212

1313
## Useful Resources
1414

15-
- [Documentation](https://docs.rapids.ai/api/cuvs/nightly/): Library documentation.
16-
- [Build and Install Guide](https://docs.rapids.ai/api/cuvs/nightly/build): Instructions for installing and building cuVS.
17-
- [Getting Started Guide](https://docs.rapids.ai/api/cuvs/nightly/getting_started): Guide to getting started with cuVS.
18-
- [Code Examples](https://github.com/rapidsai/cuvs/tree/HEAD/examples): Self-contained Code Examples.
19-
- [API Reference Documentation](https://docs.rapids.ai/api/cuvs/nightly/api_docs): API Documentation.
15+
- [Documentation](https://docs.nvidia.com/cuvs): Library documentation.
16+
- [Build and Install Guide](https://docs.nvidia.com/cuvs/installation): Instructions for installing and building cuVS.
17+
- [Getting Started Guide](https://docs.nvidia.com/cuvs/getting-started): Guide to getting started with cuVS.
18+
- [Code Examples](https://github.com/nvidia/cuvs/tree/HEAD/examples): Self-contained Code Examples.
19+
- [API Reference Documentation](https://docs.nvidia.com/cuvs/api_reference): API Documentation.
2020
- [RAPIDS Community](https://rapids.ai/community.html): Get help, contribute, and collaborate.
21-
- [GitHub repository](https://github.com/rapidsai/cuvs): Download the cuVS source code.
22-
- [Issue tracker](https://github.com/rapidsai/cuvs/issues): Report issues or request features.
21+
- [GitHub repository](https://github.com/nvidia/cuvs): Download the cuVS source code.
22+
- [Issue tracker](https://github.com/nvidia/cuvs/issues): Report issues or request features.
2323

2424
## What is cuVS?
2525

@@ -114,7 +114,7 @@ cagra::index_params index_params;
114114
auto index = cagra::build(res, index_params, dataset);
115115
```
116116
117-
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.
117+
For more code examples of the C++ APIs, including drop-in Cmake project templates, please refer to the [C++ examples](https://github.com/nvidia/cuvs/tree/HEAD/examples) directory in the codebase.
118118
119119
### C API
120120
@@ -143,7 +143,7 @@ cuvsCagraIndexParamsDestroy(index_params);
143143
cuvsResourcesDestroy(res);
144144
```
145145

146-
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/main/examples/c)
146+
For more code examples of the C APIs, including drop-in Cmake project templates, please refer to the [C examples](https://github.com/nvidia/cuvs/tree/main/examples/c)
147147

148148
### Rust API
149149

@@ -190,6 +190,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
190190
}
191191
```
192192

193+
For more code examples of the Rust APIs, including a drop-in project templates, please refer to the [Rust examples](https://github.com/nvidia/cuvs/tree/main/examples/rust).
193194

194195
## Contributing
195196

ci/build_java.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
2+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44

55
set -euo pipefail
@@ -12,7 +12,7 @@ export SCCACHE_S3_USE_PREPROCESSOR_CACHE_MODE=true
1212

1313
# TODO: Remove this argument-handling when build and test workflows are separated,
1414
# and test_java.sh no longer calls build_java.sh
15-
# ref: https://github.com/rapidsai/cuvs/issues/868
15+
# ref: https://github.com/nvidia/cuvs/issues/868
1616
EXTRA_BUILD_ARGS=()
1717
if [[ "${1:-}" == "--run-java-tests" ]]; then
1818
EXTRA_BUILD_ARGS+=("--run-java-tests")

ci/check_c_abi/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
1+
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

44
[project]
@@ -16,7 +16,7 @@ dependencies = ["libclang", "msgspec", "termcolor"]
1616
check-c-abi = "check_c_abi.main:main_cli"
1717

1818
[project.urls]
19-
Homepage = "https://github.com/rapidsai/cuvs"
19+
Homepage = "https://github.com/nvidia/cuvs"
2020

2121
[tool.setuptools.dynamic]
2222
version = { file = "VERSION" }

ci/test_java.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION.
2+
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44

55
set -euo pipefail
@@ -17,7 +17,7 @@ RAPIDS_CUDA_MAJOR="${RAPIDS_CUDA_VERSION%%.*}"
1717
export RAPIDS_CUDA_MAJOR
1818

1919
# TODO: switch to installing pre-built artifacts instead of rebuilding in test jobs
20-
# ref: https://github.com/rapidsai/cuvs/issues/868
20+
# ref: https://github.com/nvidia/cuvs/issues/868
2121
ci/build_java.sh --run-java-tests
2222

2323
rapids-logger "Test script exiting with value: $EXITCODE"

cpp/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,8 @@ if(NOT BUILD_CPU_ONLY)
13321332
cuvs_objs OBJECT
13331333
src/cluster/detail/minClusterDistanceCompute.cu
13341334
src/cluster/agglomerative.cu
1335+
src/cluster/gmm_double.cu
1336+
src/cluster/gmm_float.cu
13351337
src/cluster/kmeans_cluster_cost.cu
13361338
src/cluster/kmeans_fit_double.cu
13371339
src/cluster/kmeans_fit_float.cu

cpp/bench/ann/src/cuvs/cuvs_ann_bench_param_parser.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,14 @@ void parse_build_param(const nlohmann::json& conf,
416416
throw std::runtime_error("invalid value for merge_type");
417417
}
418418
}
419+
420+
nlohmann::json comp_search_conf = collect_conf_with_prefix(conf, "compression_");
421+
if (!comp_search_conf.empty()) {
422+
auto vpq_pams = param.compression.value_or(cuvs::neighbors::vpq_params{});
423+
parse_build_param(comp_search_conf, vpq_pams);
424+
param.compression.emplace(vpq_pams);
425+
}
426+
419427
param.cagra_params = [conf](raft::matrix_extent<int64_t> extents,
420428
cuvs::distance::DistanceType dist_type) {
421429
// Delayed parsing/initialization of cagra_params - it's called once the dataset shape is known

cpp/bench/ann/src/cuvs/cuvs_cagra_diskann_wrapper.h

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@
88
#include <cuvs/neighbors/hnsw.hpp>
99
#include <raft/core/logger.hpp>
1010

11+
#include <algorithm>
1112
#include <chrono>
13+
#include <filesystem>
14+
#include <fstream>
15+
#include <iterator>
1216
#include <memory>
1317
#include <optional>
1418
#include <variant>
1519

1620
#include "../common/ann_types.hpp"
21+
#include "../common/blob.hpp"
22+
#include "../common/conf.hpp"
1723
#include "../diskann/diskann_wrapper.h"
1824
#include "cuvs_ann_bench_utils.h"
1925
#include <cuvs/neighbors/vamana.hpp>
@@ -165,51 +171,35 @@ void cuvs_cagra_diskann<T, IdxT>::save(const std::string& file) const
165171
index_of.close();
166172
if (!index_of) { RAFT_FAIL("Error writing output %s", file.c_str()); }
167173

168-
// try allocating a buffer for the dataset on host
169-
try {
170-
auto const* idx_ptr = cagra_build_.get_index();
171-
std::optional<raft::host_matrix<T, int64_t>> h_dataset = std::nullopt;
172-
auto const& data_view = idx_ptr->dataset();
173-
if constexpr (cuvs::neighbors::is_padded_dataset_view_v<std::decay_t<decltype(data_view)>>) {
174-
auto const& v = data_view;
175-
auto n_rows = v.n_rows();
176-
auto dim = v.dim();
177-
auto stride = v.stride();
178-
h_dataset.emplace(raft::make_host_matrix<T, int64_t>(n_rows, dim));
179-
raft::copy_matrix(h_dataset->data_handle(),
180-
dim,
181-
v.view().data_handle(),
182-
stride,
183-
dim,
184-
n_rows,
185-
raft::resource::get_cuda_stream(handle_));
186-
} else {
187-
RAFT_LOG_DEBUG("dataset serialization: index dataset is not device_padded_dataset_view");
188-
}
189-
190-
if (h_dataset.has_value()) {
191-
raft::resource::sync_stream(handle_);
192-
std::string dataset_base_file = file + ".data";
193-
std::ofstream dataset_of(dataset_base_file, std::ios::out | std::ios::binary);
194-
if (!dataset_of) { RAFT_FAIL("Cannot open file %s", dataset_base_file.c_str()); }
195-
size_t dataset_file_offset = 0;
196-
int size = static_cast<int>(cagra_build_.get_index()->size());
197-
int dim = static_cast<int>(cagra_build_.get_index()->dim());
198-
dataset_of.seekp(dataset_file_offset, dataset_of.beg);
199-
dataset_of.write((char*)&size, sizeof(int));
200-
dataset_of.write((char*)&dim, sizeof(int));
201-
for (int i = 0; i < size; i++) {
202-
dataset_of.write((char*)(h_dataset->data_handle() + i * h_dataset->extent(1)),
203-
dim * sizeof(T));
204-
}
205-
dataset_of.close();
206-
if (!dataset_of) { RAFT_FAIL("Error writing output %s", dataset_base_file.c_str()); }
207-
}
208-
} catch (std::bad_alloc& e) {
209-
RAFT_LOG_INFO("Failed to serialize dataset");
210-
} catch (raft::logic_error& e) {
211-
RAFT_LOG_INFO("Failed to serialize dataset");
212-
}
174+
// Write the rows next to the graph; diskann::Index::load() reads them from `<file>.data`.
175+
// The benchmark base file is already in the same bin format, so copy it rather than pull the
176+
// rows out of memory - this way `save()` does not care where the dataset was allocated.
177+
const auto& ds_conf = configuration::singleton().get_dataset_conf();
178+
blob_file<T> base{ds_conf.base_file, ds_conf.subset_first_row, ds_conf.subset_size};
179+
int size = static_cast<int>(base.rows_limit());
180+
int dim = static_cast<int>(base.n_cols());
181+
RAFT_EXPECTS(dim == this->dim_, "base_file dimensionality does not match the index");
182+
183+
size_t header_bytes = 2 * sizeof(uint32_t);
184+
size_t skip_bytes = sizeof(T) * static_cast<size_t>(base.rows_offset()) * dim;
185+
size_t copy_bytes = sizeof(T) * static_cast<size_t>(size) * dim;
186+
RAFT_EXPECTS(std::filesystem::file_size(base.path()) >= header_bytes + skip_bytes + copy_bytes,
187+
"base_file is shorter than its header claims");
188+
189+
std::ifstream base_in(base.path(), std::ios::in | std::ios::binary);
190+
if (!base_in) { RAFT_FAIL("Cannot open file %s", base.path().c_str()); }
191+
base_in.seekg(header_bytes + skip_bytes);
192+
193+
std::string dataset_base_file = file + ".data";
194+
std::ofstream dataset_of(dataset_base_file, std::ios::out | std::ios::binary);
195+
if (!dataset_of) { RAFT_FAIL("Cannot open file %s", dataset_base_file.c_str()); }
196+
dataset_of.write((char*)&size, sizeof(int));
197+
dataset_of.write((char*)&dim, sizeof(int));
198+
std::copy_n(std::istreambuf_iterator<char>(base_in),
199+
copy_bytes,
200+
std::ostreambuf_iterator<char>(dataset_of));
201+
dataset_of.close();
202+
if (!base_in || !dataset_of) { RAFT_FAIL("Error writing output %s", dataset_base_file.c_str()); }
213203
}
214204

215205
template <typename T, typename IdxT>

0 commit comments

Comments
 (0)