Loading…
CppCon 2020 has ended
Back To Schedule
Wednesday, September 16 • 14:10 - 14:40
Design Patterns for Handling and Reporting Errors in C++ Programs Using Parallel Algorithms and Executors

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
C++17 already has parallel algorithms.  Executors (P0443, hopefully in C++23) will add asynchronous execution to parallelism.  The usual C++ error handling approach, exceptions, will not work "out of the box."  We need to build up new patterns for error handling.

C++ parallel algorithms and executors have several challenges handling errors.  First, errors can happen nonlocally -- in parallel tasks other than my own -- yet they can affect correctness of an entire parallel algorithm.  Second, notification of errors may be deferred: I may not find out about an error right away.  Third, I may need to take explicit action to find out about an error.  Fourth, checking whether an error has occurred somewhere might have a performance cost.  Finally, letting exceptions propagate across certain boundaries may have unfortunate consequences: the program might crash without respecting destructors and stack unwinding, or it might even "hang" (become unresponsive).

I'm not offering canned solutions to these issues.  However, we don't have to start from scratch: this situation shares much in common with others that have been around for decades.  Examples include non-C++ interfaces to C++ libraries, boundaries between graphical user interface and back-end code, and distributed-memory parallel code.  My experience is mainly with distributed-memory parallel code that uses MPI, the Message Passing Interface that has seen nearly 30 years of continuous use and evolution.  In this talk, I'll show how design patterns already exist for parallel error handling, and I'll apply these design patterns to C++17 parallel algorithms, executors (P0443r13), and parallel algorithms for executors (P1897r3).

Speakers
avatar for Mark Hoemmen

Mark Hoemmen

Scientific software developer, Stellar Science
Mark Hoemmen has a B.S. in mathematics and computer science from the University of Illinois, and a PhD in computer science from the University of California Berkeley. His background is in numerical linear algebra and parallel computing. Mark has 20 years' professional experience as... Read More →


Wednesday September 16, 2020 14:10 - 14:40 MDT
generate_n()
  • Safety/Error Handling