Context-Sensitive Computations on Hierarchical Models

Complex code transformations and compositions can be useful in a variety of application domains. One of these is the programming of wildly heterogeneous systems, which introduces new challenges to maintain programmability, because developers do not only have to produce parallel code, but also code for very different and potentially unanticipated target platforms.

Current parallelization and distribution strategies are able to handle those concerns for specific target platforms efficiently, but are both not easily exchangeable and require detailed knowledge of the application code, its performance, and the target platform. A common strategy to create a parallel program is to gradually extend a sequential program with the commands and pragmas, a process called progressive parallelization. This process, however, causes an entanglement of concerns that makes testing, benchmarking, and evolving both the core code and the additions difficult.

To overcome these problems, we introduce a novel code composition and transformation approach called Orchestration Style Sheets (OSS). OSS borrow the well-known concept of style sheets and transfer it to annotation and enrichment of source code, in this case for parallelization. Parallelization (and other secondary) concerns are externalized into styles that can be defined separately as well as exchanged and reused for multiple programs. This approach is similar to aspect-oriented programming (AOP), but goes further in some respects: e.g., the pragmas used in the Open* languages are heavily parametrized with elements of the core code like lists of private or shared variables. In principle, many of these parameters can be deduced automatically, which requires static analysis of the core program. OSS offer user-defined attributes that can perform this analysis, thus eliminating the error-prone process of deriving the parameters manually and allowing a reuse of styles.

While parallelization is the current main focus, the approach is both language-independent and applicable to different use cases. Currently, there are several systems based on this framework: OSS for Fortran, a language (still) frequently used in parallel programming has been used to evaluate the concept in realistic use cases like simulations used in mechanical engineering. A second, large system is Java-based and uses a complete attribute grammar-based compiler front-end. Additionally, the framework can easily be applied to smaller languages, i.e. domain-specific languages.