Skip to content

Commit

Permalink
Updates to kmeans public API to fix cuml (#932)
Browse files Browse the repository at this point in the history
Authors:
  - Corey J. Nolet (https://github.com/cjnolet)

Approvers:
  - Divye Gala (https://github.com/divyegala)

URL: #932
  • Loading branch information
cjnolet authored Oct 20, 2022
1 parent 0de9ece commit ba12f6a
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions cpp/include/raft/cluster/kmeans.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ using KeyValueIndexOp = detail::KeyValueIndexOp<IndexT, DataT>;
* @param[in] workspace Temporary workspace buffer which can get resized
*
*/
template <typename DataT, typename IndexT = int>
template <typename DataT, typename IndexT>
void sampleCentroids(const raft::handle_t& handle,
const raft::device_matrix_view<const DataT, IndexT>& X,
const raft::device_vector_view<DataT, IndexT>& minClusterDistance,
const raft::device_vector_view<IndexT, IndexT>& isSampleCentroid,
raft::device_matrix_view<const DataT, IndexT> X,
raft::device_vector_view<DataT, IndexT> minClusterDistance,
raft::device_vector_view<std::uint8_t, IndexT> isSampleCentroid,
SamplingOp<DataT, IndexT>& select_op,
rmm::device_uvector<DataT>& inRankCp,
rmm::device_uvector<char>& workspace)
Expand All @@ -278,11 +278,11 @@ void sampleCentroids(const raft::handle_t& handle,
* @param[in] reduction_op The reduction operation used for the cost
*
*/
template <typename DataT, typename ReductionOpT, typename IndexT = int>
template <typename DataT, typename IndexT, typename ReductionOpT>
void computeClusterCost(const raft::handle_t& handle,
const raft::device_vector_view<DataT, IndexT>& minClusterDistance,
raft::device_vector_view<DataT, IndexT> minClusterDistance,
rmm::device_uvector<char>& workspace,
const raft::device_scalar_view<DataT>& clusterCost,
raft::device_scalar_view<DataT> clusterCost,
ReductionOpT reduction_op)
{
detail::computeClusterCost<DataT, ReductionOpT, IndexT>(
Expand Down Expand Up @@ -313,10 +313,10 @@ void computeClusterCost(const raft::handle_t& handle,
template <typename DataT, typename IndexT>
void minClusterDistanceCompute(const raft::handle_t& handle,
const KMeansParams& params,
const raft::device_matrix_view<const DataT, IndexT>& X,
const raft::device_matrix_view<DataT, IndexT>& centroids,
const raft::device_vector_view<DataT, IndexT>& minClusterDistance,
const raft::device_vector_view<DataT, IndexT>& L2NormX,
raft::device_matrix_view<const DataT, IndexT> X,
raft::device_matrix_view<DataT, IndexT> centroids,
raft::device_vector_view<DataT, IndexT> minClusterDistance,
raft::device_vector_view<DataT, IndexT> L2NormX,
rmm::device_uvector<DataT>& L2NormBuf_OR_DistBuf,
rmm::device_uvector<char>& workspace)
{
Expand Down Expand Up @@ -352,10 +352,10 @@ template <typename DataT, typename IndexT>
void minClusterAndDistanceCompute(
const raft::handle_t& handle,
const KMeansParams& params,
const raft::device_matrix_view<const DataT, IndexT> X,
const raft::device_matrix_view<const DataT, IndexT> centroids,
const raft::device_vector_view<raft::KeyValuePair<IndexT, DataT>, IndexT>& minClusterAndDistance,
const raft::device_vector_view<DataT, IndexT>& L2NormX,
raft::device_matrix_view<const DataT, IndexT> X,
raft::device_matrix_view<const DataT, IndexT> centroids,
raft::device_vector_view<raft::KeyValuePair<IndexT, DataT>, IndexT> minClusterAndDistance,
raft::device_vector_view<DataT, IndexT> L2NormX,
rmm::device_uvector<DataT>& L2NormBuf_OR_DistBuf,
rmm::device_uvector<char>& workspace)
{
Expand All @@ -382,8 +382,8 @@ void minClusterAndDistanceCompute(
*/
template <typename DataT, typename IndexT>
void shuffleAndGather(const raft::handle_t& handle,
const raft::device_matrix_view<const DataT, IndexT>& in,
const raft::device_matrix_view<DataT, IndexT>& out,
raft::device_matrix_view<const DataT, IndexT> in,
raft::device_matrix_view<DataT, IndexT> out,
uint32_t n_samples_to_gather,
uint64_t seed,
rmm::device_uvector<char>* workspace = nullptr)
Expand Down Expand Up @@ -413,11 +413,11 @@ void shuffleAndGather(const raft::handle_t& handle,
template <typename DataT, typename IndexT>
void countSamplesInCluster(const raft::handle_t& handle,
const KMeansParams& params,
const raft::device_matrix_view<const DataT, IndexT>& X,
const raft::device_vector_view<DataT, IndexT>& L2NormX,
const raft::device_matrix_view<DataT, IndexT>& centroids,
raft::device_matrix_view<const DataT, IndexT> X,
raft::device_vector_view<DataT, IndexT> L2NormX,
raft::device_matrix_view<DataT, IndexT> centroids,
rmm::device_uvector<char>& workspace,
const raft::device_vector_view<DataT, IndexT>& sampleCountInCluster)
raft::device_vector_view<DataT, IndexT> sampleCountInCluster)
{
detail::countSamplesInCluster<DataT, IndexT>(
handle, params, X, L2NormX, centroids, workspace, sampleCountInCluster);
Expand All @@ -444,8 +444,8 @@ void countSamplesInCluster(const raft::handle_t& handle,
template <typename DataT, typename IndexT>
void kmeansPlusPlus(const raft::handle_t& handle,
const KMeansParams& params,
const raft::device_matrix_view<const DataT, IndexT>& X,
const raft::device_matrix_view<DataT, IndexT>& centroidsRawData,
raft::device_matrix_view<const DataT, IndexT> X,
raft::device_matrix_view<DataT, IndexT> centroidsRawData,
rmm::device_uvector<char>& workspace)
{
detail::kmeansPlusPlus<DataT, IndexT>(handle, params, X, centroidsRawData, workspace);
Expand Down Expand Up @@ -477,11 +477,11 @@ void kmeansPlusPlus(const raft::handle_t& handle,
template <typename DataT, typename IndexT>
void kmeans_fit_main(const raft::handle_t& handle,
const KMeansParams& params,
const raft::device_matrix_view<const DataT, IndexT>& X,
const raft::device_vector_view<const DataT, IndexT>& weight,
const raft::device_matrix_view<DataT, IndexT>& centroidsRawData,
const raft::host_scalar_view<DataT>& inertia,
const raft::host_scalar_view<IndexT>& n_iter,
raft::device_matrix_view<const DataT, IndexT> X,
raft::device_vector_view<const DataT, IndexT> weight,
raft::device_matrix_view<DataT, IndexT> centroidsRawData,
raft::host_scalar_view<DataT> inertia,
raft::host_scalar_view<IndexT> n_iter,
rmm::device_uvector<char>& workspace)
{
detail::kmeans_fit_main<DataT, IndexT>(
Expand Down

0 comments on commit ba12f6a

Please sign in to comment.