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