liveBook · Manning

Thread block

As explained in Grokking GPU Programming

A block is a CUDA launch hierarchy unit whose threads are grouped and scheduled for execution on GPU hardware.

A thread block groups CUDA threads that work together on part of a problem. Blocks belong to a grid, and each thread belongs to exactly one block. Like classrooms sharing a grading task, blocks divide work that would be too large for one room—or one block—to handle. section 3.0 section 3.2

Keep these execution rules in mind:

  • Every block in a launch has the same number of threads; a block can contain at most 1,024 threads. section 3.16
  • The GPU schedules each block on one SM, where it runs to completion; extra blocks wait until an SM is available. section 3.2
  • Blocks can run in any order and have no simple way to synchronize with one another during a kernel. Don’t rely on one block finishing before another. section 3.16
    myKernel<<<4, 256>>>(); // 4 classrooms, 256 students each

This launch assigns 256 threads to each of four blocks. section 3.2

How Grokking GPU Programming covers it

How deep it goes
Explains block size limits, SM scheduling, and ordering constraints, but does not detail low-level hardware execution.
Examples
Uses classroom-and-grader analogies and a launch with four blocks of 256 threads each.
What it assumes
Assumes familiarity with CUDA kernel launches and threadIdx.x, then introduces the grid–block–thread hierarchy through an analogy.
What you can do after
Apply CUDA launch configuration and block-based indexing to divide array work across threads.
How it connects
Connects blocks to grids, threads, streaming multiprocessors, and kernel launches.

Also explained in

Compare how 4 books explain thread block →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking GPU Programming. The section links point to the parts of the book it draws on.