Optimizing Matrix Multiplication On NERSC’s High Performance Computer Cori
Xuan Jiang, William Lin, Ansh Nagda · 2022
We use a variety of techniques to optimize the single-threaded operation of:C = C + A * BA number of optimizations techniques yielded significant speedups, including multi-level blocking, copy optimizations, and loop adjustments. However, we also tried a number of other optimizations that did not improve our program, including prefetching. In this report, we describe each of our optimizations in our final submission, present results with evidence that they work, and describe attempted optimizations that did not noticeably improve overall our performance. Unless otherwise noted, all of our benchmarks operate on matrices of size 1024x1024.In our attempts at optimizing matrix multiplication, we find that taking full advantage of spatial locality (through techniques like loop rearrangement or copy optimizations) and instruction-level parallelism greatly improves the performance of our operation. Furthermore, techniques like prefetching can be a double-edged sword; it can help performance when used correctly but can slow down performance as well. Finally, we find that the compiler adds optimizations out-of-the-box, like loop-unrolling, that help with performance underneath.