Brussels / 2 & 3 February 2019


Parallel programming in Go for performance with the Pargo library

Go is an excellent tool for concurrent programming. Goroutines and channels make it easy to coordinate multiple interacting processes. With careful design, good concurrent Go programs run efficiently on multi-core CPUs because multiple goroutines can run in parallel on multiple CPUs.

What is less known is that Go also works very well for expressing parallel algorithms that do not communicate via channels, but access shared memory directly. This goes against Go’s famous slogan: “Do not communicate by sharing memory; instead, share memory by communicating.” However, sometimes performance matters so much that you have to make an exception.

Fortunately, Go is a very powerful language and makes it easy to make such exceptions. In this talk, I am going to walk you through Pargo, an open-source Go library explicitly designed for parallel programming rather than concurrent programming, which is available at This library is based on several years of experience with parallel programming at the ExaScience Lab at imec in Belgium, with many programming languages (C, C++, Java), many parallel programming libraries (Cilk, OpenMP, Intel Threading Building Blocks), and many applications (physics simulations, DNA sequencing, statistics).

Go already provides primitives that help with parallel programming in the sync and sync/atomic packages of its standard library. Pargo builds on top of these primitives and offers high-level functions and data structures for expressing parallel algorithms. This covers simple convenience functions on top of goroutines, efficient parallel maps, parallel sort functions, and a very powerful pipeline concept for efficiently processing large data sets.

This talk will cover the following topics:

  • How Go schedules goroutines, and why they can therefore be used for task-based parallel programming.
  • How Pargo provides a number of parallel programming primitives to make task-based parallel programming easier.
  • How parallel Quicksort and Mergesort can be implemented with Pargo.
  • How Pargo allows you to write parallel pipelines for efficiently streaming, filtering, and transforming large data sets in parallel.

Pascal Costanza has a Ph.D. degree from the University of Bonn, Germany, and works as a senior researcher at imec, Leuven, Belgium. He was previously employed by Intel Corporation, and Vrije Universiteit Brussel, Belgium. He is an expert on high-performance and data-intensive computing with applications in bioinformatics, sequencing pipelines, and artificial intelligence.


Photo of Pascal Costanza Pascal Costanza