|
Peano
|
This page collects design philosophy notes, patterns, idioms and practical tips that recur throughout Peano and its extensions.
Where the architecture page explains how the code is organised into layers, this page captures why* certain recurring implementation choices were made, and how to work with the code base day to day, so both can be reused (or deliberately deviated from) consistently.
Previous generations of Peano and the first generation of ExaHyPE 2 relied on C++ template meta programming to generate code and lacked any Python support. In principle, this would have been a valid way forward, but we wanted to write a piece of software which is accessible to colleagues without extensive C++ knowledge.
In the age of LLMs, we notably wanted to create a piece of software which is easy to use with a language model. For this purpose, Python is hard to beat.
Peano's tarch::logging infrastructure (info, warning, error, debug and tracing messages, plus log filters to narrow down which classes actually report) is documented in full on the logging, tracing, statistics, profiling and assertions page. This section is not a repeat of that reference; it is the practical workflow to follow when you actually have to hunt a bug.
_debug or _asserts archive flavours (see the build variants section of the installation page) and, ideally, link the _debug variant first. Release archives compile assertions out entirely (-DPeanoDebug=0), so a bug that trips an invariant will either silently corrupt state or segfault miles away from its actual cause. Assertions are by far the fastest way to localise a defect - let the code tell you where it broke before you start guessing. Once you are linked against a debug/asserts build, a productive way to narrow down a bug is:
-DPeanoDebug=4 run on anything but a toy setup produces gigabytes of output you will never read. Use a log filter file (see the log filter section on the logging page) to whitelist just the classes/namespaces you suspect, e.g. the observer or action set you are debugging plus peano4::grid for the traversal itself.tarch::logging::LogFilter::switchProgramPhase() if the bug only shows up in one phase of a multi-step algorithm (e.g. only during grid construction, not during the time stepping). This lets you keep the filter file small and phase-specific instead of drowning in logs from unrelated phases._debug before you escalate to a debugger. Peano's logging plus assertions localise the vast majority of bugs on their own; reach for gdb/gpu debuggers only once the log trail runs cold.