liveBook · Manning

Vector addition

Vector addition is the operation of adding corresponding components of compatible vectors to produce a vector sum.

How 2 Manning books explain it

GPU Programming with Triton

Vector addition is the element-wise operation that adds corresponding components of two equal-sized vectors to produce a third vector.

How it is used
Uses vector addition as a first workload for writing and launching a Triton GPU kernel.
How deep it goes
Explains the element-wise definition and block-level kernel mapping, then defers fused workloads to later treatment.
Examples
Compares Python, PyTorch, and Triton implementations on vectors, including a 98,432-element correctness and timing example.
What you can do after
Build it from scratch as a Triton kernel and host wrapper, then check and benchmark its output.

Read how GPU Programming with Triton explains vector addition →

Grokking GPU Programming

Vector addition combines two vectors by adding their corresponding components.

How it is used
Uses vector addition as a first two-input map and a practical example of independent element-wise parallel work.
How deep it goes
Works through the element-wise operation, per-thread indexing, bounds checks, and CUDA launch sizing.
Examples
Shows adding [1, 2, 3] and [4, 5, 6], then assigns each indexed addition to one thread.
What you can do after
Builds a CUDA vector-add kernel by assigning each output index to a thread that adds matching inputs.

Read how Grokking GPU Programming explains vector addition →

Also covered in

What to know first

Related concepts

Questions about vector addition

What is vector addition?

Vector addition is the operation of adding corresponding components of compatible vectors to produce a vector sum.

Which Manning books explain vector addition?

GPU Programming with Triton and Grokking GPU Programming.

What should I know before learning vector addition?

Manning books that teach vector addition usually introduce vector first.

What is vector addition a kind of?

Vector addition is a kind of vector arithmetic. Vector arithmetic is the application of operations such as addition, subtraction, scalar multiplication, and weighted combinations to numerical vectors.

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.