A thread layout arranges threads in a CUDA block as a line (1D), rectangle (2D), or box (3D). Choose the shape when launching a kernel: a flat array fits a 1D layout, while an image or matrix can fit a 2D layout. Each thread uses its built-in threadIdx components to identify its position. In 1D, threadIdx.x starts at 0 and gives each thread an index within its block. With multiple blocks, that index repeats; combine it with blockIdx.x to distinguish threads across blocks. section 2.6
Figure 2.2 1D thread layout: one index per thread. In a 1D block, each thread gets a unique threadIdx.x starting from 0; that's all it needs to know which element to work on. (These numbers are unique within a block; with multiple blocks, each block counts from 0 again.) The six threads shown here are what a one-dimensional launch like kernel<<<1, 6>>>() creates: the launch is what brings the threads into being, and each one then reads its own threadIdx.x.

See how a six-thread, one-dimensional launch gives each thread its own threadIdx.x value. section 2.6
