Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_raft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

# Use RAPIDS_VERSION_MAJOR_MINOR from rapids_config.cmake
set(RAFT_VERSION "${RAPIDS_VERSION_MAJOR_MINOR}")
set(RAFT_FORK "rapidsai")
set(RAFT_PINNED_TAG "${rapids-cmake-checkout-tag}")
set(RAFT_FORK "bdice")
set(RAFT_PINNED_TAG "cccl-mdspan")

function(find_and_configure_raft)
set(oneValueArgs VERSION FORK PINNED_TAG BUILD_STATIC_DEPS ENABLE_NVTX ENABLE_MNMG_DEPENDENCIES CLONE_ON_PIN)
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/cuvs/neighbors/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ auto make_strided_dataset(const raft::resources& res, const SrcT& src, uint32_t
}
// Something is wrong: have to make a copy and produce an owning dataset
auto out_layout =
raft::make_strided_layout(src.extents(), std::array<index_type, 2>{required_stride, 1});
raft::make_strided_layout(src.extents(), cuda::std::array<index_type, 2>{required_stride, 1});
auto out_array =
raft::make_device_matrix<value_type, index_type>(res, src.extent(0), required_stride);

Expand Down Expand Up @@ -321,7 +321,7 @@ auto make_strided_dataset(
const bool stride_matches = required_stride == src_stride;

auto out_layout =
raft::make_strided_layout(src.extents(), std::array<index_type, 2>{required_stride, 1});
raft::make_strided_layout(src.extents(), cuda::std::array<index_type, 2>{required_stride, 1});

using out_mdarray_type = raft::device_matrix<value_type, index_type>;
using out_layout_type = typename out_mdarray_type::layout_type;
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/cuvs/neighbors/ivf_pq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ struct index : cuvs::neighbors::index {
static_assert(!raft::is_narrowing_v<uint32_t, IdxT>,
"IdxT must be able to represent all values of uint32_t");

using pq_centers_extents = std::experimental::
extents<uint32_t, raft::dynamic_extent, raft::dynamic_extent, raft::dynamic_extent>;
using pq_centers_extents =
cuda::std::extents<uint32_t, raft::dynamic_extent, raft::dynamic_extent, raft::dynamic_extent>;

public:
index(const index&) = delete;
Expand Down
20 changes: 10 additions & 10 deletions cpp/src/cluster/detail/kmeans.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,8 @@ void kmeans_fit(raft::resources const& handle,
X,
weight.view(),
centroidsRawData.view(),
raft::make_host_scalar_view<DataT>(&iter_inertia),
raft::make_host_scalar_view<IndexT>(&n_current_iter),
raft::make_host_scalar_view<DataT, IndexT>(&iter_inertia),
raft::make_host_scalar_view<IndexT, IndexT>(&n_current_iter),
workspace);
if (iter_inertia < inertia[0]) {
inertia[0] = iter_inertia;
Expand Down Expand Up @@ -968,8 +968,8 @@ void kmeans_fit(raft::resources const& handle,
if (sample_weight)
sample_weightView =
raft::make_device_vector_view<const DataT, IndexT>(sample_weight, n_samples);
auto inertiaView = raft::make_host_scalar_view(&inertia);
auto n_iterView = raft::make_host_scalar_view(&n_iter);
auto inertiaView = raft::make_host_scalar_view<DataT, IndexT>(&inertia);
auto n_iterView = raft::make_host_scalar_view<IndexT, IndexT>(&n_iter);

cuvs::cluster::kmeans::detail::kmeans_fit<DataT, IndexT>(
handle, pams, XView, sample_weightView, centroidsView, inertiaView, n_iterView);
Expand Down Expand Up @@ -1102,7 +1102,7 @@ void kmeans_predict(raft::resources const& handle,
sample_weightView.emplace(
raft::make_device_vector_view<const DataT, IndexT>(sample_weight, n_samples));
auto labelsView = raft::make_device_vector_view<IndexT, IndexT>(labels, n_samples);
auto inertiaView = raft::make_host_scalar_view(&inertia);
auto inertiaView = raft::make_host_scalar_view<DataT, IndexT>(&inertia);

cuvs::cluster::kmeans::detail::kmeans_predict<DataT, IndexT>(handle,
pams,
Expand Down Expand Up @@ -1163,8 +1163,8 @@ void kmeans_fit_predict(raft::resources const& handle,
centroidsView.emplace(
raft::make_device_matrix_view<DataT, IndexT>(centroids, pams.n_clusters, n_features));
auto labelsView = raft::make_device_vector_view<IndexT, IndexT>(labels, n_samples);
auto inertiaView = raft::make_host_scalar_view(&inertia);
auto n_iterView = raft::make_host_scalar_view(&n_iter);
auto inertiaView = raft::make_host_scalar_view<DataT, IndexT>(&inertia);
auto n_iterView = raft::make_host_scalar_view<IndexT, IndexT>(&n_iter);

cuvs::cluster::kmeans::detail::kmeans_fit_predict<DataT, IndexT>(
handle, pams, XView, sample_weightView, centroidsView, labelsView, inertiaView, n_iterView);
Expand All @@ -1184,9 +1184,9 @@ void kmeans_fit_predict(raft::resources const& handle,
template <typename DataT, typename IndexT = int>
void kmeans_transform(raft::resources const& handle,
const cuvs::cluster::kmeans::params& pams,
raft::device_matrix_view<const DataT> X,
raft::device_matrix_view<const DataT> centroids,
raft::device_matrix_view<DataT> X_new)
raft::device_matrix_view<const DataT, IndexT> X,
raft::device_matrix_view<const DataT, IndexT> centroids,
raft::device_matrix_view<DataT, IndexT> X_new)
{
raft::common::nvtx::range<cuvs::common::nvtx::domain::cuvs> fun_scope("kmeans_transform");
raft::default_logger().set_level(pams.verbosity);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/cluster/detail/single_linkage.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace cuvs::cluster::agglomerative::detail {
template <typename value_t = float,
typename value_idx = int,
typename nnz_t = size_t,
typename Accessor = raft::device_accessor<std::experimental::default_accessor<value_t>>>
typename Accessor = raft::device_accessor<cuda::std::default_accessor<value_t>>>
void build_mr_linkage(
raft::resources const& handle,
raft::mdspan<const value_t, raft::matrix_extent<value_idx>, raft::row_major, Accessor> X,
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/cluster/kmeans.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
* Copyright (c) 2020-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -93,8 +93,8 @@ void fit(raft::resources const& handle,
raft::device_matrix_view<const DataT, IndexT> X,
std::optional<raft::device_vector_view<const DataT, IndexT>> sample_weight,
raft::device_matrix_view<DataT, IndexT> centroids,
raft::host_scalar_view<DataT> inertia,
raft::host_scalar_view<IndexT> n_iter)
raft::host_scalar_view<DataT, IndexT> inertia,
raft::host_scalar_view<IndexT, IndexT> n_iter)
{
// use the mnmg kmeans fit if we have comms initialize, single gpu otherwise
if (raft::resource::comms_initialized(handle)) {
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/cluster/kmeans_auto_find_k_float.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
* Copyright (c) 2022-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,9 +23,9 @@ namespace cuvs::cluster::kmeans::helpers {

void find_k(raft::resources const& handle,
raft::device_matrix_view<const float, int> X,
raft::host_scalar_view<int> best_k,
raft::host_scalar_view<float> inertia,
raft::host_scalar_view<int> n_iter,
raft::host_scalar_view<int, int> best_k,
raft::host_scalar_view<float, int> inertia,
raft::host_scalar_view<int, int> n_iter,
int kmax,
int kmin,
int maxiter,
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/cluster/kmeans_fit_predict_double.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
* Copyright (c) 2024-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,8 +25,8 @@ void fit_predict(raft::resources const& handle,
std::optional<raft::device_vector_view<const double, int>> sample_weight,
std::optional<raft::device_matrix_view<double, int>> centroids,
raft::device_vector_view<int, int> labels,
raft::host_scalar_view<double> inertia,
raft::host_scalar_view<int> n_iter)
raft::host_scalar_view<double, int> inertia,
raft::host_scalar_view<int, int> n_iter)

{
cuvs::cluster::kmeans::fit_predict<double, int>(
Expand All @@ -39,8 +39,8 @@ void fit_predict(raft::resources const& handle,
std::optional<raft::device_vector_view<const double, int64_t>> sample_weight,
std::optional<raft::device_matrix_view<double, int64_t>> centroids,
raft::device_vector_view<int64_t, int64_t> labels,
raft::host_scalar_view<double> inertia,
raft::host_scalar_view<int64_t> n_iter)
raft::host_scalar_view<double, int64_t> inertia,
raft::host_scalar_view<int64_t, int64_t> n_iter)

{
cuvs::cluster::kmeans::fit_predict<double, int64_t>(
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/cluster/kmeans_fit_predict_float.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
* Copyright (c) 2022-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,8 +25,8 @@ void fit_predict(raft::resources const& handle,
std::optional<raft::device_vector_view<const float, int>> sample_weight,
std::optional<raft::device_matrix_view<float, int>> centroids,
raft::device_vector_view<int, int> labels,
raft::host_scalar_view<float> inertia,
raft::host_scalar_view<int> n_iter)
raft::host_scalar_view<float, int> inertia,
raft::host_scalar_view<int, int> n_iter)

{
cuvs::cluster::kmeans::fit_predict<float, int>(
Expand All @@ -39,8 +39,8 @@ void fit_predict(raft::resources const& handle,
std::optional<raft::device_vector_view<const float, int64_t>> sample_weight,
std::optional<raft::device_matrix_view<float, int64_t>> centroids,
raft::device_vector_view<int64_t, int64_t> labels,
raft::host_scalar_view<float> inertia,
raft::host_scalar_view<int64_t> n_iter)
raft::host_scalar_view<float, int64_t> inertia,
raft::host_scalar_view<int64_t, int64_t> n_iter)

{
cuvs::cluster::kmeans::fit_predict<float, int64_t>(
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/cluster/kmeans_predict_double.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
* Copyright (c) 2024-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,7 +26,7 @@ void predict(raft::resources const& handle,
raft::device_matrix_view<const double, int> centroids,
raft::device_vector_view<int, int> labels,
bool normalize_weight,
raft::host_scalar_view<double> inertia)
raft::host_scalar_view<double, int> inertia)

{
cuvs::cluster::kmeans::predict<double, int>(
Expand All @@ -40,7 +40,7 @@ void predict(raft::resources const& handle,
raft::device_matrix_view<const double, int> centroids,
raft::device_vector_view<int64_t, int> labels,
bool normalize_weight,
raft::host_scalar_view<double> inertia)
raft::host_scalar_view<double, int> inertia)

{
cuvs::cluster::kmeans::predict<double, int64_t>(
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/cluster/kmeans_predict_float.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
* Copyright (c) 2022-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,7 +26,7 @@ void predict(raft::resources const& handle,
raft::device_matrix_view<const float, int> centroids,
raft::device_vector_view<int, int> labels,
bool normalize_weight,
raft::host_scalar_view<float> inertia)
raft::host_scalar_view<float, int> inertia)

{
cuvs::cluster::kmeans::predict<float, int>(
Expand All @@ -39,7 +39,7 @@ void predict(raft::resources const& handle,
raft::device_matrix_view<const float, int> centroids,
raft::device_vector_view<int64_t, int> labels,
bool normalize_weight,
raft::host_scalar_view<float> inertia)
raft::host_scalar_view<float, int> inertia)

{
cuvs::cluster::kmeans::predict<float, int64_t>(
Expand Down
31 changes: 14 additions & 17 deletions cpp/src/neighbors/cagra.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void build_knn_graph(
*/
template <typename DataT,
typename IdxT = uint32_t,
typename accessor = raft::host_device_accessor<std::experimental::default_accessor<DataT>,
typename accessor = raft::host_device_accessor<cuda::std::default_accessor<DataT>,
raft::memory_type::device>>
void build_knn_graph(
raft::resources const& res,
Expand Down Expand Up @@ -222,13 +222,12 @@ void build_knn_graph(
* @param[in,out] knn_graph a matrix view (host or device) of the input knn graph [n_rows,
* knn_graph_degree]
*/
template <
typename DataT,
typename IdxT = uint32_t,
typename d_accessor = raft::host_device_accessor<std::experimental::default_accessor<DataT>,
raft::memory_type::device>,
typename g_accessor =
raft::host_device_accessor<std::experimental::default_accessor<IdxT>, raft::memory_type::host>>
template <typename DataT,
typename IdxT = uint32_t,
typename d_accessor = raft::host_device_accessor<cuda::std::default_accessor<DataT>,
raft::memory_type::device>,
typename g_accessor =
raft::host_device_accessor<cuda::std::default_accessor<IdxT>, raft::memory_type::host>>
void sort_knn_graph(
raft::resources const& res,
cuvs::distance::DistanceType metric,
Expand All @@ -238,8 +237,7 @@ void sort_knn_graph(
using internal_IdxT = typename std::make_unsigned<IdxT>::type;

using g_accessor_internal =
raft::host_device_accessor<std::experimental::default_accessor<internal_IdxT>,
g_accessor::mem_type>;
raft::host_device_accessor<cuda::std::default_accessor<internal_IdxT>, g_accessor::mem_type>;
auto knn_graph_internal =
raft::mdspan<internal_IdxT, raft::matrix_extent<int64_t>, raft::row_major, g_accessor_internal>(
reinterpret_cast<internal_IdxT*>(knn_graph.data_handle()),
Expand Down Expand Up @@ -267,10 +265,9 @@ void sort_knn_graph(
* knn_graph_degree]
* @param[out] new_graph a host matrix view of the optimized knn graph [n_rows, graph_degree]
*/
template <
typename IdxT = uint32_t,
typename g_accessor =
raft::host_device_accessor<std::experimental::default_accessor<IdxT>, raft::memory_type::host>>
template <typename IdxT = uint32_t,
typename g_accessor =
raft::host_device_accessor<cuda::std::default_accessor<IdxT>, raft::memory_type::host>>
void optimize(
raft::resources const& res,
raft::mdspan<IdxT, raft::matrix_extent<int64_t>, raft::row_major, g_accessor> knn_graph,
Expand All @@ -281,9 +278,9 @@ void optimize(
}

template <typename T,
typename IdxT = uint32_t,
typename Accessor = raft::host_device_accessor<std::experimental::default_accessor<T>,
raft::memory_type::host>>
typename IdxT = uint32_t,
typename Accessor =
raft::host_device_accessor<cuda::std::default_accessor<T>, raft::memory_type::host>>
index<T, IdxT> build(
raft::resources const& res,
const index_params& params,
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/neighbors/detail/cagra/add_nodes.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
* Copyright (c) 2024-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -471,7 +471,7 @@ void extend_core(
using out_owning_type =
owning_dataset<T, int64_t, out_layout_type, out_container_policy_type>;
auto out_layout = raft::make_strided_layout(updated_dataset_view.extents(),
std::array<int64_t, 2>{stride, 1});
cuda::std::array<int64_t, 2>{stride, 1});

index.update_dataset(handle, out_owning_type{std::move(updated_dataset), out_layout});
}
Expand Down
Loading