# Code Generation

The numerical scheme of SeisSol boils down to sparse and dense small matrix multiplications, where small means that the matrices have roughly less than a hundred entries per dimension. Furthermore, all sparsity patterns are known a priori. Before running SeisSol we specify the convergence order, which leads to different matrix sizes, and the architecture that we want to optimize for. Then, we obtain specialized matrix multiplication routines through our code generator for each matrix multiplication. Each one may be either a sparse x dense, dense x sparse, or dense x dense multiplication. When the matrix multiplication is sparse, we hardwire the sparsity pattern into the generated code and order the operations such that the compiler auto-vectorizes them. In the case a dense x dense multiplication, we generate assembler code which makes use of SSE3, AVX, AVX2, or AVX512 instructions, depending on what is available on the architecture. In order to decide if a matrix should be stored sparse or dense, we use auto-tuning.

In the meantime, our code generator is part of the BSD-licensed libxsmm library and is developed further by the Intel Corporation.