Filter

Parallel Programming in C++

In this course we use Microsoft PPL (Parallel Patterns Library) for providing us with this high level abstraction and investigate how we can use PPL for implementing concurrent algorithms with high performance. We learn when to use concurrent programming and how to spot and fix concurrency issues, both for correctness and performance.

Writing programs that execute concurrently is hard, and one key factor for pulling off this feat successfully is to have the right abstractions. The days when we had to manage our threads manually are mostly gone and instead we use tasks and other abstraction so we can focus on the heart of our concurrent algorithms without polluting our code with lots of synchronization.

Finally we take a look at CPU hardware and see how we can use parallelism on multiple levels (Vectorization, Instruction Level Parallelism, Multiple Cores, Clusters) and how design principles apply regarding memory layout and task splitting.

  • C++

Target audience

Experienced C++ Developers.

Prerequisites

Knowledge of multi-threaded programming using threads.

What you will learn

  • How to avoid common optimization pitfalls. 
  • When to benefit from parallelism. 
  • How the underlying hardware contributes to parallelism. 
  • How to take advantage of multiple cores with C++ and Microsoft PPL. 
  • How to avoid common parallel pitfalls.
  • How to debug parallel programs.

Agenda

Day 1

  • Introduction to Concurrency
  • C++11 Refresher
  • Computer Architecture
    • CPU and Memory Architecture
    • Instruction level parallelism
    • Memory Caching (NUMA)
    • Cost of shared writes
  • Identifying algorithms that are parallelizable
    • Computation bound
    • Memory bound
    • IO bound
  • Parallel patterns and algorithms
    • Map
    • Reduce
    • Scan
    • Pack
  • Introduction to PPL
    • Why tasks instead of threads?
    • Runtime support
    • Primitives
    • Parallel for loops
    • non-determinism
  • Synchronization in PPL
    • Critical Sections
    • Reader/Writer locks
    • Events
    • Cost of synchronization
  • Visual Studio Debug Tools for Concurrency
    • Concurrency Visualizer
    • Parallel Stacks
    • Parallel Tasks
    • Parallel Watch
    • Identifying anti-patterns
    • Debugging PPL Algorithms
    • Event Tracing
  • Exception Handling
    • Catching task::get/task::wait
    • Exceptions inside parallel_for vs for-loops
  • Alternatives to PPL
    • pthreads
    • Intel TBB
    • Boost Thread
    • STL Threads
  • SIMD and Vector programming
    • Masking and execution coherence
    • Memory Layout
    • Auto vectorization

Course info

Course code: T391
Duration: 1 day
Price: 16 500 SEK
Language: English

Course schedule

Stockholm
20 MayBook now
16 DecBook now
Gothenburg
13 MayBook now
Malmö

Teachers

Share

Related courses

  • C++ for Experienced Developers

    Category: C++
    Duration: 3 days
    Price: 25 900 SEK
  • GPGPU Computing in C++ with CUDA

    Category: C++
    Duration: 2 days
    Price: 24 500 SEK

Contact us for details

+46 40 61 70 720
info@edument.se


All prices excluding VAT