CUDA tutorial: Difference between revisions

Line 68: Line 68:
In this model the threads within a block work on the same set of instructions (but perhaps with different data sets) and exchange data between each other via shared memory. Threads in other blocks do the same thing (see Figure).  
In this model the threads within a block work on the same set of instructions (but perhaps with different data sets) and exchange data between each other via shared memory. Threads in other blocks do the same thing (see Figure).  
[[File:Cuda_threads.png|thumbnail|Threads within a block intercommunicate via shared memory . ]]
[[File:Cuda_threads.png|thumbnail|Threads within a block intercommunicate via shared memory . ]]
Each thread uses IDs to decide what data to work on:
* Block IDs: 1D or 2D (blockIdx.x, blockIdx.y)
* Thread IDs: 1D, 2D, or 3D (threadIdx.x, threadIdx.y, threadIdx.z)
Such model simplifies memory addressing when processing multidimmensional data.


= First CUDA C Program=
= First CUDA C Program=
Bureaucrats, cc_docs_admin, cc_staff
337

edits