Skip to content

Commit 4384f17

Browse files
authored
Drop deprecated CCCL functors (#6389)
`cub::Sum` as well as `cub::Max` and `cub::Min` habe been deprecated and will be removed in a future CCCL release Authors: - Michael Schellenberger Costa (https://github.com/miscco) Approvers: - Bradley Dice (https://github.com/bdice) URL: #6389
1 parent 2921f8e commit 4384f17

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

cpp/src/fil/infer.cu

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <raft/util/cuda_utils.cuh>
2424
#include <raft/util/cudart_utils.hpp>
2525

26-
#include <thrust/functional.h>
26+
#include <cuda/std/functional>
2727

2828
#include <algorithm>
2929
#include <cmath>
@@ -81,13 +81,13 @@ struct vec {
8181
__host__ __device__ T operator[](int i) const { return data[i]; }
8282
friend __host__ __device__ vec<N, T> operator+(const vec<N, T>& a, const vec<N, T>& b)
8383
{
84-
return vectorized(cub::Sum())(a, b);
84+
return vectorized(cuda::std::plus<T>{})(a, b);
8585
}
8686
friend __host__ __device__ void operator+=(vec<N, T>& a, const vec<N, T>& b) { a = a + b; }
8787
template <typename Vec>
8888
friend __host__ __device__ vec<N, T> operator/(vec<N, T>& a, const Vec& b)
8989
{
90-
return vectorized(thrust::divides<T>())(a, vec<N, T>(b));
90+
return vectorized(cuda::std::divides<T>())(a, vec<N, T>(b));
9191
}
9292
template <typename Vec>
9393
friend __host__ __device__ void operator/=(vec<N, T>& a, const Vec& b)
@@ -295,7 +295,7 @@ struct tree_aggregator_t {
295295
// ensure input columns can be overwritten (no threads traversing trees)
296296
__syncthreads();
297297
if (log2_threads_per_tree == 0) {
298-
acc = block_reduce(acc, vectorized(cub::Sum()), tmp_storage);
298+
acc = block_reduce(acc, vectorized(cuda::std::plus{}), tmp_storage);
299299
} else {
300300
auto per_thread = (vec<NITEMS, real_t>*)tmp_storage;
301301
per_thread[threadIdx.x] = acc;
@@ -383,7 +383,7 @@ __device__ __forceinline__ void block_softmax(Iterator begin, Iterator end, void
383383
for (Iterator it = begin + threadIdx.x; it < end; it += blockDim.x)
384384
*it = vectorized(shifted_exp())(*it, max);
385385
// sum of exponents
386-
value_type soe = allreduce_shmem(begin, end, vectorized(cub::Sum()), tmp_storage);
386+
value_type soe = allreduce_shmem(begin, end, vectorized(cuda::std::plus{}), tmp_storage);
387387
// softmax phase 2: normalization
388388
for (Iterator it = begin + threadIdx.x; it < end; it += blockDim.x)
389389
*it /= soe;

cpp/src/svm/linear.cu

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <rmm/device_uvector.hpp>
3838
#include <rmm/mr/device/per_device_resource.hpp>
3939

40+
#include <cuda/std/functional>
4041
#include <thrust/copy.h>
4142
#include <thrust/device_ptr.h>
4243
#include <thrust/execution_policy.h>
@@ -175,7 +176,7 @@ CUML_KERNEL void predictProba(T* out, const T* z, const int nRows, const int nCl
175176
j -= BX;
176177
t = rowIn[j];
177178
}
178-
smSum = WarpRed(warpStore).Reduce(smSum, cub::Sum());
179+
smSum = WarpRed(warpStore).Reduce(smSum, cuda::std::plus{});
179180
smSum = cub::ShuffleIndex<BX>(smSum, 0, 0xFFFFFFFFU);
180181

181182
// Now, either `j` refers to the first valid column idx worked by the
@@ -289,7 +290,7 @@ void predictLinear(const raft::handle_t& handle,
289290

290291
if (fitIntercept)
291292
raft::linalg::matrixVectorOp(
292-
out, out, w + nCols * coefCols, coefCols, nRows, true, true, cub::Sum(), stream);
293+
out, out, w + nCols * coefCols, coefCols, nRows, true, true, cuda::std::plus{}, stream);
293294
}
294295

295296
/** A helper struct for selecting handle/stream depending on whether omp parallel is active. */

0 commit comments

Comments
 (0)