Composable, Portable Parallelism using Modern C++ and Threading Building Blocks

Composable, Portable Parallelism using Modern C++ and Threading Building Blocks is a two-day training course with programming exercises taught by Michael Voss and Pablo Reble. It is offered at the Gaylord Rockies from 9AM to 5PM on Saturday and Sunday, September 19th and 20th (immediately following the conference). Lunch is included.

Course Description

Threading Building Blocks (TBB) is a portable, open-source C++ library for threading that has been widely used since 2006. Over the years, the developers of TBB and its users have learned many lessons about implementing composable parallelism in real-world C++ applications, including what practices to use and what mistakes to avoid.

This course will introduce the TBB library and discuss its relationship with modern C++, including the fundamental features introduced in C++11 (std::thread, std::mutex and std::atomic), the parallel execution policies introduced in C++17, the latest features included in C++20, as well as proposed features, like executors.

We will give tips on how to architect applications and libraries to provide composable parallel performance, based on the experiences of the TBB development team and its customer support teams. We will demonstrate these tips with examples using TBB and the parallel algorithms introduced in C++17. This course will mix presentations with hands-on exercises. Course materials will be provided via GitHub.

Prerequisites

  • Knowledge of C++11/14 (including templates)
  • A laptop with macOS, Windows or Linux
  • A C++ compiler supporting C++14 or later
  • git (although students can also download without git)

Course Topics

  1. An introduction to Threading Building Blocks
    1. A brief overview of TBB
      1. Installing and confirming that TBB works on the students’ laptops
    2. The libraries components
      1. The Generic algorithms
      2. The flow graph API
      3. Concurrent containers
      4. Scalable memory allocation
  2. Modern standard C++ parallelism features with TBB
    1. Features that TBB had that have been displaced by standard C++
      1. tbb::thread, tbb::mutex and tbb::atomic
    2. The C++17 parallel algorithms with TBB as an execution engine
      1. Understanding execution policies
      2. seq, par, unseq, par_unseq
    3. TBB’s relationship to upcoming features: co-routines, executors and more.
  3. Composability
    1. What is composability and why is it important
    2. The types of composability (nested, parallel and sequential)
  4. Pitfalls when creating parallel applications and libraries
    1. Tuning for an assume set of resources
    2. Oversubscription
    3. Affinity and locality
    4. Priorities
  5. Techniques for creating composable applications and libraries
    1. Data parallelism
    2. Relaxed sequential semantics
    3. Cache-oblivious algorithms
    4. Work stealing and recursive subdivision
    5. Avoiding oversubscription in nested parallelism
    6. When is it ok to sacrifice composability for performance?

Note: Some of the hands-on exercises will be adapted from Pro TBB: C++ Parallel Programming with Threading Building Blocks

References

Threading Building Blocks

Voss, Michael, Asenjo, Rafael, Reinders, James, Pro TBB: C++ Parallel Programming with Threading Building Blocks, aPress, 2019.  

Examples from Pro TBB: C++ Parallel Programming with Threading Building Blocks

Register Here

Course Instructors

Michael VossMichael Voss is a Principal Engineer in the Intel Architecture, Graphics and Software Group at Intel. He has been a member of the TBB development team since before the 1.0 release in 2006 and was the initial architect of the TBB flow graph API. He was also one of the lead developers of Flow Graph Analyzer, a graphical tool for analyzing data flow applications targeted at both homogeneous and heterogeneous platforms.

He is a co-author of the new book Pro TBB: C++ Parallel Programming with Threading Building Blocks and has over 40 published papers and articles on topics related to parallel programming. He frequently consults with customers across a wide range of domains to help them effectively use the threading libraries provided by Intel. Prior to joining Intel in 2006, he taught in the Edward S. Rogers Department of Electrical and Computer Engineering at the University of Toronto. He received his Ph.D. from the School of Electrical and Computer Engineering at Purdue University in 2001.

Pablo ReblePablo Reble is a Software Engineer in the Intel Architecture, Graphics and Software Group at Intel working on oneAPI and the DPC++ library. He has been working on TBB and related Tools since 2015. Before joining Intel in 2016, he worked as Post-doctoral researcher at RWTH Aachen where he received his PhD in Computer Engineering. He has more than 7 years of experience in teaching parallel programming on undergraduate and graduate level. He has authored over 15 published papers and articles on parallel programming, system software and runtime architectures.