liveBook · Manning

Kernel launch

As explained in Grokking GPU Programming

A kernel launch starts execution of a GPU kernel across a specified number of threads.

A kernel launch starts a GPU function across many threads. For example, <<<1, n>>> starts one block with n threads; each thread runs the same code and can handle a different data element. section 2.24

Keep these launch details in mind:

  • Check each thread’s index against the data size to prevent out-of-bounds access. A block cannot exceed 1,024 threads; exceeding that limit makes the launch fail and leaves the data unchanged. section 3.16
  • Launches return before the GPU finishes. Synchronize before using results, and check for launch errors when debugging. section 3.16 section 2.24

How Grokking GPU Programming covers it

How deep it goes
Explains launch dimensions, asynchronous completion, bounds checks, and the failure caused by exceeding a block’s thread limit.
Examples
Uses <<<1, n>>> to launch n threads in one block and illustrates indexing and bounds checks.
What you can do after
Configure it by choosing a thread count, checking bounds, and synchronizing before relying on results.
How it connects
Connects CUDA kernels with thread blocks, thread indexing, data parallelism, and device synchronization.

Also explained in

Compare how 2 books explain kernel launch →

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.