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 and has a wide range of applications, e.g. weather forecasts, climate simulation, vehicle and aircraft design. While modern computers have enabled simulations of fluid flows with unprecedented precision and performance, the increasing complexity of parallel and heterogenous architectures makes it difficult for numerical scientists and practitioners to use hardware platforms to their full potential.

This makes the domain of computational fluid dynamics (CFD) an ideal target for deploying DSLs. In a DSL, domain-experts can express their problems at the right level of abstraction in a natural and concise way, leading to increased productivity. Moreover, a DSL compiler can exploit domain-specific knowledge to automatically generate highly efficient code for parallel or heterogeneous platforms from abstract expressions in the DSL.

At the Chair for Compiler Construction we have developed the CFDlang DSL aimed at fluid simulations that rely heavily on tensor expressions. CFDlang is easy to use and integrates well with existing numerical codes written in Fortran or C/C++. The code generated by the CFDlang compiler performs as well, and often better than optimized code that has been hand-tuned by a numerical expert in a laborious and time-consuming process.

In collaboration with researchers at MINES ParisTech and ENS Paris, we have also studied methods that are generally applicable to the problem of optimizing tensor-processing codes from different application domains. This has led us to the development of TeML, the Tensor optimizations Meta-Language. TeML has been demonstrated capable of producing better optimization results than state-of-the-art tools such as Pluto.

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


Go back