cc_staff
1,486
edits
(consistent indentation) |
(adjusted indentation to be consistent) |
||
Line 144: | Line 144: | ||
<syntaxhighlight lang="cpp" line highlight="1,5"> | <syntaxhighlight lang="cpp" line highlight="1,5"> | ||
__global__ void add (int *a, int *b, int *c){ | __global__ void add (int *a, int *b, int *c){ | ||
c[blockIdx.x] = a[blockIdx.x] + b[blockIdx.x]; | |||
c[blockIdx.x] = a[blockIdx.x] + b[blockIdx.x]; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
where blockIdx.x is the unique number identifying a CUDA block. This way each CUDA block adds a value from a[ ] to b[ ]. | where blockIdx.x is the unique number identifying a CUDA block. This way each CUDA block adds a value from a[ ] to b[ ]. |