Parallelism

March 2018 ISO C++ Meeting Trip Report (SG1: Concurrency and Parallelism)

March 2018 ISO C++ Meeting Trip Report (SG1: Concurrency and Parallelism)

This year’s Winter ISO C++ Standard Committee meeting was held in March in Jacksonville, Florida. A number of larger features, for which there is substantial interest but which are also difficult to get right, were discussed:

  • Concepts, along with Concept types from the Ranges TS; see P0898 and n4685
  • Modules; see n4689
  • Coroutines; see n4723
  • Networking; see n4711
  • Executors; see p0443

Jason Merrill’s recently published trip report covers the core language topics. This report focuses on the topics of interest to the Concurrency and Parallelism Study Group (SG1).  The “big ticket” items discussed in SG1 during the week were:

Continue reading “March 2018 ISO C++ Meeting Trip Report (SG1: Concurrency and Parallelism)”

Share

Red Hat at the ISO C++ Standards Meeting (June 2016, Oulu): Parallelism and Concurrency

Several Red Hat engineers recently attended the JTC1/SC22/WG21 C++ Standards Committee meetings in Oulu, Finland.  This post focuses on the sessions of SG1 (the standards committee sub-group 1 – for concurrency and parallelism) as well as on coroutines-related sessions. Jason already gave an overview of the meeting in his post.

SG1 prioritized proposals and issues affecting the (expected) C++17 standard, followed by proposals targeting the Concurrency TS or a future revision of the Parallelism TS.  We also made some progress in the space of coroutines.

Continue reading “Red Hat at the ISO C++ Standards Meeting (June 2016, Oulu): Parallelism and Concurrency”

Share

Red Hat at the ISO C++ Standards Meeting (March 2016): Parallelism, Concurrency, and Coroutines

Several Red Hat engineers recently attended the JTC1/SC22/WG21 C++ Standards Committee meetings in March 2016 in Jacksonville, Florida, USA.  This post focuses on the sessions of SG1 (the standards committee sub-group 1 – for concurrency and parallelism) and on several proposals related to coroutines.

The biggest news from a parallelism and concurrency (P&C) perspective is that the Parallelism Technical Specification v1 was voted into the working draft of the standard.

This means that C++17 will offer support for several parallel algorithms, provided that the standard is approved in the remaining stages of the ISO voting process. If approved, this will make utilizing parallelism easier for many users – e.g., a parallel “for-each” loop, as a simple example.

Several proposals for support of vector execution are also progressing, and I believe that they might be ready before version 2 of the Parallelism Technical Specification is published.

Continue reading “Red Hat at the ISO C++ Standards Meeting (March 2016): Parallelism, Concurrency, and Coroutines”

Share
Red Hat at the ISO C++ Standards Meeting (May 2015): Parallelism and Concurrency

Red Hat at the ISO C++ Standards Meeting (May 2015): Parallelism and Concurrency

gnu logoSeveral Red Hat engineers attended the JTC1/SC22/WG21 C++ Standards Committee meetings in May 2015 at Lenexa, Kansas, USA.  This post focuses on the sessions of SG1, the study group on parallelism and concurrency.

Finishing the Technical Specifications (TSes) was one major point on the agenda of SG1. The Parallelism TS (see this draft) and the Transactional Memory TS (see this draft) have been finalized for publication, and the Concurrency TS and has been made ready for a vote and feedback by the National Bodies. GCC does not yet support those TSes but already has the main functionality required by the Transactional Memory TS through implementing a previous specification of the language constructs for transactions. SG1 is continuing to adding features in those areas, but these will target a version 2 of each of these TSes.

Continue reading “Red Hat at the ISO C++ Standards Meeting (May 2015): Parallelism and Concurrency”

Share
Red Hat at the ISO C++ Standards Meeting (Nov 2014): Parallelism and Concurrency

Red Hat at the ISO C++ Standards Meeting (Nov 2014): Parallelism and Concurrency

gnu logoSeveral Red Hat engineers attended the JTC1/SC22/WG21 C++ Standards Committee meetings in November 2014 at Urbana-Champaign, IL, USA.  This post focuses on the sessions of SG1, the study group on parallelism and concurrency, which met for the whole week to discuss proposals and work on the technical specifications (TS) for both parallelism and concurrency.

SG1 mostly worked on finalizing the first revision of the Parallelism TS, and continued working on accepting proposals into the Concurrency TS. The Transactional Memory proposal is also making progress on becoming a TS.

Continue reading “Red Hat at the ISO C++ Standards Meeting (Nov 2014): Parallelism and Concurrency”

Share

Intelⓡ Threading Building Blocks in Red Hat Enterprise Linux 7

That the “free lunch is over” may have become something of a cliche in the IT industry, but the fact is that lately, the increase in cycles per second has been mostly realized by adding more processing units rather than by other techniques. While multiprocessor mainframes and supercomputers existed essentially since the dawn of computing, this may be the first time ever that the only machines without multicore processors may be those in USB fridges and electric toothbrushes.

parallel curves evolvent
Involute of a circle – parallel curves.

This changes the way that even ordinary programs need to be written. The parallelism inherent in the computation can no longer be extracted automatically from the instruction stream, but the programmer herself needs to make it explicit.

To that end, there were historically several approaches.

Continue reading “Intelⓡ Threading Building Blocks in Red Hat Enterprise Linux 7”

Share

Red Hat at the ISO C++ Standards Meeting (June 2014): Parallelism and Concurrency

Recently Red Hat sent several representatives to the JTC1/SC22/WG21 C++ Standards Committee meetings, which were held in June 2014 at the University of Applied Sciences in Rapperswil, Switzerland.

As in past ISO C++ meetings, SG1, the study group on parallelism and concurrency, met for the whole week to discuss proposals and work on the technical specifications (TS) for both parallelism and concurrency.

Continue reading “Red Hat at the ISO C++ Standards Meeting (June 2014): Parallelism and Concurrency”

Share

C/C++ Programming Abstractions for Parallelism and Concurrency – Part 2

Welcome to part 2 of this two-part article on C/C++ Programming Abstractions for Parallelism and Concurrency.  If you missed Part 1, view it here.

Supporting task-based parallelism

Let us now switch from concurrency to parallelism. I already mentioned that C++11 and C11 provide support for creating threads that execute additional work in parallel or concurrently. However, these facilities are rather resource abstractions (i.e., for operating system threads) than abstractions aimed purely at parallelism. One target for the latter is often task-based parallelism, which allows programmers to split a part of a program into tasks (i.e., units of work). These tasks will run in parallel, but they can also depend on other tasks in which case a dependent task will not start executing until all it’s dependencies are fulfilled (e.g., until a prior task has finished generating output that constitutes input for the current task). This essentially creates a directed acyclic graph (DAG) of tasks; tasks that are not ordered in the DAG wrt. each other can execute in parallel.

So, how can programmers express that they want to run a parallel task? When managing threads explicitly using the thread abstractions (explicit threading for short), this may look like this:

try {
  auto task = std::thread(work); // Execute the work() function
  // ... Do something else ...
  task.join();
  // ... Use the task's result ...
}
catch (std::system_error e) { error_fallback(); }

We explicitly create a new thread and join the thread (i.e., wait for it to complete its work) at task dependencies. We need error handling and a fallback in case we cannot create another thread for some reason.

Continue reading “C/C++ Programming Abstractions for Parallelism and Concurrency – Part 2”

Share

C/C++ Programming Abstractions for Parallelism and Concurrency – Part 1

When writing parallel or multi-threaded programs, programmers have to deal with parallelism and concurrency. Both are related concepts but are not the same. In this article, we will review the differences between them and outline a few programming abstractions for both (in particular, atomic data types, Transactional Memory, and task-based parallelism). Red Hat Developer Toolset 1.1 ships with GCC-4.7, which provides (experimental) support for these particular features. Finally, a short outlook on future features proposed for inclusion in the C/C++ standards and considered for upstream GCC.

Concurrent execution refers to situations in which several (logical) processes or threads execute at the same time and are not guaranteed to be independent; for example, they could communicate with each other, wait for other threads to make progress, or could have to execute operations mutually exclusive with the execution of other threads’ operations. In contrast, parallel execution refers to several processes performing independent operations that, informally, do not have to consider what the other parallel parts are doing.

Nonetheless, parallelism is related to concurrency in that a typical parallel program will also contain concurrent pieces of code (e.g., to merge the results of parallel computations into a single output value). Also, to benefit from parallelism in hardware, concurrent code often tries to execute as much as possible in parallel (see Amdahl’s Law).

Continue reading “C/C++ Programming Abstractions for Parallelism and Concurrency – Part 1”

Share