8 #include <raft/util/cudart_utils.hpp>
10 #include <thrust/copy.h>
11 #include <thrust/device_ptr.h>
12 #include <thrust/execution_policy.h>
13 #include <thrust/iterator/counting_iterator.h>
31 void range(T* out,
int start,
int end, cudaStream_t stream)
33 thrust::counting_iterator<int> first(start);
34 thrust::counting_iterator<int> last = first + (end - start);
35 thrust::device_ptr<T> ptr(out);
36 thrust::copy(thrust::cuda::par.on(stream), first, last, ptr);
48 template <
typename T,
int TPB = 256>
49 void range(T* out,
int n, cudaStream_t stream)
51 range(out, 0, n, stream);
62 void zero(T* out,
int n, cudaStream_t stream)
64 RAFT_CUDA_TRY(cudaMemsetAsync(
static_cast<void*
>(out), 0, n *
sizeof(T), stream));
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:316