CCP-TEPP SummerSchool 2026
UKRI - STFC
This is a scattershot of content from the following (in development courses) with some additions…
Dot product in a computer
Memory layout
How does optimisation affect matmult, matmult_swapped, and matmult_blas?
\[ D_\text{prod} = \left(\sum_{i=0}^{N/2 - 1} X_i * Y_i\right) + \left(\sum_{i=N/2}^{N - 1} X_i * Y_i\right) \]
The standard way of expressing the improvement is
\[ \text{speedup} = \frac{\text{time without optimisation}}{\text{time with optimisation}} \]
How does parallelism affect the time to complete a fixed input?
Let’s see this in action with an emulation.
pixi initpixi add python mpi4pypixi add --pypi amdahlpixi run mpiexec -n 2 amdahl -w 10 -p 0.5-p 0.9.-p 0.25?\[ \text{s} = \frac{1}{(1-p) + \frac{p}{N}} \] where \(s\) is the overall speedup, \(p\) is the fraction of the program that can be paralellised, and \(N\) is the number of parallel processes.
How does parallelism affect the time if the problem size increases proportionally?
\[ D_\text{prod} = \sum_{i=0}^{N - 1} X_i * Y_i \]
p = 0.9 and p = 0.25\[ \text{s} = (1-p) + p*N \] where \(s\) is the overall speedup, \(p\) is the fraction of the program that can be paralellised, and \(N\) is the number of parallel processes (and the scale of the problem size).
❌ Large error
✔️ High throughput (flops/second)
✔️ Low memory requirements
✔️ Low energy requirements
✔️ Small error
❌ Low throughput
❌ High memory requirements
❌ High energy requirements
Go back to the matmult_blas code. Compare what happend when you use sgemm and float instead of dgemm and double.
