pystencils - Automatic Generation, Optimization and Analysis of Stencil Codes

Beitrag bei einer Tagung
(Abstract zum Poster)

Details zur Publikation

Autor(en): Hönig J, Bauer M
Jahr der Veröffentlichung: 2018
Sprache: Englisch


We present a Python-based metaprogramming toolkit for stencil codes called pystencils.

pystencils reduces development and maintenance costs, increases readability and reusability of compute-intensive numerical kernels by introducing high-level abstractions.  

This is achieved with a domain-specific language (DSL) based on SymPy.

A DSL in SymPy provides not only an extensible and flexible model formulation but also a computer algebra system, which is very useful for the manipulation of the problem description. The model can be described on multiple abstraction levels, either directly as a stencil code, or preferably as a pure mathematical formulation which is then automatically discretized and transformed into a stencil description. 

This stencil description is represented as an abstract syntax tree (AST), which undergoes multiple transformations. The toolkit provides optimizing transformations, that operate on the AST, like loop splitting/merging, SIMD vectorization or common subexpression elimination.

The AST is then passed to one of the backends to generate C++, CUDA or LLVM code. 

For performance evaluation, the generated kernel can be automatically benchmarked and examined in detail with the help of kerncraft - a loop kernel analysis and performance modeling toolkit. Generated kernels can be integrated into existing C/C++ frameworks like waLBerla, or run directly from Python. Direct execution in Python allows fast prototyping since all of Python's powerful utilities and libraries are available.

All these features make pystencils a powerful tool for systematic performance engineering of numerical compute kernels that simplifies or automates important steps in development, analysis, and optimization of the kernel.

FAU-Autoren / FAU-Herausgeber

Bauer, Martin
Lehrstuhl für Informatik 10 (Systemsimulation)
Hönig, Jan
Lehrstuhl für Informatik 10 (Systemsimulation)


Hönig, J., & Bauer, M. (2018, June). pystencils - Automatic Generation, Optimization and Analysis of Stencil Codes. Poster presentation at ISC High Performance 2018, Frankfurt am Main, DE.

Hönig, Jan, and Martin Bauer. "pystencils - Automatic Generation, Optimization and Analysis of Stencil Codes." Presented at ISC High Performance 2018, Frankfurt am Main 2018.


Zuletzt aktualisiert 2019-24-04 um 06:21