Global index
A global index is a unique identifier for a thread's position across all blocks in a CUDA kernel launch.
Grokking GPU Programming
A global index identifies a thread's corresponding element across all blocks in a CUDA grid.
- How it is used
- Assigns one array element to each thread when work spans multiple CUDA blocks.
- How deep it goes
- Works through the 1D formula and bounds checks, while deferring multidimensional grids and mappings where one thread handles several elements.
- Examples
- Traces three blocks of four threads and uses an array-doubling kernel to demonstrate indexing and bounds checks.
- What you can do after
- Apply it via CUDA to assign array elements to threads and guard extra threads against out-of-bounds access.
CUDA for LLMs
A global index is a unique one-dimensional identifier for a thread's position across all blocks in a kernel launch.
- How it is used
- Maps each CUDA thread to its data position so a kernel can distribute work across a launch.
- How deep it goes
- Works through 1D indexing and bounds checks, then demonstrates coordinate indexing in a 2D max-pooling kernel.
- Examples
- Uses guarded vector addition and a 2D max-pooling kernel to illustrate thread-to-data mapping.
- What you can do after
- Apply it via CUDA by assigning each thread an index and guarding accesses against the data bounds.
What to know first
- CUDACUDA is NVIDIA’s parallel computing platform and programming model for performing general-purpose computations on NVIDIA GPUs.
- gridA GPU grid is the collection of thread blocks or program instances launched to execute a single kernel.
Related concepts
- threadIdx.xuses · threadIdx.x is a CUDA built-in variable giving a thread’s coordinate along the x dimension of its block.
- block dimensionuses · A block dimension specifies the extent of a CUDA thread block along one of its coordinate axes.
- bounds checkingused by · Bounds checking verifies that an index, access, or operation falls within the permitted limits of a data structure, memory region, or range.
Questions about global index
What is global index?
A global index is a unique identifier for a thread's position across all blocks in a CUDA kernel launch.
Which Manning books explain global index?
Grokking GPU Programming and CUDA for LLMs.
What should I know before learning global index?
Manning books that teach global index usually introduce CUDA and grid first.
What is global index a kind of?
Global index is a kind of index. An index is a position used to identify an element in an ordered collection.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

