pystencils - Automatic Generation, Optimization and Analysis of Stencil Codes

Hönig J, Bauer M (2018)


Publication Language: English

Publication Type: Conference contribution, Abstract of a poster

Publication year: 2018

Event location: Frankfurt am Main DE

Abstract

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.

Authors with CRIS profile

Related research project(s)

How to cite

APA:

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.

MLA:

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.

BibTeX: Download