The Lightweight Stage-Programming Framework introduced in this slides can be used for making efficient parallel DSL which can be transformed to MapReduce programs. To understand this slides, please firstly read http://www.slideshare.net/YuLiu19/a-generatetestaggregate-parallel-programming-library-on-spark.
4. Demo
● A G+A implementation on Delite/LMS
● Runnable (please omit the results)
● Not finished part is only the actual code-
generators
5. Language Virtualization
H. Chafi et al., ‘‘Language Virtualization for Heterogeneous Parallel Com-
puting,’’ Proc. ACM Int’l Conf. Object Oriented Programming Systems
Languages and Applications,ACM Press, 2010, pp. 835-847.
6. Internal Implementation
● Scala-Virtualized (Tool Demo: Scala-Virtualized,
EPFL2012)
– Scala-Virtualized extends the Scala language
and compiler with a small number of
features that enable combining the benefits
of shallow and deep embeddings of DSLs
8. ●Lightweight Module Stage
● The ideas of LMS are:
– A library-based multi-stage programming ap-
proach
– The DLSs are implemented as “librarys” on
hosted languages, i.e., internal DSLs
– Based on the approach of “language virtual-
ization”
9. DLSs on Delite Are
Embedded DSLs
● Delite is framework for heterogeneous
parallel framework for DSLs (multi-core,
GPU)
● Delite is based on LMS
● Delite/LMS use Scala as host-language
10. Embedded DSLs on Delite
Framework
A Heterogeneous Parallel Framework forDomain-Specific Languages,PACT11
13. An example of LMS (3)
2
1
- Rewrite the “fusion_body” function as “multi-method”
- the rest thing is to implement the code-generator
14. An example of LMS (4)
The code-
generator
generates the
real code, e.g.,
Scala code
IR node
15. Naive GTA
generateSubList (list)
filterWith ascending
aggregateBy maxSumAggregator
● Yellows are functions, reds are objects
● generateSubList (list:List[Int]) will produce a Generator
instance
● Generator has a method: filterWith(Test):[Bag]
● aggregateBy is an infix operator of class Aggregatexxx
● maxSumAggregator is an object of Aggregatexxx
16. DLSs on Delite Are
Embedded DSLs
1.Defining abstract front-end language types that are
independent from our back-end datastructures
2.Defining separate packages for abstract operations,
IR nodes and code generators
3.Declaring which parts of Scala we want to allow DSL
applications to use (in this case, everything)
4.Telling Delite how to access our code generators
5.Providing a utility method to map the data structure
we defined earlier to one that will be used from
generated code
17. Some Details of Delite/LMS
● LSM framework provides basic means to
construct IR nodes for DSL operations
● The Delite compiler framework provide high-
level repsentations of execution patterns
through DeliteOp IR
18. Some Details of LMS
● The DSL will be firstly compiled to IR
nodes
– IR nodes are instances of DSL operations
– IR nodes are connected by their depen-
dency
– Each IR node is a symbol and its definition
● A CFG(control flow graph) also generated
● After IR-optimization, code generator will
generate codes for IR representation
19. Optimization and
Parallelization
● LMS based on Scala-Virtualized which
provides a special Scala complier by which
some contral flows can be translated to
function-calls
● By stage programming functions can be
generated to
CUDA/OpenCL/Scala/C/Matlab... and
parallelized
20. Delite Collections and Ops
● Delite can automaticly parallelize ops on
some collection types
– Provide multiloop/map/reduce … as
primitive operations
– DSLs built on Delite can enjoy this parallel
operations
21. The DSL for GTA
● Design DSLs on Delite/LMS are just design
expressive scala-libraries
● Semantics and syntax of the GTA-DSL
– Thinking as a library, the paradigm is simple
– But … more about language-design is under
considering
22. Conclusions
● GTA can be expressed as a DSL using Delite
● Such GTA-DSL can be optimized and
parallelized (also translated to mapreduce)
● Still cannot run on clusters
● Similar approaches of Delite may be
implemented by compiler-plugins of Scala