liveBook · Manning

Global index

A global index is a unique identifier for a thread's position across all blocks in a CUDA kernel launch.

How 2 Manning books explain it

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.

Read how Grokking GPU Programming explains global index →

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.

Read how CUDA for LLMs explains global index →

What to know first

Related concepts

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.