12.01.2013 Views

High-Productivity CUDA Development with the Thrust Template ...

High-Productivity CUDA Development with the Thrust Template ...

High-Productivity CUDA Development with the Thrust Template ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Iterators<br />

� Encode memory location<br />

— Automatic algorithm selection<br />

// initialize random values on host<br />

host_vector h_vec(100);<br />

generate(h_vec.begin(), h_vec.end(), rand);<br />

// copy values to device<br />

device_vector d_vec = h_vec;<br />

// compute sum on host<br />

int h_sum = reduce(h_vec.begin(), h_vec.end());<br />

// compute sum on device<br />

int d_sum = reduce(d_vec.begin(), d_vec.end());

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!