15.08.2012 Views

Introduction to CUDA C

Introduction to CUDA C

Introduction to CUDA C

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Indexing Arrays: Example<br />

� In this example, the red entry would have an index of 21:<br />

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15<br />

16 17 18 19 20 21<br />

M = 8 threads/block<br />

int index = threadIdx.x + blockIdx.x * M;<br />

= 5 + 2 * 8;<br />

= 21;<br />

blockIdx.x = 2

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

Saved successfully!

Ooh no, something went wrong!