19 #include <raft/util/cudart_utils.hpp>
21 #include <thrust/copy.h>
22 #include <thrust/device_ptr.h>
23 #include <thrust/execution_policy.h>
24 #include <thrust/iterator/counting_iterator.h>
42 void range(T* out,
int start,
int end, cudaStream_t stream)
44 thrust::counting_iterator<int> first(start);
45 thrust::counting_iterator<int> last = first + (end - start);
46 thrust::device_ptr<T> ptr(out);
47 thrust::copy(thrust::cuda::par.on(stream), first, last, ptr);
59 template <
typename T,
int TPB = 256>
60 void range(T* out,
int n, cudaStream_t stream)
62 range(out, 0, n, stream);
73 void zero(T* out,
int n, cudaStream_t stream)
75 RAFT_CUDA_TRY(cudaMemsetAsync(
static_cast<void*
>(out), 0, n *
sizeof(T), stream));
Definition: kernelparams.h:21
const_agnostic_same_t< T, U > copy(buffer< T > &dst, buffer< U > const &src, typename buffer< T >::index_type dst_offset, typename buffer< U >::index_type src_offset, typename buffer< T >::index_type size, cuda_stream stream)
Definition: buffer.hpp:327