Introduction to CUDA C
Introduction to CUDA C
Introduction to CUDA C
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Dot Product<br />
� Parallel threads have no problem computing the pairwise products:<br />
a b<br />
a 0<br />
a 1<br />
a 2<br />
a 3<br />
*<br />
*<br />
*<br />
*<br />
b 0<br />
b 1<br />
b 2<br />
b 3<br />
� So we can start a dot product <strong>CUDA</strong> kernel by doing just that:<br />
__global__ void dot( int *a, int *b, int *c ) {<br />
// Each thread computes a pairwise product<br />
int temp = a[threadIdx.x] * b[threadIdx.x];<br />
+