Domain specific languages (DSLs) and tools

Domain specific languages (DSLs) provide means for programming with first-class domain-specific concepts and programming models—typically at the cost of not providing the computational power of GPLs. This way, DSL-based programs are, typically, much more declarative than programs written in a general purpose language, focusing more on the “what” of a problem to be solved rather than on the exact “how” in form of a specific algorithm. Examples of DSLs in widespread use are the Structured Query Language (SQL), HTML 5, or Modelica, a language for object-oriented physical modelling.

Domain specific languages generally offer two major key benefits. First, domain experts can program in an adequate DSL without actually being trained in general programming and computer architecture. Hence, they lower the entrance barrier to programming for people not educated in computer science or a related subject. Second, from the restriction to a particular domain, highly specialized and efficient software tooling can be provided. For instance, compilers can automatically perform performance optimizations on DSL-based code which are not possible in GPLs: since additional information on the problem domain is available, search spaces may be pruned, and the knowledge of possible operations, their interaction with each other and their impact on data structures enables corresponding optimizations.

At the chair for compiler construction we aim at leveraging the additional domain-specific information provided by DSLs for new domain-specific optimizations. We further want to make DSL programming a more sophisticated experience for domain experts to enable them to get the best from their code at the least possible effort. Together with our project partners, we do DSL-related research in multiple domains from the areas of embedded computing as well as cloud and scientific computing. Some of these projects are discussed below.

Parallel Particle Mesh Environment

The "Parallel Particle Mesh Environment (PPME)" is a domain-specific language and development environment for implementing scientific simulations based on particle and mesh methods. It generates Fortran code that links with the PPM library, which is developed by the MOSAIC group. PPM already includes a preprocessor-based language to ease writing clients to the library. However, this language does not provide any syntactic checking, optimisations, editing or debugging capabilities.

Thus, to address these problems, the main objectives of PPME are
•    providing a high-level and simple to use fronted for PPM client applications
•    avoiding the need for explicit parallelisation code
•    providing editing capabilities that guide the development, e.g., by checking constraints
•    using domain-specific knowledge to do advanced optimisations, e.g., to reduce the simulation time or to increase precision
•    providing sufficient extensibility to support different target languages and new features

An open source prototype of PPME is hosted at BitBucket. It uses JetBrain's "Meta Programming System (MPS)" as an implementation platform. Using MPS, we can support a very high level of specification and abstraction which comes close to a natural mathematical notation. Current IDE features include static type checking and name resolution, automatic code generation, support of physical units and automatic precision analysis of equations. The screenshot below gives a first impression on the features of PPME; it shows the implementation of a Gray-Scott reaction-diffusion system.



Tensors in Computational Fluid Dynamics

Numerical methods have tremendously accelerated the pace of science and engineering. The field of fluid dynamics, in particular, relies heavily on numerical and computational methods. Fluid dynamics has a wide range of applications: examples from every-day life include weather forecasts, climate simulation, and the design of vehicles and aircraft. While modern parallel computers have enabled simulations of fluid flows with unprecedented precision and performance, these simulations remain extremely computationally intense, consuming many thousands of CPU hours. Therefore, numerical scientists and practitioners expend great effort optimizing the program code that implements their simulations.

This makes the domain of computational fluid dynamics (CFD) an ideal target for deploying DSLs, which can provide numerical experts with the right tools and abstractions for expressing their simulations. This has two key advantages. First, domain experts can express their problems and algorithms more naturally and concisely, leading to increased productivity. Second, a DSL compiler can exploit domain-specific or problem-specific knowledge to automatically generate highly efficient code from abstract expressions in the DSL.

At the Chair for Compiler Construction we have developed the CFDlang DSL aimed at simulations that rely heavily on tensor expressions. Using the CFDlang DSL, numerical experts can express performance-critical operations at a high level of abstraction. CFDlang’s code generator then uses both domain knowledge and information about the target platform to generate efficient code from abstract tensor expressions. The generated code has been demonstrated to perform as well as, and often better than optimized code that has been hand-tuned by a numerical expert in a laborious and time-consuming process of profiling and adjusting incremental versions of the simulation code. In this work we collaborate with experts from the field of fluid dynamics at TU Dresden and with Adilla Susungi and her supervisors at MINES ParisTech and ENS Paris.

(a) Simulated fluid flow (1000s of CPU hours). (b) Performance, more is better.



Go back