Scala at Stanford Pervasive Parallelism Laboratory

By bagwell

Created 2009-09-08, 10:56

Professor Kunle Olukotun, director of Stanford Pervasive Parallelism Laboratory(PPL)[1], introduced his talk at EPFL, August 2009, slides here,[2] with "Now that we are firmly entrenched in the multicore architecture era, to take full advantage of these architectures, many application developers will have to develop parallel applications. However, today, parallel programming is so difficult that it is only practiced by a few elite programmers. Thus, a key research question is what set of hardware and software technologies will make parallel computation accessible to average programmers. I would like to outline the approach we are taking to answer this question in the Stanford Pervasive Parallelism Laboratory."

The PPL was founded with a 6 million dollar budget in May 2008 by Stanford and backed by a group of industry leaders, Sun Microsystems/Oracle, Advanced Micro Devices, Nvidia, I.B.M., Hewlett-Packard, Intel and NEC. The Stanford researchers have identified critical challenges and are proposing practical approaches to meet them. Their goal is to make parallel computing practical for the masses by 2015 with a first platform by 2012.

Scala has become an essential part of his strategy. A recognised pioneer in the field of multi-core chip design, he described today's bottlenecks and suggests how hardware architecture must be adapted, moving functions such as thread scheduling, Transaction Monitors and message passing from software to hardware. He identified how Domain Specific Languages (DSLs), built on Scala, can be used to capture the inherent parallelism in common fields of computation to more fully exploit the performance potential of future distributed, multi-threaded computer architectures.

Collaborating departments at Stanford, such as Media-X, Environmental Science, Hypersonic Vehicle Simulation, Biological Structure simulation, Robotics, Geophysics, Graphics & Games are providing PPL with the essential practical domain knowledge required for a DSL definition. The principles can be expected to be applicable to creating DSLs for common commercial application domains too. Each DSL definition embodies high-level types and operators together with optimization techniques for their parallelization. These DSLs are all expressed in Scala, their chosen common parallel object language. The Scala code will be executed on a common parallel runtime that is underpinned by a heterogeneous hardware architecture.

Professor Olukotun cited a number of reasons why Scala had been chosen to provide the common parallel object language for their DSLs.

First, Scala bridges the gap between functional and object oriented programming which allows the use of the right programming style for various use cases.

Second, Scala is nearly as productive as popular dynamic languages such as ruby and python while retaining the performance of a statically typed language that targets a high performance managed runtime such as Sun's HotSpot.

Finally, The core Scala language is small but very expressive, this means that new abstractions can be provided as libraries but have the look and feel of built in language features. This is ideal for building DSLs.

The Stanford group is using Scala to develop the Delite framework for authoring implicitly parallel DSLs and the Delite runtime for automatically extracting parallelism from a program written using a Delite-based DSL. You can find examples of the Scala framework code in his slides.

Delite DSLs defer their operations and dynamically build a task graph. Calls to a Delite DSL method return immediately with a proxy that behaves exactly as a concrete instance of the DSL type. Prof. Olukotun explained how Scala traits make it simple to prototype a system that makes operation deferral transparent to the DSL user. Scala pattern matching provides a elegant mechanism for DSL authors to specify domain-specific optimizations rules for Delite to apply at run-time.

Future work will investigate the use of compiler plugins to perform static analysis and optimization to enhance the performance of a program written using a Delite DSL.

Concurrency and Multi-core parallelism is central to the Scala design and on-going research. The complementary research work at PPL applies Scala in exciting new ways. It seems that Scala users are going to benefit more quickly than most with easy access to the full potential of massively parallel systems.