Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward-merge branch-24.12 into branch-25.02 #6152

Merged
merged 1 commit into from
Dec 2, 2024
Merged
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
2 changes: 1 addition & 1 deletion cpp/bench/sg/dbscan.cu
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Dbscan : public BlobsFixture<D, int> {
this->params.ncols,
D(dParams.eps),
dParams.min_pts,
raft::distance::L2SqrtUnexpanded,
cuvs::distance::DistanceType::L2SqrtUnexpanded,
this->data.y.data(),
this->core_sample_indices,
nullptr,
Expand Down
3 changes: 2 additions & 1 deletion cpp/bench/sg/kmeans.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#include <cuml/cluster/kmeans.hpp>
#include <cuml/common/logger.hpp>

#include <raft/distance/distance_types.hpp>
#include <raft/random/rng_state.hpp>

#include <cuvs/distance/distance.hpp>

#include <utility>

namespace ML {
Expand Down
5 changes: 3 additions & 2 deletions cpp/bench/sg/linkage.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#include <cuml/cluster/linkage.hpp>
#include <cuml/common/logger.hpp>

#include <raft/distance/distance_types.hpp>
#include <raft/sparse/hierarchy/common.h>

#include <cuvs/distance/distance.hpp>

#include <utility>

namespace ML {
Expand Down Expand Up @@ -55,7 +56,7 @@ class Linkage : public BlobsFixture<D> {
this->params.nrows,
this->params.ncols,
&out_arrs,
raft::distance::DistanceType::L2Unexpanded,
cuvs::distance::DistanceType::L2Unexpanded,
15,
50);
});
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/dbscan/dbscan_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ int main(int argc, char* argv[])
nCols,
eps,
minPts,
raft::distance::L2SqrtUnexpanded,
cuvs::distance::DistanceType::L2SqrtUnexpanded,
d_labels,
nullptr,
nullptr,
Expand Down
10 changes: 5 additions & 5 deletions cpp/include/cuml/cluster/dbscan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <cuml/common/log_levels.hpp>

#include <raft/distance/distance_types.hpp>
#include <cuvs/distance/distance.hpp>

#include <cstddef>
#include <cstdint>
Expand Down Expand Up @@ -67,7 +67,7 @@ void fit(const raft::handle_t& handle,
int n_cols,
float eps,
int min_pts,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
int* labels,
int* core_sample_indices = nullptr,
float* sample_weight = nullptr,
Expand All @@ -81,7 +81,7 @@ void fit(const raft::handle_t& handle,
int n_cols,
double eps,
int min_pts,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
int* labels,
int* core_sample_indices = nullptr,
double* sample_weight = nullptr,
Expand All @@ -96,7 +96,7 @@ void fit(const raft::handle_t& handle,
int64_t n_cols,
float eps,
int min_pts,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
int64_t* labels,
int64_t* core_sample_indices = nullptr,
float* sample_weight = nullptr,
Expand All @@ -110,7 +110,7 @@ void fit(const raft::handle_t& handle,
int64_t n_cols,
double eps,
int min_pts,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
int64_t* labels,
int64_t* core_sample_indices = nullptr,
double* sample_weight = nullptr,
Expand Down
13 changes: 7 additions & 6 deletions cpp/include/cuml/cluster/hdbscan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
#pragma once

#include <raft/core/handle.hpp>
#include <raft/distance/distance_types.hpp>

#include <rmm/device_uvector.hpp>

#include <cuvs/distance/distance.hpp>

#include <cstddef>

namespace ML {
Expand Down Expand Up @@ -424,7 +425,7 @@ void hdbscan(const raft::handle_t& handle,
const float* X,
size_t m,
size_t n,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
HDBSCAN::Common::HDBSCANParams& params,
HDBSCAN::Common::hdbscan_output<int, float>& out,
float* core_dists);
Expand Down Expand Up @@ -456,7 +457,7 @@ void compute_all_points_membership_vectors(
HDBSCAN::Common::CondensedHierarchy<int, float>& condensed_tree,
HDBSCAN::Common::PredictionData<int, float>& prediction_data,
const float* X,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
float* membership_vec,
size_t batch_size = 4096);

Expand All @@ -467,7 +468,7 @@ void compute_membership_vector(const raft::handle_t& handle,
const float* points_to_predict,
size_t n_prediction_points,
int min_samples,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
float* membership_vec,
size_t batch_size = 4096);

Expand All @@ -478,7 +479,7 @@ void out_of_sample_predict(const raft::handle_t& handle,
int* labels,
const float* points_to_predict,
size_t n_prediction_points,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
int min_samples,
int* out_labels,
float* out_probabilities);
Expand All @@ -501,7 +502,7 @@ void compute_core_dists(const raft::handle_t& handle,
float* core_dists,
size_t m,
size_t n,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
int min_samples);

/**
Expand Down
9 changes: 5 additions & 4 deletions cpp/include/cuml/cluster/linkage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
#pragma once

#include <raft/core/handle.hpp>
#include <raft/distance/distance_types.hpp>
#include <raft/sparse/hierarchy/common.h>

#include <cuvs/distance/distance.hpp>

namespace raft {
class handle_t;
}
Expand All @@ -46,7 +47,7 @@ void single_linkage_pairwise(const raft::handle_t& handle,
size_t m,
size_t n,
raft::hierarchy::linkage_output<int>* out,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
int n_clusters = 5);

/**
Expand Down Expand Up @@ -74,7 +75,7 @@ void single_linkage_neighbors(
size_t m,
size_t n,
raft::hierarchy::linkage_output<int>* out,
raft::distance::DistanceType metric = raft::distance::DistanceType::L2Unexpanded,
cuvs::distance::DistanceType metric = cuvs::distance::DistanceType::L2Unexpanded,
int c = 15,
int n_clusters = 5);

Expand All @@ -83,7 +84,7 @@ void single_linkage_pairwise(const raft::handle_t& handle,
size_t m,
size_t n,
raft::hierarchy::linkage_output<int64_t>* out,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
int n_clusters = 5);

}; // namespace ML
4 changes: 2 additions & 2 deletions cpp/include/cuml/manifold/tsne.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <cuml/common/logger.hpp>

#include <raft/distance/distance_types.hpp>
#include <cuvs/distance/distance.hpp>

namespace raft {
class handle_t;
Expand Down Expand Up @@ -106,7 +106,7 @@ struct TSNEParams {
bool square_distances = true;

// Distance metric to use.
raft::distance::DistanceType metric = raft::distance::DistanceType::L2SqrtExpanded;
cuvs::distance::DistanceType metric = cuvs::distance::DistanceType::L2SqrtExpanded;

// Value of p for Minkowski distance
float p = 2.0;
Expand Down
5 changes: 3 additions & 2 deletions cpp/include/cuml/manifold/umapparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#include <cuml/common/callback.hpp>
#include <cuml/common/logger.hpp>

#include <raft/distance/distance_types.hpp>
#include <raft/neighbors/nn_descent_types.hpp>

#include <cuvs/distance/distance.hpp>

namespace ML {

using nn_index_params = raft::neighbors::experimental::nn_descent::index_params;
Expand Down Expand Up @@ -170,7 +171,7 @@ class UMAPParams {
*/
bool deterministic = true;

raft::distance::DistanceType metric = raft::distance::DistanceType::L2SqrtExpanded;
cuvs::distance::DistanceType metric = cuvs::distance::DistanceType::L2SqrtExpanded;

float p = 2.0;

Expand Down
20 changes: 10 additions & 10 deletions cpp/include/cuml/metrics/metrics.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023, NVIDIA CORPORATION.
* Copyright (c) 2021-2024, 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 @@ -16,7 +16,7 @@

#pragma once

#include <raft/distance/distance_types.hpp>
#include <cuvs/distance/distance.hpp>

#include <cstdint>

Expand Down Expand Up @@ -105,7 +105,7 @@ double silhouette_score(const raft::handle_t& handle,
int* labels,
int nLabels,
double* silScores,
raft::distance::DistanceType metric);
cuvs::distance::DistanceType metric);

namespace Batched {
/**
Expand Down Expand Up @@ -138,7 +138,7 @@ float silhouette_score(const raft::handle_t& handle,
int n_labels,
float* scores,
int chunk,
raft::distance::DistanceType metric);
cuvs::distance::DistanceType metric);
double silhouette_score(const raft::handle_t& handle,
double* X,
int n_rows,
Expand All @@ -147,7 +147,7 @@ double silhouette_score(const raft::handle_t& handle,
int n_labels,
double* scores,
int chunk,
raft::distance::DistanceType metric);
cuvs::distance::DistanceType metric);

} // namespace Batched
/**
Expand Down Expand Up @@ -349,7 +349,7 @@ void pairwise_distance(const raft::handle_t& handle,
int m,
int n,
int k,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
bool isRowMajor = true,
double metric_arg = 2.0);

Expand All @@ -376,7 +376,7 @@ void pairwise_distance(const raft::handle_t& handle,
int m,
int n,
int k,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
bool isRowMajor = true,
float metric_arg = 2.0f);

Expand All @@ -393,7 +393,7 @@ void pairwiseDistance_sparse(const raft::handle_t& handle,
int* y_indptr,
int* x_indices,
int* y_indices,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
float metric_arg);
void pairwiseDistance_sparse(const raft::handle_t& handle,
float* x,
Expand All @@ -408,7 +408,7 @@ void pairwiseDistance_sparse(const raft::handle_t& handle,
int* y_indptr,
int* x_indices,
int* y_indices,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
float metric_arg);

/**
Expand All @@ -425,7 +425,7 @@ void pairwiseDistance_sparse(const raft::handle_t& handle,
* @tparam distance_type: Distance type to consider
* @return Trustworthiness score
*/
template <typename math_t, raft::distance::DistanceType distance_type>
template <typename math_t, cuvs::distance::DistanceType distance_type>
double trustworthiness_score(const raft::handle_t& h,
const math_t* X,
math_t* X_embedded,
Expand Down
8 changes: 4 additions & 4 deletions cpp/include/cuml/neighbors/knn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

#pragma once

#include <raft/distance/distance_types.hpp>
#include <raft/spatial/knn/ball_cover_types.hpp>
#include <raft/spatial/knn/detail/processing.hpp> // MetricProcessor

#include <cuvs/distance/distance.hpp>
#include <cuvs/neighbors/ivf_flat.hpp>
#include <cuvs/neighbors/ivf_pq.hpp>

Expand Down Expand Up @@ -63,7 +63,7 @@ void brute_force_knn(const raft::handle_t& handle,
int k,
bool rowMajorIndex = false,
bool rowMajorQuery = false,
raft::distance::DistanceType metric = raft::distance::DistanceType::L2Expanded,
cuvs::distance::DistanceType metric = cuvs::distance::DistanceType::L2Expanded,
float metric_arg = 2.0f,
std::vector<int64_t>* translations = nullptr);

Expand All @@ -79,7 +79,7 @@ void rbc_knn_query(const raft::handle_t& handle,
float* out_dists);

struct knnIndex {
raft::distance::DistanceType metric;
cuvs::distance::DistanceType metric;
float metricArg;
int nprobe;
std::unique_ptr<raft::spatial::knn::MetricProcessor<float>> metric_processor;
Expand Down Expand Up @@ -123,7 +123,7 @@ struct IVFPQParam : IVFParam {
void approx_knn_build_index(raft::handle_t& handle,
knnIndex* index,
knnIndexParam* params,
raft::distance::DistanceType metric,
cuvs::distance::DistanceType metric,
float metricArg,
float* index_array,
int n,
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cuml/neighbors/knn_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extern "C" {
* @param[in] rowMajorIndex is the index array in row major layout?
* @param[in] rowMajorQuery is the query array in row major layout?
* @param[in] metric_type the type of distance metric to use. This corresponds
* to the value in the raft::distance::DistanceType enum.
* to the value in the cuvs::distance::DistanceType enum.
* Default is Euclidean (L2).
* @param[in] metric_arg the value of `p` for Minkowski (l-p) distances. This
* is ignored if the metric_type is not Minkowski.
Expand Down
5 changes: 2 additions & 3 deletions cpp/include/cuml/neighbors/knn_sparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@

#include <cuml/neighbors/knn.hpp>

#include <raft/distance/distance_types.hpp>

#include <cusparse_v2.h>
#include <cuvs/distance/distance.hpp>

namespace raft {
class handle_t;
Expand Down Expand Up @@ -49,7 +48,7 @@ void brute_force_knn(raft::handle_t& handle,
int k,
size_t batch_size_index = DEFAULT_BATCH_SIZE,
size_t batch_size_query = DEFAULT_BATCH_SIZE,
raft::distance::DistanceType metric = raft::distance::DistanceType::L2Expanded,
cuvs::distance::DistanceType metric = cuvs::distance::DistanceType::L2Expanded,
float metricArg = 0);
}; // end namespace Sparse
}; // end namespace ML
Loading
Loading