Parallelism and performance
Introducido
6:22
Arquitectura de computadoras
This course looks at the machine below the program, and how it earns its speed. The first two units are the contract, the instruction set, and the machine that…
Narración en inglés · subtítulos en inglés y 中文 que puedes cambiar
En esta lección
| English | Significado |
|---|---|
| Amdahl's law/ˈæmdɑːlz lɔː/ | the speed-up from parallel work is limited by the part that must run serially: 1/((1 − p) + p/n) |
| speedup/ˈspiːdʌp/ | |
| instruction-level parallelism/ɪnˈstrʌkʃn ˈlevl ˈpærəlelɪzəm/ | paralelismo a nivel de instrucción |
| weak scaling/wiːk ˈskeɪlɪŋ/ | growing the problem size with the number of processors, keeping the work per processor fixed |
| strong scaling/strɒŋ ˈskeɪlɪŋ/ | keeping the problem size fixed while adding processors |
| Efficiency/ɪˈfɪʃənsi/ | The fraction of total energy or power input converted to useful output. |
| Load imbalance/ləʊd ɪmˈbæləns/ | Uneven division of work among parallel workers, so some sit idle while the slowest finishes. |
| Karp–Flatt metric/kɑːp flæt ˈmetrɪk/ | the serial fraction estimated from a measured speed-up, used to see why scaling falls short |
Techo de Amdahl
- Un programa tiene una fracción serial y una fracción paralelizable $f$. Con $p$ procesadores: $\text{Speedup} = 1/((1-f) + f/p)$ — la parte serial nunca disminuye, y cuando $p \to \infty$ el límite de aceleración es $1/(1-f)$.
- Con $f = 0.9$: como máximo $10\times$; con $p = 8$: $4.71\times$; con $p = 16$: $6.40\times$ — los ocho procesadores adicionales añaden $1.7\times$ donde los primeros añadieron $4.7\times$. Con $f = 0.99$, alcanzar $50\times$ requiere exactamente $p = 99$.


With f = 0.9, the speedup ceiling is —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
As p grows without bound, speedup tends to 1/(1 − f) = 10.
With a parallel fraction $f = 0.9$, enough processors can give a $12\times$ speedup.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
As $p \to \infty$ the speedup tends to $1/(1 - f) = 1/0.1 = 10\times$. The serial $10\%$ never shrinks, so $12\times$ is impossible.
Calcule la aceleración
- Una renderización pasa 36 s en composición (serial) y 64 s en sombreado (paralelo): $f = 0.64$. Con 4 procesadores: $1/(0.36 + 0.16) = 1.92\times$, tiempo de ejecución $52.0$ s. Con 8: $2.27\times$, $44.0$ s — la cola serial ahora domina, y la siguiente compra debe ser un algoritmo, no una máquina.
- Informe solo las aceleraciones medidas: la línea base es el mismo programa en la misma máquina con un núcleo activo; los números máximos asumen $f = 1$, que ningún programa alcanza.
36 s serial + 64 s parallel on p = 4 gives —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
f = 0.64: 1/(0.36 + 0.16) = 1.92; runtime 100 × 0.52 = 52.0 s.
La escalera del paralelismo
- Antes de los núcleos, la propia pipeline representa paralelismo a nivel de instrucción: la máquina de 5 etapas superpone cinco instrucciones. Los hilos de hardware (SMT) rellenan los huecos de la pipeline con trabajo de otro hilo; las matemáticas de las dependencias siguen aplicándose por hilo.
- La pila — ILP dentro de un núcleo, hilos por núcleo, núcleos por chip — es una sola escalera con una sola disciplina: cada peldaño depende de Amdahl.
The pipeline itself is a form of —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Five stages overlap five instructions — ILP within one core.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Strong and weak scaling
- Amdahl keeps the problem size fixed (strong scaling 强扩展). Gustafson grows the problem with the machine (weak scaling 弱扩展): if a run on $p$ processors spends a fraction $s$ on serial work, the scaled speedup is $s + (1 - s)p$. With $s = 0.1$ on $16$ processors: $0.1 + 0.9 \times 16 = 14.5\times$.
- Both are correct answers to different questions. Amdahl asks how much faster this job gets; Gustafson asks how much bigger a job fits in the same time. Synchronisation and communication add costs that neither formula counts, so always measure.
A program is 95% parallelizable. What is the largest possible speedup by Amdahl's law?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
The ceiling is 1 / (1 - 0.95) = 1 / 0.05 = 20.
A run on 32 processors is 5% serial. What is the scaled (Gustafson) speedup?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
0.05 + 0.95 x 32 = 0.05 + 30.4 = 30.45.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
The slowest worker sets the time
- Four workers get tasks of 10, 10, 10 and 18 s. The job ends when the last one ends: 18 s, against an ideal of $48/4 = 12$ s.
- Efficiency 效率 is $48/(4 \times 18) = \mathbf{66.7\%}$. Load imbalance 负载不均衡 wastes cores that Amdahl's formula assumes are busy. Dynamic scheduling hands out small tasks so that no worker waits.
Tasks of 10, 10, 10 and 18 s on four workers: efficiency (one decimal, %)?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
$48/(4 \times 18) = 0.667$.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Worked example: measure the serial fraction
- On 16 processors a job runs 6.4 times faster: efficiency $6.4/16 = 40\%$. The Karp–Flatt metric 卡普弗拉特度量 turns that into the serial fraction that is really there: $e = (1/S - 1/p)/(1 - 1/p)$.
- $e = (0.156 - 0.0625)/0.9375 = \mathbf{0.10}$, exactly Amdahl's $1 - f$ for $f = 0.9$. If $e$ grows with $p$, the overhead is growing too, and more processors will not help.
Speedup 6.4 on 16 processors: Karp–Flatt serial fraction (two decimals)?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
$(1/6.4 - 1/16)/(1 - 1/16) = 0.09375/0.9375 = 0.10$.
A Karp–Flatt fraction that grows with $p$ means the program has no parallel overhead.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
It means overhead such as communication grows with $p$.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Marks that slip away
- Expecting $p$ times faster on $p$ cores. With $f = 0.9$, $8$ cores give $4.71\times$, and no number of cores passes $10\times$.
- Taking a peak figure as a speedup 加速比. Measure against the same program on one core of the same machine; peak figures assume $f = 1$.
- Mixing up Amdahl and Gustafson. Amdahl fixes the problem size; Gustafson grows it with the machine. They answer different questions.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Recap
- Amdahl: speedup 加速比 $= 1/((1-f) + f/p)$, capped at $1/(1-f)$.
- $f = 0.9$: $4.71\times$ on 8 processors, $10\times$ at most.
- Gustafson's scaled speedup $s + (1-s)p$ grows with the problem.
¿Qué salió mal? Solo el equipo del sitio ve esta información.