Experience converting a large mathematical software package written in C++ to C++20 modules
- URL: http://arxiv.org/abs/2506.21654v1
- Date: Thu, 26 Jun 2025 17:38:33 GMT
- Title: Experience converting a large mathematical software package written in C++ to C++20 modules
- Authors: Wolfgang Bangerth,
- Abstract summary: I describe an approach that allows providing both header-based and module-based interfaces from the same code base.<n>Conversion to modules is possible, resulting in a reduction in compile time for the converted library itself.<n>I end with thoughts about long-term strategies for converting the entire ecosystem of mathematical software.
- Score: 0.0
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: Mathematical software has traditionally been built in the form of "packages" that build on each other. A substantial fraction of these packages is written in C++ and, as a consequence, the interface of a package is described in the form of header files that downstream packages and applications can then #include. C++ has inherited this approach towards exporting interfaces from C, but the approach is clunky, unreliable, and slow. As a consequence, C++20 has introduced a "module" system in which packages explicitly export declarations and code that compilers then store in machine-readable form and that downstream users can "import" -- a system in line with what many other programming languages have used for decades. Herein, I explore how one can convert large mathematical software packages written in C++ to this system, using the deal.II finite element library with its around 800,000 lines of code as an example. I describe an approach that allows providing both header-based and module-based interfaces from the same code base, discuss the challenges one encounters, and how modules actually work in practice in a variety of technical and human metrics. The results show that with a non-trivial, but also not prohibitive effort, the conversion to modules is possible, resulting in a reduction in compile time for the converted library itself; on the other hand, for downstream projects, compile times show no clear trend. I end with thoughts about long-term strategies for converting the entire ecosystem of mathematical software over the coming years or decades.
Related papers
- PyMarian: Fast Neural Machine Translation and Evaluation in Python [11.291502854418098]
We describe a Python interface to Marian NMT, a C++-based training and inference toolkit for sequence-to-sequence models.
This interface enables models trained with Marian to be connected to the rich, wide range of tools available in Python.
arXiv Detail & Related papers (2024-08-15T01:41:21Z) - ViC: Virtual Compiler Is All You Need For Assembly Code Search [9.674880905252628]
This paper explores training a Large Language Model (LLM) to emulate a general compiler.
We further pre-train CodeLlama as a Virtual Compiler (ViC), capable of compiling any source code of any language to assembly code.
We achieve a substantial improvement in assembly code search performance, with our model surpassing the leading baseline by 26%.
arXiv Detail & Related papers (2024-08-10T17:23:02Z) - Transforming C++11 Code to C++03 to Support Legacy Compilation Environments [1.6851123188451185]
We create a source code transformation framework to automatically backport code written according to the C++11 standard to its functionally equivalent C++03 variant.
This paper reports on the technical details of the transformation engine, and our experiences in applying it on two large industrial code bases and four open-source systems.
arXiv Detail & Related papers (2024-05-12T08:02:21Z) - depyf: Open the Opaque Box of PyTorch Compiler for Machine Learning Researchers [92.13613958373628]
textttdepyf is a tool designed to demystify the inner workings of the PyTorch compiler.
textttdepyf decompiles bytecode generated by PyTorch back into equivalent source code.
arXiv Detail & Related papers (2024-03-14T16:17:14Z) - Guess & Sketch: Language Model Guided Transpilation [59.02147255276078]
Learned transpilation offers an alternative to manual re-writing and engineering efforts.
Probabilistic neural language models (LMs) produce plausible outputs for every input, but do so at the cost of guaranteed correctness.
Guess & Sketch extracts alignment and confidence information from features of the LM then passes it to a symbolic solver to resolve semantic equivalence.
arXiv Detail & Related papers (2023-09-25T15:42:18Z) - Evaluation of OpenAI Codex for HPC Parallel Programming Models Kernel
Generation [1.7646846505225735]
We evaluate AI-assisted generative capabilities on fundamental numerical kernels in high-performance computing.
We test the generated kernel codes for a variety of language-supported programming models.
We propose a proficiency metric around the initial 10 suggestions given for each prompt.
arXiv Detail & Related papers (2023-06-27T00:11:31Z) - HDCC: A Hyperdimensional Computing compiler for classification on
embedded systems and high-performance computing [58.720142291102135]
This work introduces the name compiler, the first open-source compiler that translates high-level descriptions of HDC classification methods into optimized C code.
name is designed like a modern compiler, featuring an intuitive and descriptive input language, an intermediate representation (IR), and a retargetable backend.
To substantiate these claims, we conducted experiments with HDCC on several of the most popular datasets in the HDC literature.
arXiv Detail & Related papers (2023-04-24T19:16:03Z) - QParallel: Explicit Parallelism for Programming Quantum Computers [62.10004571940546]
We present a language extension for parallel quantum programming.
QParallel removes ambiguities concerning parallelism in current quantum programming languages.
We introduce a tool that guides programmers in the placement of parallel regions by identifying the subroutines that profit most from parallelization.
arXiv Detail & Related papers (2022-10-07T16:35:16Z) - Extending Python for Quantum-Classical Computing via Quantum
Just-in-Time Compilation [78.8942067357231]
Python is a popular programming language known for its flexibility, usability, readability, and focus on developer productivity.
We present a language extension to Python that enables heterogeneous quantum-classical computing via a robust C++ infrastructure for quantum just-in-time compilation.
arXiv Detail & Related papers (2021-05-10T21:11:21Z) - Extending C++ for Heterogeneous Quantum-Classical Computing [56.782064931823015]
qcor is a language extension to C++ and compiler implementation that enables heterogeneous quantum-classical programming, compilation, and execution in a single-source context.
Our work provides a first-of-its-kind C++ compiler enabling high-level quantum kernel (function) expression in a quantum-language manner.
arXiv Detail & Related papers (2020-10-08T12:49:07Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.