As mathematical computing becomes more democratized in high-level languages, high-performance symbolic-numeric systems are necessary for domain scientists and engineers to get the best performance out of their machine without deep knowledge of code optimization. Naturally, users need different term types either to have different algebraic properties for them, or to use efficient data structures. To this end, we developed Symbolics.jl, an extendable symbolic system which uses dynamic multiple dispatch to change behavior depending on the domain needs. In this work we detail an underlying abstract term interface which allows for speed without sacrificing generality. We show that by formalizing a generic API on actions independent of implementation, we can retroactively add optimized data structures to our system without changing the pre-existing term rewriters. We showcase how this can be used to optimize term construction and give a 113x acceleration on general symbolic transformations. Further, we show that such a generic API allows for complementary term-rewriting implementations. We demonstrate the ability to swap between classical term-rewriting simplifiers and e-graph-based term-rewriting simplifiers. We showcase an e-graph ruleset which minimizes the number of CPU cycles during expression evaluation, and demonstrate how it simplifies a real-world reaction-network simulation to halve the runtime. Additionally, we show a reaction-diffusion partial differential equation solver which is able to be automatically converted into symbolic expressions via multiple dispatch tracing, which is subsequently accelerated and parallelized to give a 157x simulation speedup. Together, this presents Symbolics.jl as a next-generation symbolic-numeric computing environment geared towards modeling and simulation.
翻译:随着数学在高层次语言中更加民主化,对于域科学家和工程师来说,需要高性能象征性数字系统才能在不深入了解代码优化的情况下从机器中获得最佳性能。自然,用户需要不同的术语类型,或者对其具有不同的代数属性,或者使用有效的数据结构。为此,我们开发了Comenics.jl,这是一个可扩展的象征性系统,它使用动态多重发送来根据域的需要改变行为。在这项工作中,我们详细描述了一个基本的抽象术语界面,它允许速度,而不会牺牲一般性能。我们通过正式确定一个独立于执行的通用缩略释性缩写信息,我们可以追溯地将优化的数据结构添加到我们的系统,而不必改变原有的术语重写重新编辑功能。我们展示了如何使用这一术语来优化术语的构造,并加速了一般的符号转换。此外,我们展示了这样一个通用的缩略式缩略图允许根据域需要来补充写执行。我们展示了经典术语缩略图的缩略图和基于电子文字的缩略图的缩略图化缩略图。我们通过一个虚拟化的缩略图的缩略图的缩略图来显示一个内部的缩略图的缩略图,然后显示一个缩略图的缩略图的缩略图。我们展示了内部的缩略图的缩略图的缩图的缩图的缩图的缩略图。