Thread
The smallest unit of GPU programming, the atom of the CUDA thread hierarchy, with its own registers but little else.
A thread of execution ("thread" for short) is the lowest unit of programming on a GPU: the base and atom of the CUDA programming model's thread hierarchy. A thread has its own registers, but little else.
Compared with CPU threads#
Both SASS and PTX programs target threads. A typical C program in a POSIX environment, by contrast, targets a process, which is a collection of one or more threads. Unlike POSIX threads, CUDA threads are not used to make syscalls.
- Instruction pointer. Like a CPU thread, a GPU thread can have its own instruction pointer (program counter). For performance, though, GPU programs are usually written so that all threads in a warp share the same instruction pointer and execute in lock-step (see also Warp Scheduler).
- Stack. GPU threads also have stacks in global memory, used for spilled registers and the function call stack. High-performance kernels generally keep use of both to a minimum.
Key idea A GPU thread looks like a CPU thread, but it is meant to run in lock-step with its warp, not independently.
Hardware mapping#
A single CUDA Core executes instructions from a single thread. Threads map onto the cores of a Streaming Multiprocessor.
Related#
- Warp: the group of 32 threads that executes together
- Thread Block: the next level up in the hierarchy
- Registers: the memory private to each thread