0Pricing
CUDA Academy · Lektion

Die Thread-Hierarchie

Threads werden zu Blöcken und Blöcke zu einem Grid gruppiert.

Die Thread-Hierarchie ist eine kostenlose CUDA Academy-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des CUDA Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der CUDA Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Many Threads, One Job

A CUDA kernel runs in parallel across many threads, and each thread does the same work on its own slice of the data. 🧵

Threads Need Structure

Launching millions of loose threads would be chaos. CUDA organizes them into a clean hierarchy so the hardware can schedule them well.

Threads Form Blocks

Threads are grouped into a block. Every thread in a block runs the same kernel and can cooperate closely with its neighbors.

Blocks Form the Grid

All the blocks for one launch together make up the grid. So the chain is simple: threads live in blocks, and blocks live in the grid.

Why Two Levels?

The two-level design lets one kernel scale from a tiny GPU to a huge one. You describe the work once and the grid stretches to fit.

Picking the Shape at Launch

You choose how many blocks and how many threads per block right at the launch, using the triple-angle-bracket syntax.

myKernel<<<numBlocks, threadsPerBlock>>>(data);

A Concrete Example

Say you launch 4 blocks of 256 threads. That gives you 4 times 256, or 1024 threads all running at once.

Blocks Are Independent

Different blocks cannot assume any order or talk to each other directly. This independence is exactly what lets the GPU run them in any sequence.

Threads Within a Block Cooperate

Inside one block, threads can share fast on-chip memory and synchronize with each other. That teamwork is a block's superpower.

Grids and Blocks Can Be 3D

Both the grid and each block can be 1D, 2D, or 3D. The dim3 type lets you map naturally onto images or volumes.

dim3 block(16, 16);
dim3 grid(32, 32);

One Thread, One Element

The common goal is to give each thread exactly one data element to handle. The hierarchy is just how you reach that mapping.

Quick Check

Let us check how the pieces nest together.

Recap: The Hierarchy

You learned the CUDA ladder: threads make a block, blocks make the grid. Independent blocks scale, while threads inside a block cooperate. 🎯

Häufig gestellte Fragen

Ist die Lektion „Die Thread-Hierarchie“ kostenlos?

Ja — der vollständige Text von „Die Thread-Hierarchie“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des CUDA Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der CUDA Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Die Thread-Hierarchie“?

Threads werden zu Blöcken und Blöcke zu einem Grid gruppiert. Du übst CUDA Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um CUDA Academy zu starten?

Keine Vorkenntnisse erforderlich. CUDA Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.

Wie lange dauert die Lektion „Die Thread-Hierarchie“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser CUDA Academy-Lektion Code schreiben und ausführen?

Ja. Jede CUDA Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Die Thread-Hierarchie
  2. threadIdx, blockIdx, blockDim
  3. Warum es Blöcke gibt
  4. Threads pro Block auswählen
← Zurück zu CUDA Academy