X hits on this document

85 views

0 shares

0 downloads

0 comments

15 / 26

© NVIDIA Corporation 2009

thrust::reduce

#include <thrust/host_vector.h>

#include <thrust/device_vector.h>

#include <thrust/generate.h>

#include <thrust/reduce.h>

int main(void)

{

 // generate random data on the host

 thrust::host_vector<int> h_vec(1000000);

 thrust::generate(h_vec.begin(), h_vec.end(), rand);

 // compute sum

 thrust::device_vector<int> d_vec = h_vec;

 int x = thrust::reduce(d_vec.begin(), d_vec.end(),

                         thrust::plus<int>());

 return 0; }

Document info
Document views85
Page views85
Page last viewedFri Dec 09 19:53:31 UTC 2016
Pages26
Paragraphs209
Words942

Comments