From a5723979050aa39e93247405803dbfecaf3e8e8b Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Fri, 10 Feb 2023 23:35:20 -0500 Subject: [PATCH] Fixign a couple small kmeans bugs (#1274) Authors: - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Divye Gala (https://github.com/divyegala) - Ben Frederickson (https://github.com/benfred) URL: https://github.com/rapidsai/raft/pull/1274 --- cpp/include/raft/cluster/detail/kmeans.cuh | 2 +- cpp/include/raft/random/detail/make_blobs.cuh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/include/raft/cluster/detail/kmeans.cuh b/cpp/include/raft/cluster/detail/kmeans.cuh index 9632fedb9d..40e6728dbe 100644 --- a/cpp/include/raft/cluster/detail/kmeans.cuh +++ b/cpp/include/raft/cluster/detail/kmeans.cuh @@ -1209,7 +1209,7 @@ void kmeans_transform(raft::device_resources const& handle, // n_clusters] for (IndexT dIdx = 0; dIdx < (IndexT)n_samples; dIdx += dataBatchSize) { // # of samples for the current batch - auto ns = std::min(dataBatchSize, n_samples - dIdx); + auto ns = std::min(static_cast(dataBatchSize), static_cast(n_samples - dIdx)); // datasetView [ns x n_features] - view representing the current batch of // input dataset diff --git a/cpp/include/raft/random/detail/make_blobs.cuh b/cpp/include/raft/random/detail/make_blobs.cuh index b37dabb366..4e3da63ef6 100644 --- a/cpp/include/raft/random/detail/make_blobs.cuh +++ b/cpp/include/raft/random/detail/make_blobs.cuh @@ -158,9 +158,9 @@ void generate_data(DataT* out, raft::random::RngState& rng_state) { constexpr IdxT block_size = 128; - IdxT items = n_rows * n_cols; + int64_t items = static_cast(n_rows) * n_cols; // Choose a grid size so that each thread can write two output values. - IdxT nBlocks = ceildiv(items, 2 * block_size); + int64_t nBlocks = ceildiv(items, 2 * block_size); // parentheses needed here for kernel, otherwise macro interprets the arguments // of triple chevron notation as macro arguments RAFT_CALL_RNG_FUNC(rng_state,