Chapter 18. Parallel Mode (original) (raw)

The libstdc++ parallel mode is an experimental parallel implementation of many algorithms of the C++ Standard Library.

Several of the standard algorithms, for instancestd::sort, are made parallel using OpenMP annotations. These parallel mode constructs can be invoked by explicit source declaration or by compiling existing sources with a specific compiler flag.

Note

The parallel mode has not been kept up to date with recent C++ standards and so it only conforms to the C++03 requirements. That means that move-only predicates may not work with parallel mode algorithms, and for C++20 most of the algorithms cannot be used inconstexpr functions.

For C++17 and above there are new overloads of the standard algorithms which take an execution policy argument. You should consider using those instead of the non-standard parallel mode extensions.

Intro

The following library components in the includenumeric are included in the parallel mode:

The following library components in the includealgorithm are included in the parallel mode:

Bibliography

Parallelization of Bulk Operations for STL Dictionaries. Johannes Singler. Leonor Frias. Copyright © 2007 . Workshop on Highly Parallel Processing on a Chip (HPPC) 2007. (LNCS) .

The Multi-Core Standard Template Library. Johannes Singler. Peter Sanders. Felix Putze. Copyright © 2007 . Euro-Par 2007: Parallel Processing. (LNCS 4641) .