15.08.2012 Views

Introduction to CUDA C

Introduction to CUDA C

Introduction to CUDA C

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.

A More Complex Example<br />

� Notice that we use pointers for our variables:<br />

__global__ void add( int *a, int *b, int *c ) {<br />

}<br />

*c = *a + *b;<br />

� add() runs on the device…so a, b, and c must point <strong>to</strong><br />

device memory<br />

� How do we allocate memory on the GPU?

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

Saved successfully!

Ooh no, something went wrong!