The joys and perils of concurrent algorithm design

By Juan Julián Merelo Guervós

Elevator Pitch

Raku offers high-level primitives for concurrent programming. I have been using them to design, program and test evolutionary algorithms for some time. I’ll talk about what makes Raku an excellent language for this kind of thing, from its design features to the tools included with Comma.

Description

New languages like Go and Raku include high-level primitives that allow you to implement algorithms, with relative ease and take advantage of the full capabilities of today’s multi-core multi-threading desktop (and laptop) architectures. Luckily, most of the times there’s an straightforward path from sequential to concurrent implementation. But it pays to use the more roundabout way of going from a sequential algorithm to a new (and native) concurrent algorithm, and then go from that to the concurrent implementation. In this talk, a new version of the one I gave in PerlCon Riga, I will describe the path to concurrency we followed with evolutionary algorithms, how Comma’s implementation of a concurrency monitor has helped, and how using it all paid off in terms of performance and also in terms of insight of the algorithm insight.

At the end of the day, the question is: Can Raku be used for science? It certainly can, and the many facilities it offers in its toolchain make it easier to develop and implement high-level algoritms, monitor and improve them. As the single thing that will benefit working with concurrent algorithms is the concurrency monitor included in Comma, but the fact that we can work with high-level primitives also makes it accessible to entry-level algorithms designers.

Notes

I have been working in evolutionary algorithms for quite a long time. I’ve always used Perl for auxiliary stuff, and started using it for the algorithms themselves some 20 years ago; however, they were mainly plain vanilla algorithms. I went that path with Raku initially, publishing a module called Algorithm::Evolutionary::Simple, but eventually realized how easy was to implement concurrent algorithms with that. I learned how to use concurrency with Raku, and at the same time designed new algorithms using this concurrency.