Session-Based Programming for Parallel Algorithms: Expressiveness and Performance

Reading time: 6 minute
...

📝 Original Info

  • Title: Session-Based Programming for Parallel Algorithms: Expressiveness and Performance
  • ArXiv ID: 1002.0933
  • Date: 2010-02-05
  • Authors: Researchers from original ArXiv paper

📝 Abstract

This paper investigates session programming and typing of benchmark examples to compare productivity, safety and performance with other communications programming languages. Parallel algorithms are used to examine the above aspects due to their extensive use of message passing for interaction, and their increasing prominence in algorithmic research with the rising availability of hardware resources such as multicore machines and clusters. We contribute new benchmark results for SJ, an extension of Java for type-safe, binary session programming, against MPJ Express, a Java messaging system based on the MPI standard. In conclusion, we observe that (1) despite rich libraries and functionality, MPI remains a low-level API, and can suffer from commonly perceived disadvantages of explicit message passing such as deadlocks and unexpected message types, and (2) the benefits of high-level session abstraction, which has significant impact on program structure to improve readability and reliability, and session type-safety can greatly facilitate the task of communications programming whilst retaining competitive performance.

💡 Deep Analysis

Deep Dive into Session-Based Programming for Parallel Algorithms: Expressiveness and Performance.

This paper investigates session programming and typing of benchmark examples to compare productivity, safety and performance with other communications programming languages. Parallel algorithms are used to examine the above aspects due to their extensive use of message passing for interaction, and their increasing prominence in algorithmic research with the rising availability of hardware resources such as multicore machines and clusters. We contribute new benchmark results for SJ, an extension of Java for type-safe, binary session programming, against MPJ Express, a Java messaging system based on the MPI standard. In conclusion, we observe that (1) despite rich libraries and functionality, MPI remains a low-level API, and can suffer from commonly perceived disadvantages of explicit message passing such as deadlocks and unexpected message types, and (2) the benefits of high-level session abstraction, which has significant impact on program structure to improve readability and reliabili

📄 Full Content

At PLACES'08, we discussed the need to investigate benchmark examples of session types [10,6] to compare productivity, safety and performance with other communications programming languages. As a starting point into the investigation of these issues, we examine SJ [3], the first full object-oriented language to incorporate session types for type-safe concurrent and distributed programming. The SJ language extends Java with syntax for declaring session types (protocols), and a set of core operations (session initiation, send/receive) and high-level constructs (branching, iteration, recursion) for implementing the interactions that comprise the sessions. The SJ compiler statically verifies session implementations against their declared types. Together with runtime compatibility validation between peers at session initiation, SJ guarantees communication safety in terms of message types and the structure of interaction. SJ has been shown to perform competitively with widely-used communication APIs such as network sockets, in certain cases out-performing RMI [8].

This paper reports our on-going work on implementing parallel algorithms in SJ, with focus on the aforementioned aspects: productivity (including code readability and writability), safety (freedom from type and communication errors [10,6]), and performance (optimisations enabled by SJ, and comparison against other communication systems). Parallel algorithms is a prominent topic in algorithmic research due to the increase of hardware resources such as multicore machines and clusters. The session-based programming methodology and expressiveness of SJ are demonstrated through implementations of: (1) a Monte Carlo approximation of π, (2) the Jacobi solution of the Discrete Poisson Equation, and (3) a simulation of the n-Body problem. These algorithms were selected to evaluate the SJ representation of, amongst other features, typical task and data decomposition patterns [9] (as featured in 1 and 2), a technique for exchanging ghost points [5] (in 2), and an intricate communication pattern over a circular pipeline structure (3). SJ is an evolving framework, and recent extensions to the SJ language [8] (e.g. new multicast output operations and advanced iteration structures) and the SJ Runtime (e.g. improved extensibility through the Abstract Transport) play an important part in the implementation of these algorithms.

Using these programs, which feature complex and representative interaction structures, we contribute new benchmark results for analysis to supplement the existing benchmarks for SJ. In particular, benchmark comparisons between SJ and MPJ Express [1], a reference Java messaging system based on the MPI [4] standard, for (1) and ( 2) yield further promising performance results for SJ. We also show how SJ noalias types can greatly optimise performance, such as for the shared memory communication of the ghost points in (2).

We then compare the SJ implementations of the above algorithms with their MPI counterparts from programming perspectives. Despite rich libraries and functionality, MPI remains a low-level API, and can suffer from such commonly perceived disadvantages of explicit message passing as unexpected message structures and deadlocks due to incorrect protocol implementations. From our experiences implementing the above algorithms, we found high-level session programming to be easier than the basic MPI functions, which often require manipulating numerical process identifiers and array indexes (e.g. for message lengths in (3)) in tricky ways. SJ is able to exploit session types to compensate for, or eliminate, many of the MPI problems: session types themselves are inherently deadlock free, for example.

In conclusion, we observe that high-level session abstraction has significant impact on program structure, improving readability and reliability, and session type-safety can greatly facilitate the task of communications programming whilst retaining competitive performance. We also argue that extending SJ with full multiparty session types would allow richer topologies such as the ring and 2D-mesh to be expressed more naturally, and enable performance improvements through massive parallelism.

A simple Monte Carlo simulation for approximating the value of π is amenable to parallelisation. We use this example to (1) introduce basic and some new SJ constructs; (2) show their use in the description of a simple task decomposition pattern [9]; and (3) demonstrate the effect of parallelisation for performance gain in SJ ( § 5).

A unit square inscribes a circle of area π/4; hence, π = 4t, where t is the ratio of the circle area to the square. t can be determined by selecting a random set of points within the square ((x, y) where x, y ∈ [-1, 1]), and checking how many fall inside the inscribed circle (x 2 + y 2 <= 1). A Master process (or thread) can instruct Workers to independently generate and check multiple sets of points in parallel, calculating

…(Full text truncated)…

📸 Image Gallery

cover.png

Reference

This content is AI-processed based on ArXiv data.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut