liveBook · Manning

Sequential processing

As explained in Grokking GPU Programming

Sequential execution performs computational steps one at a time rather than concurrently.

Sequential processing handles one element at a time, in order. For a 1,000-number array, a single CPU core doubles data[0], then data[1], continuing through data[999]. That is 1,000 steps in the simple, unvectorized example—not a universal count for modern CPUs, which can use SIMD/AVX to process several elements per instruction. section 1.4

Doubling an array

A sequential loop visits each value before moving to the next: for (int i = 0; i < 1000; i++) { data[i] = data[i] * 2; }. In the parallel contrast, a GPU assigns a thread to each element. Sequential CPU code also serves as a baseline when considering parallel reduction; simply handing that same code to many threads can fail. section 1.4 section 5.4

Figure 1.1 Sequential processing: one core, one element at a time. A single CPU core works through a 1,000-element array step by step, doubling each value before moving on to the next. With only one core doing the work, the total number of steps equals the size of the data: 1,000 elements means 1,000 steps, and the time grows right along with it.

Trace how one CPU core moves through the 1,000 values, one step at a time. section 1.4

How Grokking GPU Programming covers it

How deep it goes
Defines one-at-a-time execution and illustrates a 1,000-element loop, while qualifying the step count as an unvectorized baseline.
Examples
Doubles 1,000 array values in order and uses sequential CPU code as a reduction baseline.
What you can do after
Understand how one-at-a-time CPU execution differs from GPU-style parallel work.
How it connects
Connects sequential processing with data parallelism, SIMD/AVX vectorization, GPU threads, and parallel reduction.

Also explained in

Compare how 11 books explain sequential processing →

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.