A Domain-Specific Language to Let Groovy Go Parallel

Groovy is an agile dynamic language for the Java Platform. It runs on the JVM (Java Virtual Machine). It supports Domain-Specific Languages (DSLs). Last week, GParallelizer 0.7 release added exciting intuitive ways to handle tasks, actors and message. Great news for the Groovy community in order to go parallel.

I'm going to borrow some paragraphs from Lewis Carroll's "Alice's Adventures in Wonderland", also known as "Alice in Wonderland":

"Chelshire Puss", she began, rather timidly, as she did not at all know whether it would like the name: however, it only grinned a little wider. "Come, it's pleased so far", thought Alice, and she went on. "Would you tell me, please, which way I ought to go from here?"
"That depends a good deal on where you want to get to," said the cat.

If you're working with Groovy or you're planning to move to Groovy, you must take a look at GParallelizer 0.7. If you want to go parallel with Groovy, GParallelizer will help you to find your way. You want to go parallel, don't you?

I'm always testing new tools, libraries, frameworks, languages and DSLs trying to simplify parallel programming and concurrency. I've been testing GParallelizer since its first release. It was in its very early stages. However, the last release offers many interesting improvements.

Groovy offers a dynamic, agile, powerful and modern language to the Java Platform. However, you want to exploit multicore microprocessors and to develop applications that take full advantage of parallel processing capabilities. GParallelizer extends Groovy to provide mechanisms to declare which parts of the code should be performed in parallel.

It offers Groovy developers the possibility to work with Scala-like actors. The good news is that these actors can be both thread-bound and thread-pool bound ones. The thread-pool bound actors feature appeared in GParallelizer 0.6 and allows the creation of event-driven actors. They are really useful to implement complex parallel designs using Groovy + GParallelizer.

Using actor groups and multiple thread pools, you can take full advantage of modern multicore microprocessors. The language extensions are very easy to learn (a few hours are enough) and the possibilities to work with multiple messages and closures with multiple parameters really simplify coding highly parallelized algorithms.

If you want to implement a design with concurrent actors (entities) and using a task-based programming using messages to coordinate concurrent activities, you'll find GParallelizer extensions really helpful.

There are future plans to switch completely to the fork-join framework to implement most of the features instead of trusting in current Java Executors for some of them. Therefore, we will see GParallelizer evolving with both Java and Groovy. However, some features already use JSR-166y (the fork-join framework) like the ParallelArray. It uses the concurrent collections provided by JSR-166y.

In the next months, expect to see new Domain-Specific Languages appearing to simplify parallel programming for many languages. However, you do not have to forget about parallel programming principles and efficient designs in order to take full advantage of these extensions.

For more information, visit GParallelizer Wiki.

Parallel Pattern 5: Stencil
All memory addresses used for reads are expressed as offsets
Distributing Work Across Cores Using .NET
A roll-your-own ThreadPool implementation
Looking For The Lost Packets: Part 2
Looking For The Lost Packets: Part 1

Real World Parallelism Webinar Series
  • February 18, 2010
    Lock Contention, Using Intel Parallel Studio to Improve Performance
    Speaker: Vasanth Tovinkere, Software Engineer, Intel Corporation (Bio)

    Vasanth Tovinkere is a software engineer in the Developer Products Division (DPD) at Intel. His current role involves defining novel approaches to understanding and visualizing parallel performance and consulting with strategic customers to help them prepare and deliver code for the multicore world. Vasanth has been involved in the development of automatic semantic event detectors for digital sports technologies in Intel Labs. He also has been awarded three patents and has two patents pending.

    Abstract:
    Discover how easy it is to use the power of Microsoft Visual Studio and Intel Parallel Studio to find performance issues due to lock contention in threaded applications. This ensures that shipped applications can take better advantage of multicore processors. In this webcast, we provide live demonstrations that show how to identify lock contentions issues with Visual Studio and Intel Parallel Studio, an add-in to Visual Studio that helps developers create fast, reliable code on multicore processors.t.