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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Algorithms<br />

� Standard operators<br />

// allocate memory<br />

device_vector A(10);<br />

device_vector B(10);<br />

device_vector C(10);<br />

// transform A + B -> C<br />

transform(A.begin(), A.end(), B.begin(), C.begin(), plus());<br />

// transform A - B -> C<br />

transform(A.begin(), A.end(), B.begin(), C.begin(), minus());<br />

// multiply reduction<br />

int product = reduce(A.begin(), A.end(), 1, multiplies());

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

Saved successfully!

Ooh no, something went wrong!