Chris Brown is a Senior Research Fellow at the University of St Andrews working in the area of Refactoring and Parallelism. Chris received his Ph.D. from the University of Kent in 2008 under the supervision of Simon Thompson, where he worked on the implementation of the HaRe refactoring tool for Haskell. Chris now works towards building radically new refactoring techniques and methodologies to exploit parallel skeleton and pattern applications in both the functional and imperative domains. Chris has published at major conferences in the field of functional programming, refactoring and parallelism.
This paper considers how to use program shaping and algorithmic skele- tons to parallelise a multi-agent system that is written in Erlang. Program shaping is the process of transforming a program to better enable the introduction of paral- lelism. Whilst algorithmic skeletons abstract away the low-level aspects of parallel programming that often plague traditional techniques, it is not always easy to intro- duce them into an arbitrary program, especially one that has not been written with parallelism in mind. Amongst other issues, data may not always be in a compatible format, function calls may need to be replicated to support alternative uses, side- effects may need to be isolated, or there may be dependencies between functions and data that obstruct the introduction of parallelism. Program shaping can be used to transform such code to a form that allows skeletons to be more easily introduced. In this paper, we present a series of generic program shaping rewrite rules, provide their implementation as refactorings, and show how they can used to parallelise an Evolutionary Multi-Agent System (MAS) written in Erlang. We show that we can significantly speed up this application, obtaining super-linear speedups of over 70× the original sequential performance on a 64-core shared-memory machine.Slides