In a previous paper1, we described QUAFF, a skeleton-based parallel programming library which main originality is to rely on C++ template meta-programming2,3 techniques to significantly reduce the overhead traditionally associated with object-oriented implementations of such libraries. The basic idea is to use the C++ template mechanism so that skeleton-based programs are actually run at compile-time and generate a new C+MPI code to be compiled and executed at run-time. The implementation mechanism supporting this compile-time approach to skeleton-based parallel programming was only sketched mainly because the operational semantics of the skeletons were not stated in a formal way, but “hardwired” in a set of complex meta-programs. As a result, changing this semantics or adding a new skeleton was difficult. In this paper, we give a formal model for the QUAFF skeleton system, describe how this model can efficiently be implemented using C++ meta-programming techniques and show how this helps overcoming the aforementioned difficulties. It relies on three formally defined stages. First, the C++ compiler generates an abstract syntax tree representing the parallel structure of the application, from the high-level C++ skeletal program source. Then, this tree is turned into an abstract process network by means of a set of production rules; this process network encodes, in a platform-independent way, the communication topology and, for each node, the scheduling of communications and computations. Finally the process network is translated into C+MPI code. By contrast to the previous QUAFF implementation, the process network now plays the role of an explicit intermediate representation. Adding a new skeleton now only requires giving the set of production rules for expanding the corresponding tree node into a process sub-network. The paper is organized as follows. Section 2 briefly recalls the main features of the QUAFF programming model. Section 3 presents the formal model we defined to turn a skeleton abstract syntax tree into a process network. Section 4 shows how template meta-programming is used to implement this model. We conclude with experimental results for this new implementation (section 5) and a brief review of related work (section 6).
[1]
Jean-Thierry Lapresté,et al.
Quaff: efficient C++ design for parallel skeletons
,
2006,
Parallel Comput..
[2]
Rita Loogen,et al.
Automatic Skeletons in Template Haskell
,
2003,
Parallel Process. Lett..
[3]
Kevin Hammond,et al.
Research Directions in Parallel Functional Programming
,
1999,
Springer London.
[4]
David Abrahams,et al.
C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (C++ In-Depth Series)
,
2004
.
[5]
Tobias Langhammer,et al.
Combining partial evaluation and staged interpretation in the implementation of domain-specific languages
,
2006,
Sci. Comput. Program..
[6]
Salvatore Orlando,et al.
P3 L: A structured high-level parallel language, and its structured support
,
1995,
Concurr. Pract. Exp..
[7]
Todd L. Veldhuizen,et al.
Using C++ template metaprograms
,
1996
.
[8]
Jocelyn Sérot,et al.
Skeletons for parallel image processing: an overview of the SKIPPER project
,
2002,
Parallel Comput..
[9]
Krzysztof Czarnecki,et al.
DSL Implementation in MetaOCaml, Template Haskell, and C++
,
2003,
Domain-Specific Program Generation.
[10]
Herbert Kuchen,et al.
A Skeleton Library
,
2002,
Euro-Par.
[11]
Marco Danelutto,et al.
Skeleton-based parallel programming: Functional and parallel semantics in a single shot
,
2007,
Comput. Lang. Syst. Struct..
[12]
Franz Franchetti,et al.
SPIRAL: Code Generation for DSP Transforms
,
2005,
Proceedings of the IEEE.