CppCon 2023 Symbolic Calculus for High-performance Computing Using C++23 -- Vincent Reverdy

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting some upcoming talks that you will be able to attend this year. Here’s another CppCon future talk we hope you will enjoy – and register today for CppCon 2023!

Symbolic Calculus for High-performance Computing From Scratch Using C++23

Wednesday, October 4 • 16:45 - 17:45

by Vincent Reverdy

Summary of the talk:

Wouldn't it be nice to be able to type and manipulate symbolic mathematical formulas directly in C++? On top of providing a much more natural interface for scientists to express their ideas in code, it would constitute a particularly relevant approach to disentangle scientific application domains on one side, and high-performance computing and low-level optimizations on the other side. In this talk, we will see how building symbolic calculus tools can be achieved in plain C++23 without any compiler magic. We will see how symbolic derivatives and integrals can be computed at compile-time and we will see how the technique can be leveraged to speed-up linear algebra computations. A particular focus will be given to the concepts and to the building blocks so that the approach can be easily tweaked and adjusted to other problems, and it will be shown that the decoupling of concerns allows to combine genericity, expressivity, and high-performance in code.

In practice, we will dive into a new take on expression templates that modern C++ makes much easier to handle. In particular, we will introduce stateless formulas as a way to avoid some of the complexities that use to make traditional expression templates especially difficult to manage in codebases. We will see how Class Template Argument Deduction and unevaluated lambdas as template parameters can be combined to produce uniquely typed symbolic variables that will serve as the atoms of symbolic formulas. Implementation strategies to optimize both compile-time and runtime performance will be discussed. The talk will be illustrated with numerous examples together with their corresponding generated assembly code to show that the zero-cost abstraction principle is ensured by the set of presented techniques. Beyond the technical aspects, a broader discussion will be opened on how this approach can be combined with existing and upcoming linear algebra components of the C++ standard library (mdspan, mdarray, BLAS...) to ensure the highest level of performance when it comes to scientific computing.

The goal of this talk is really to highlight the overall strategy of implementation and the set of techniques necessary to bring symbolic calculus into high-performance code and make it as accessible as possible so that everyone can play with it. The evolution of C++ has made it much simpler to implement such things.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.