Skip to content

Commit

Permalink
Remove uint32 distance idx specializations (#1235)
Browse files Browse the repository at this point in the history
In addition to removing uint32_t idx specializations from pairwise distances, this splits a few of the remaining distance specializations into separate files so they can be compiled concurrently. Verified cuml is not using any of the uint32_t specializations.

Authors:
  - Corey J. Nolet (https://github.com/cjnolet)

Approvers:
  - Ben Frederickson (https://github.com/benfred)

URL: #1235
  • Loading branch information
cjnolet authored Feb 3, 2023
1 parent f8d3f5b commit a850726
Show file tree
Hide file tree
Showing 37 changed files with 285 additions and 765 deletions.
28 changes: 12 additions & 16 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,19 @@ if(RAFT_COMPILE_DIST_LIBRARY)
src/distance/neighbors/specializations/refine_h_uint64_t_uint8_t.cu
src/distance/cluster/kmeans_fit_float.cu
src/distance/cluster/kmeans_fit_double.cu
src/distance/distance/specializations/detail/canberra.cu
src/distance/distance/specializations/detail/chebyshev.cu
src/distance/distance/specializations/detail/correlation.cu
src/distance/distance/specializations/detail/cosine.cu
src/distance/distance/specializations/detail/cosine.cu
src/distance/distance/specializations/detail/hamming_unexpanded.cu
src/distance/distance/specializations/detail/hellinger_expanded.cu
src/distance/distance/specializations/detail/canberra_double_double_double_int.cu
src/distance/distance/specializations/detail/canberra_float_float_float_int.cu
src/distance/distance/specializations/detail/chebyshev_double_double_double_int.cu
src/distance/distance/specializations/detail/chebyshev_float_float_float_int.cu
src/distance/distance/specializations/detail/correlation_double_double_double_int.cu
src/distance/distance/specializations/detail/correlation_float_float_float_int.cu
src/distance/distance/specializations/detail/cosine_double_double_double_int.cu
src/distance/distance/specializations/detail/cosine_float_float_float_int.cu
src/distance/distance/specializations/detail/hamming_unexpanded_double_double_double_int.cu
src/distance/distance/specializations/detail/hamming_unexpanded_float_float_float_int.cu
src/distance/distance/specializations/detail/hellinger_expanded_float_float_float_int.cu
src/distance/distance/specializations/detail/hellinger_expanded_double_double_double_int.cu
src/distance/distance/specializations/detail/jensen_shannon_float_float_float_int.cu
src/distance/distance/specializations/detail/jensen_shannon_float_float_float_uint32.cu
src/distance/distance/specializations/detail/jensen_shannon_double_double_double_int.cu
src/distance/distance/specializations/detail/kernels/gram_matrix_base_double.cu
src/distance/distance/specializations/detail/kernels/gram_matrix_base_float.cu
Expand All @@ -327,28 +331,20 @@ if(RAFT_COMPILE_DIST_LIBRARY)
src/distance/distance/specializations/detail/kernels/tanh_kernel_double.cu
src/distance/distance/specializations/detail/kernels/tanh_kernel_float.cu
src/distance/distance/specializations/detail/kl_divergence_float_float_float_int.cu
src/distance/distance/specializations/detail/kl_divergence_float_float_float_uint32.cu
src/distance/distance/specializations/detail/kl_divergence_double_double_double_int.cu
src/distance/distance/specializations/detail/l1_float_float_float_int.cu
src/distance/distance/specializations/detail/l1_float_float_float_uint32.cu
src/distance/distance/specializations/detail/l1_double_double_double_int.cu
src/distance/distance/specializations/detail/l2_expanded_float_float_float_int.cu
src/distance/distance/specializations/detail/l2_expanded_float_float_float_uint32.cu
src/distance/distance/specializations/detail/l2_expanded_double_double_double_int.cu
src/distance/distance/specializations/detail/l2_sqrt_expanded_float_float_float_int.cu
src/distance/distance/specializations/detail/l2_sqrt_expanded_float_float_float_uint32.cu
src/distance/distance/specializations/detail/l2_sqrt_expanded_double_double_double_int.cu
src/distance/distance/specializations/detail/l2_sqrt_unexpanded_float_float_float_int.cu
src/distance/distance/specializations/detail/l2_sqrt_unexpanded_float_float_float_uint32.cu
src/distance/distance/specializations/detail/l2_sqrt_unexpanded_double_double_double_int.cu
src/distance/distance/specializations/detail/l2_unexpanded_double_double_double_int.cu
src/distance/distance/specializations/detail/l2_unexpanded_float_float_float_uint32.cu
src/distance/distance/specializations/detail/l2_unexpanded_float_float_float_int.cu
src/distance/distance/specializations/detail/lp_unexpanded_double_double_double_int.cu
src/distance/distance/specializations/detail/lp_unexpanded_float_float_float_uint32.cu
src/distance/distance/specializations/detail/lp_unexpanded_float_float_float_int.cu
src/distance/distance/specializations/detail/russel_rao_double_double_double_int.cu
src/distance/distance/specializations/detail/russel_rao_float_float_float_uint32.cu
src/distance/distance/specializations/detail/russel_rao_float_float_float_int.cu
src/distance/distance/specializations/fused_l2_nn_double_int.cu
src/distance/distance/specializations/fused_l2_nn_double_int64.cu
Expand Down
16 changes: 1 addition & 15 deletions cpp/include/raft/distance/specializations/detail/canberra.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -48,20 +48,6 @@ extern template void distance<raft::distance::DistanceType::Canberra, double, do
bool isRowMajor,
double metric_arg);

extern template void
distance<raft::distance::DistanceType::Canberra, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
16 changes: 1 addition & 15 deletions cpp/include/raft/distance/specializations/detail/chebyshev.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -47,20 +47,6 @@ extern template void distance<raft::distance::DistanceType::Linf, double, double
bool isRowMajor,
double metric_arg);

extern template void
distance<raft::distance::DistanceType::Linf, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
16 changes: 1 addition & 15 deletions cpp/include/raft/distance/specializations/detail/correlation.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -49,20 +49,6 @@ distance<raft::distance::DistanceType::CorrelationExpanded, double, double, doub
bool isRowMajor,
double metric_arg);

extern template void
distance<raft::distance::DistanceType::CorrelationExpanded, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
16 changes: 1 addition & 15 deletions cpp/include/raft/distance/specializations/detail/cosine.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -49,20 +49,6 @@ distance<raft::distance::DistanceType::CosineExpanded, double, double, double, i
bool isRowMajor,
double metric_arg);

extern template void
distance<raft::distance::DistanceType::CosineExpanded, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -49,20 +49,6 @@ distance<raft::distance::DistanceType::HammingUnexpanded, double, double, double
bool isRowMajor,
double metric_arg);

extern template void
distance<raft::distance::DistanceType::HammingUnexpanded, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -49,20 +49,6 @@ distance<raft::distance::DistanceType::HellingerExpanded, double, double, double
bool isRowMajor,
double metric_arg);

extern template void
distance<raft::distance::DistanceType::HellingerExpanded, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -47,19 +47,6 @@ distance<raft::distance::DistanceType::JensenShannon, double, double, double, in
cudaStream_t stream,
bool isRowMajor,
double metric_arg);
extern template void
distance<raft::distance::DistanceType::JensenShannon, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -48,20 +48,6 @@ distance<raft::distance::DistanceType::KLDivergence, double, double, double, int
bool isRowMajor,
double metric_arg);

extern template void
distance<raft::distance::DistanceType::KLDivergence, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
15 changes: 1 addition & 14 deletions cpp/include/raft/distance/specializations/detail/l1.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -47,19 +47,6 @@ extern template void distance<raft::distance::DistanceType::L1, double, double,
bool isRowMajor,
double metric_arg);

extern template void distance<raft::distance::DistanceType::L1, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
16 changes: 1 addition & 15 deletions cpp/include/raft/distance/specializations/detail/l2_expanded.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -47,20 +47,6 @@ distance<raft::distance::DistanceType::L2Expanded, double, double, double, int>(
bool isRowMajor,
double metric_arg);

extern template void
distance<raft::distance::DistanceType::L2Expanded, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -49,20 +49,6 @@ distance<raft::distance::DistanceType::L2SqrtExpanded, double, double, double, i
bool isRowMajor,
double metric_arg);

extern template void
distance<raft::distance::DistanceType::L2SqrtExpanded, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, 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 @@ -49,20 +49,6 @@ distance<raft::distance::DistanceType::L2SqrtUnexpanded, double, double, double,
bool isRowMajor,
double metric_arg);

extern template void
distance<raft::distance::DistanceType::L2SqrtUnexpanded, float, float, float, std::uint32_t>(
const float* x,
const float* y,
float* dist,
std::uint32_t m,
std::uint32_t n,
std::uint32_t k,
void* workspace,
size_t worksize,
cudaStream_t stream,
bool isRowMajor,
float metric_arg);

} // namespace detail
} // namespace distance
} // namespace raft
Loading

0 comments on commit a850726

Please sign in to comment.