sympy2c: From symbolic expressions to fast C/C plus plus functions and ODE solvers in Python']Python

被引:4
|
作者
Schmitt, U. [1 ,2 ]
Moser, B. [2 ]
Lorenz, C. S. [2 ]
Refregier, A. [2 ]
机构
[1] Swiss Fed Inst Technol, Sci IT Serv, Binzmuhlestr 130, CH-8092 Zurich, Switzerland
[2] Swiss Fed Inst Technol, Inst Particle Phys & Astrophys, Wolfgang Pauli Str 27, CH-8093 Zurich, Switzerland
基金
瑞士国家科学基金会;
关键词
code generation; ODE solver; !text type='Python']Python[!/text; Computer algebra; ASTROPY;
D O I
10.1016/j.ascom.2022.100666
中图分类号
P1 [天文学];
学科分类号
0704 ;
摘要
Computer algebra systems play an important role in science as they facilitate the development of new theoretical models. The resulting symbolic equations are often implemented in a compiled programming language in order to provide fast and portable codes for practical applications. We describe sympy2c, a new Python package designed to bridge the gap between the symbolic development and the numerical implementation of a theoretical model. sympy2c translates symbolic equations implemented in the SymPy Python package to C/C++ code that is optimized using symbolic transformations. The resulting functions can be conveniently used as an extension module in Python. sympy2c is used within the PyCosmo Python package to solve the Einstein-Boltzmann equations, a large system of ODEs describing the evolution of linear perturbations in the Universe. After reviewing the functionalities and usage of sympy2c, we describe its implementation and optimization strategies. This includes, in particular, a novel approach to generate optimized ODE solvers making use of the sparsity of the symbolic Jacobian matrix. We demonstrate its performance using the Einstein-Boltzmann equations as a test case. sympy2c is general and potentially useful for various areas of computational physics. sympy2c is publicly available at https://cosmology.ethz.ch/research/software-lab/sympy2c.html. (c) 2022 The Author(s). Published by Elsevier B.V.
引用
收藏
页数:11
相关论文
共 50 条
  • [41] Edlib: a C/C plus plus library for fast, exact sequence alignment using edit distance
    Sosic, Martin
    Sikic, Mile
    BIOINFORMATICS, 2017, 33 (09) : 1394 - 1395
  • [42] Fast distributed compilation and testing of large C plus plus projects
    Matev, Rosen
    24TH INTERNATIONAL CONFERENCE ON COMPUTING IN HIGH ENERGY AND NUCLEAR PHYSICS (CHEP 2019), 2020, 245
  • [43] Higher-Order Discrete Adjoint ODE Solver in C plus plus for Dynamic Optimization
    Lotz, Johannes
    Naumann, Uwe
    Hannemann-Tamas, Ralf
    Ploch, Tobias
    Mitsos, Alexander
    INTERNATIONAL CONFERENCE ON COMPUTATIONAL SCIENCE, ICCS 2015 COMPUTATIONAL SCIENCE AT THE GATES OF NATURE, 2015, 51 : 256 - 265
  • [44] Complex Inclusion Functions in the CoStLy C plus plus Class Library
    Neher, Markus
    MATHEMATICAL SOFTWARE - ICMS 2010, 2010, 6327 : 333 - 336
  • [45] Invited Tutorial Dynamatic: From C/C plus plus to Dynamically Scheduled Circuits
    Josipovic, Lana
    Guerrieri, Andrea
    Ienne, Paolo
    2020 ACM/SIGDA INTERNATIONAL SYMPOSIUM ON FIELD-PROGRAMMABLE GATE ARRAYS (FPGA '20), 2020, : 1 - 10
  • [46] From C/C plus plus Code to High-Performance Dataflow Circuits
    Josipovic, Lana
    Guerrieri, Andrea
    Ienne, Paolo
    IEEE TRANSACTIONS ON COMPUTER-AIDED DESIGN OF INTEGRATED CIRCUITS AND SYSTEMS, 2022, 41 (07) : 2142 - 2155
  • [47] C++QEDv2 Milestone 10: A C++/Python']Python application-programming framework for simulating open quantum dynamics
    Sandner, Raimar
    Vukics, Andras
    COMPUTER PHYSICS COMMUNICATIONS, 2014, 185 (09) : 2380 - 2382
  • [48] A precompiler to reduce the memory footprint of multiscale PDE solvers in C plus
    Bungartz, H. -J.
    Eckhardt, W.
    Weinzierl, T.
    Zenger, C.
    FUTURE GENERATION COMPUTER SYSTEMS-THE INTERNATIONAL JOURNAL OF ESCIENCE, 2010, 26 (01): : 175 - 182
  • [49] CHROMSTRUCT 4: A Python']Python Code to Estimate the Chromatin Structure from Hi-C Data
    Caudai, Claudia
    Salerno, Emanuele
    Zoppe, Monica
    Merelli, Ivan
    Tonazzini, Anna
    IEEE-ACM TRANSACTIONS ON COMPUTATIONAL BIOLOGY AND BIOINFORMATICS, 2019, 16 (06) : 1867 - 1878
  • [50] Investigating Managed Language Runtime Performance Why Java']JavaScript and Python']Python are 8x and 29x slower than C plus plus , yet Java']Java and Go can be faster?
    Lion, David
    Chiu, Adrian
    Stumm, Michael
    Yuan, Ding
    PROCEEDINGS OF THE 2022 USENIX ANNUAL TECHNICAL CONFERENCE, 2022, : 835 - 851