148fb7bfaSmrg<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" 248fb7bfaSmrg xml:id="manual.ext.parallel_mode" xreflabel="Parallel Mode"> 34fee23f9Smrg<?dbhtml filename="parallel_mode.html"?> 44fee23f9Smrg 548fb7bfaSmrg<info><title>Parallel Mode</title> 64fee23f9Smrg <keywordset> 748fb7bfaSmrg <keyword>C++</keyword> 848fb7bfaSmrg <keyword>library</keyword> 948fb7bfaSmrg <keyword>parallel</keyword> 104fee23f9Smrg </keywordset> 1148fb7bfaSmrg</info> 124fee23f9Smrg 1348fb7bfaSmrg 144fee23f9Smrg 154fee23f9Smrg<para> The libstdc++ parallel mode is an experimental parallel 16*fb8a8121Smrgimplementation of many algorithms of the C++ Standard Library. 174fee23f9Smrg</para> 184fee23f9Smrg 194fee23f9Smrg<para> 204fee23f9SmrgSeveral of the standard algorithms, for instance 214fee23f9Smrg<function>std::sort</function>, are made parallel using OpenMP 22*fb8a8121Smrgannotations. These parallel mode constructs can be invoked by 234fee23f9Smrgexplicit source declaration or by compiling existing sources with a 244fee23f9Smrgspecific compiler flag. 254fee23f9Smrg</para> 264fee23f9Smrg 27*fb8a8121Smrg<note> 28*fb8a8121Smrg <para> 29*fb8a8121Smrg The parallel mode has not been kept up to date with recent C++ standards 30*fb8a8121Smrg and so it only conforms to the C++03 requirements. 31*fb8a8121Smrg That means that move-only predicates may not work with parallel mode 32*fb8a8121Smrg algorithms, and for C++20 most of the algorithms cannot be used in 33*fb8a8121Smrg <code>constexpr</code> functions. 34*fb8a8121Smrg </para> 35*fb8a8121Smrg <para> 36*fb8a8121Smrg For C++17 and above there are new overloads of the standard algorithms 37*fb8a8121Smrg which take an execution policy argument. You should consider using those 38*fb8a8121Smrg instead of the non-standard parallel mode extensions. 39*fb8a8121Smrg </para> 40*fb8a8121Smrg</note> 414fee23f9Smrg 4248fb7bfaSmrg<section xml:id="manual.ext.parallel_mode.intro" xreflabel="Intro"><info><title>Intro</title></info> 4348fb7bfaSmrg 444fee23f9Smrg 454fee23f9Smrg<para>The following library components in the include 464fee23f9Smrg<filename class="headerfile">numeric</filename> are included in the parallel mode:</para> 474fee23f9Smrg<itemizedlist> 484fee23f9Smrg <listitem><para><function>std::accumulate</function></para></listitem> 494fee23f9Smrg <listitem><para><function>std::adjacent_difference</function></para></listitem> 504fee23f9Smrg <listitem><para><function>std::inner_product</function></para></listitem> 514fee23f9Smrg <listitem><para><function>std::partial_sum</function></para></listitem> 524fee23f9Smrg</itemizedlist> 534fee23f9Smrg 544fee23f9Smrg<para>The following library components in the include 554fee23f9Smrg<filename class="headerfile">algorithm</filename> are included in the parallel mode:</para> 564fee23f9Smrg<itemizedlist> 574fee23f9Smrg <listitem><para><function>std::adjacent_find</function></para></listitem> 584fee23f9Smrg <listitem><para><function>std::count</function></para></listitem> 594fee23f9Smrg <listitem><para><function>std::count_if</function></para></listitem> 604fee23f9Smrg <listitem><para><function>std::equal</function></para></listitem> 614fee23f9Smrg <listitem><para><function>std::find</function></para></listitem> 624fee23f9Smrg <listitem><para><function>std::find_if</function></para></listitem> 634fee23f9Smrg <listitem><para><function>std::find_first_of</function></para></listitem> 644fee23f9Smrg <listitem><para><function>std::for_each</function></para></listitem> 654fee23f9Smrg <listitem><para><function>std::generate</function></para></listitem> 664fee23f9Smrg <listitem><para><function>std::generate_n</function></para></listitem> 674fee23f9Smrg <listitem><para><function>std::lexicographical_compare</function></para></listitem> 684fee23f9Smrg <listitem><para><function>std::mismatch</function></para></listitem> 694fee23f9Smrg <listitem><para><function>std::search</function></para></listitem> 704fee23f9Smrg <listitem><para><function>std::search_n</function></para></listitem> 714fee23f9Smrg <listitem><para><function>std::transform</function></para></listitem> 724fee23f9Smrg <listitem><para><function>std::replace</function></para></listitem> 734fee23f9Smrg <listitem><para><function>std::replace_if</function></para></listitem> 744fee23f9Smrg <listitem><para><function>std::max_element</function></para></listitem> 754fee23f9Smrg <listitem><para><function>std::merge</function></para></listitem> 764fee23f9Smrg <listitem><para><function>std::min_element</function></para></listitem> 774fee23f9Smrg <listitem><para><function>std::nth_element</function></para></listitem> 784fee23f9Smrg <listitem><para><function>std::partial_sort</function></para></listitem> 794fee23f9Smrg <listitem><para><function>std::partition</function></para></listitem> 804fee23f9Smrg <listitem><para><function>std::random_shuffle</function></para></listitem> 814fee23f9Smrg <listitem><para><function>std::set_union</function></para></listitem> 824fee23f9Smrg <listitem><para><function>std::set_intersection</function></para></listitem> 834fee23f9Smrg <listitem><para><function>std::set_symmetric_difference</function></para></listitem> 844fee23f9Smrg <listitem><para><function>std::set_difference</function></para></listitem> 854fee23f9Smrg <listitem><para><function>std::sort</function></para></listitem> 864fee23f9Smrg <listitem><para><function>std::stable_sort</function></para></listitem> 874fee23f9Smrg <listitem><para><function>std::unique_copy</function></para></listitem> 884fee23f9Smrg</itemizedlist> 894fee23f9Smrg 9048fb7bfaSmrg</section> 914fee23f9Smrg 9248fb7bfaSmrg<section xml:id="manual.ext.parallel_mode.semantics" xreflabel="Semantics"><info><title>Semantics</title></info> 9348fb7bfaSmrg<?dbhtml filename="parallel_mode_semantics.html"?> 9448fb7bfaSmrg 954fee23f9Smrg 964fee23f9Smrg<para> The parallel mode STL algorithms are currently not exception-safe, 974fee23f9Smrgi.e. user-defined functors must not throw exceptions. 984fee23f9SmrgAlso, the order of execution is not guaranteed for some functions, of course. 994fee23f9SmrgTherefore, user-defined functors should not have any concurrent side effects. 1004fee23f9Smrg</para> 1014fee23f9Smrg 1024fee23f9Smrg<para> Since the current GCC OpenMP implementation does not support 1034fee23f9SmrgOpenMP parallel regions in concurrent threads, 1044fee23f9Smrgit is not possible to call parallel STL algorithm in 1054fee23f9Smrgconcurrent threads, either. 1064fee23f9SmrgIt might work with other compilers, though.</para> 1074fee23f9Smrg 10848fb7bfaSmrg</section> 1094fee23f9Smrg 11048fb7bfaSmrg<section xml:id="manual.ext.parallel_mode.using" xreflabel="Using"><info><title>Using</title></info> 11148fb7bfaSmrg<?dbhtml filename="parallel_mode_using.html"?> 1124fee23f9Smrg 11348fb7bfaSmrg 11448fb7bfaSmrg<section xml:id="parallel_mode.using.prereq_flags"><info><title>Prerequisite Compiler Flags</title></info> 11548fb7bfaSmrg 1164fee23f9Smrg 1174fee23f9Smrg<para> 1184fee23f9Smrg Any use of parallel functionality requires additional compiler 1194fee23f9Smrg and runtime support, in particular support for OpenMP. Adding this support is 1204fee23f9Smrg not difficult: just compile your application with the compiler 1214fee23f9Smrg flag <literal>-fopenmp</literal>. This will link 12248fb7bfaSmrg in <code>libgomp</code>, the 1234d5abbe8Smrg <link xmlns:xlink="http://www.w3.org/1999/xlink" 1244d5abbe8Smrg xlink:href="http://gcc.gnu.org/onlinedocs/libgomp/">GNU Offloading and 1254d5abbe8Smrg Multi Processing Runtime Library</link>, 1264fee23f9Smrg whose presence is mandatory. 1274fee23f9Smrg</para> 1284fee23f9Smrg 1294fee23f9Smrg<para> 1304fee23f9SmrgIn addition, hardware that supports atomic operations and a compiler 1314fee23f9Smrg capable of producing atomic operations is mandatory: GCC defaults to no 1324fee23f9Smrg support for atomic operations on some common hardware 1334fee23f9Smrg architectures. Activating atomic operations may require explicit 1344fee23f9Smrg compiler flags on some targets (like sparc and x86), such 1354fee23f9Smrg as <literal>-march=i686</literal>, 1364fee23f9Smrg <literal>-march=native</literal> or <literal>-mcpu=v9</literal>. See 1374fee23f9Smrg the GCC manual for more information. 1384fee23f9Smrg</para> 1394fee23f9Smrg 14048fb7bfaSmrg</section> 1414fee23f9Smrg 14248fb7bfaSmrg<section xml:id="parallel_mode.using.parallel_mode"><info><title>Using Parallel Mode</title></info> 14348fb7bfaSmrg 1444fee23f9Smrg 1454fee23f9Smrg<para> 1464fee23f9Smrg To use the libstdc++ parallel mode, compile your application with 1474fee23f9Smrg the prerequisite flags as detailed above, and in addition 1484fee23f9Smrg add <constant>-D_GLIBCXX_PARALLEL</constant>. This will convert all 1494fee23f9Smrg use of the standard (sequential) algorithms to the appropriate parallel 1504fee23f9Smrg equivalents. Please note that this doesn't necessarily mean that 1514fee23f9Smrg everything will end up being executed in a parallel manner, but 1524fee23f9Smrg rather that the heuristics and settings coded into the parallel 1534fee23f9Smrg versions will be used to determine if all, some, or no algorithms 1544fee23f9Smrg will be executed using parallel variants. 1554fee23f9Smrg</para> 1564fee23f9Smrg 1574fee23f9Smrg<para>Note that the <constant>_GLIBCXX_PARALLEL</constant> define may change the 1584fee23f9Smrg sizes and behavior of standard class templates such as 1594fee23f9Smrg <function>std::search</function>, and therefore one can only link code 1604fee23f9Smrg compiled with parallel mode and code compiled without parallel mode 1614fee23f9Smrg if no instantiation of a container is passed between the two 1624fee23f9Smrg translation units. Parallel mode functionality has distinct linkage, 1634fee23f9Smrg and cannot be confused with normal mode symbols. 1644fee23f9Smrg</para> 16548fb7bfaSmrg</section> 1664fee23f9Smrg 16748fb7bfaSmrg<section xml:id="parallel_mode.using.specific"><info><title>Using Specific Parallel Components</title></info> 16848fb7bfaSmrg 1694fee23f9Smrg 1704fee23f9Smrg<para>When it is not feasible to recompile your entire application, or 1714fee23f9Smrg only specific algorithms need to be parallel-aware, individual 1724fee23f9Smrg parallel algorithms can be made available explicitly. These 1734fee23f9Smrg parallel algorithms are functionally equivalent to the standard 1744fee23f9Smrg drop-in algorithms used in parallel mode, but they are available in 1754fee23f9Smrg a separate namespace as GNU extensions and may be used in programs 1764fee23f9Smrg compiled with either release mode or with parallel mode. 1774fee23f9Smrg</para> 1784fee23f9Smrg 1794fee23f9Smrg 1804fee23f9Smrg<para>An example of using a parallel version 1814fee23f9Smrgof <function>std::sort</function>, but no other parallel algorithms, is: 1824fee23f9Smrg</para> 1834fee23f9Smrg 1844fee23f9Smrg<programlisting> 1854fee23f9Smrg#include <vector> 1864fee23f9Smrg#include <parallel/algorithm> 1874fee23f9Smrg 1884fee23f9Smrgint main() 1894fee23f9Smrg{ 1904fee23f9Smrg std::vector<int> v(100); 1914fee23f9Smrg 1924fee23f9Smrg // ... 1934fee23f9Smrg 1944fee23f9Smrg // Explicitly force a call to parallel sort. 1954fee23f9Smrg __gnu_parallel::sort(v.begin(), v.end()); 1964fee23f9Smrg return 0; 1974fee23f9Smrg} 1984fee23f9Smrg</programlisting> 1994fee23f9Smrg 2004fee23f9Smrg<para> 2014fee23f9SmrgThen compile this code with the prerequisite compiler flags 2024fee23f9Smrg(<literal>-fopenmp</literal> and any necessary architecture-specific 2034fee23f9Smrgflags for atomic operations.) 2044fee23f9Smrg</para> 2054fee23f9Smrg 2064fee23f9Smrg<para> The following table provides the names and headers of all the 2074fee23f9Smrg parallel algorithms that can be used in a similar manner: 2084fee23f9Smrg</para> 2094fee23f9Smrg 2104d5abbe8Smrg<table frame="all" xml:id="table.parallel_algos"> 2114fee23f9Smrg<title>Parallel Algorithms</title> 21248fb7bfaSmrg 21348fb7bfaSmrg<tgroup cols="4" align="left" colsep="1" rowsep="1"> 21448fb7bfaSmrg<colspec colname="c1"/> 21548fb7bfaSmrg<colspec colname="c2"/> 21648fb7bfaSmrg<colspec colname="c3"/> 21748fb7bfaSmrg<colspec colname="c4"/> 2184fee23f9Smrg 2194fee23f9Smrg<thead> 2204fee23f9Smrg <row> 2214fee23f9Smrg <entry>Algorithm</entry> 2224fee23f9Smrg <entry>Header</entry> 2234fee23f9Smrg <entry>Parallel algorithm</entry> 2244fee23f9Smrg <entry>Parallel header</entry> 2254fee23f9Smrg </row> 2264fee23f9Smrg</thead> 2274fee23f9Smrg 2284fee23f9Smrg<tbody> 2294fee23f9Smrg <row> 2304fee23f9Smrg <entry><function>std::accumulate</function></entry> 2314fee23f9Smrg <entry><filename class="headerfile">numeric</filename></entry> 2324fee23f9Smrg <entry><function>__gnu_parallel::accumulate</function></entry> 2334fee23f9Smrg <entry><filename class="headerfile">parallel/numeric</filename></entry> 2344fee23f9Smrg </row> 2354fee23f9Smrg <row> 2364fee23f9Smrg <entry><function>std::adjacent_difference</function></entry> 2374fee23f9Smrg <entry><filename class="headerfile">numeric</filename></entry> 2384fee23f9Smrg <entry><function>__gnu_parallel::adjacent_difference</function></entry> 2394fee23f9Smrg <entry><filename class="headerfile">parallel/numeric</filename></entry> 2404fee23f9Smrg </row> 2414fee23f9Smrg <row> 2424fee23f9Smrg <entry><function>std::inner_product</function></entry> 2434fee23f9Smrg <entry><filename class="headerfile">numeric</filename></entry> 2444fee23f9Smrg <entry><function>__gnu_parallel::inner_product</function></entry> 2454fee23f9Smrg <entry><filename class="headerfile">parallel/numeric</filename></entry> 2464fee23f9Smrg </row> 2474fee23f9Smrg <row> 2484fee23f9Smrg <entry><function>std::partial_sum</function></entry> 2494fee23f9Smrg <entry><filename class="headerfile">numeric</filename></entry> 2504fee23f9Smrg <entry><function>__gnu_parallel::partial_sum</function></entry> 2514fee23f9Smrg <entry><filename class="headerfile">parallel/numeric</filename></entry> 2524fee23f9Smrg </row> 2534fee23f9Smrg <row> 2544fee23f9Smrg <entry><function>std::adjacent_find</function></entry> 2554fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 2564fee23f9Smrg <entry><function>__gnu_parallel::adjacent_find</function></entry> 2574fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 2584fee23f9Smrg </row> 2594fee23f9Smrg 2604fee23f9Smrg <row> 2614fee23f9Smrg <entry><function>std::count</function></entry> 2624fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 2634fee23f9Smrg <entry><function>__gnu_parallel::count</function></entry> 2644fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 2654fee23f9Smrg </row> 2664fee23f9Smrg 2674fee23f9Smrg <row> 2684fee23f9Smrg <entry><function>std::count_if</function></entry> 2694fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 2704fee23f9Smrg <entry><function>__gnu_parallel::count_if</function></entry> 2714fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 2724fee23f9Smrg </row> 2734fee23f9Smrg 2744fee23f9Smrg <row> 2754fee23f9Smrg <entry><function>std::equal</function></entry> 2764fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 2774fee23f9Smrg <entry><function>__gnu_parallel::equal</function></entry> 2784fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 2794fee23f9Smrg </row> 2804fee23f9Smrg 2814fee23f9Smrg <row> 2824fee23f9Smrg <entry><function>std::find</function></entry> 2834fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 2844fee23f9Smrg <entry><function>__gnu_parallel::find</function></entry> 2854fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 2864fee23f9Smrg </row> 2874fee23f9Smrg 2884fee23f9Smrg <row> 2894fee23f9Smrg <entry><function>std::find_if</function></entry> 2904fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 2914fee23f9Smrg <entry><function>__gnu_parallel::find_if</function></entry> 2924fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 2934fee23f9Smrg </row> 2944fee23f9Smrg 2954fee23f9Smrg <row> 2964fee23f9Smrg <entry><function>std::find_first_of</function></entry> 2974fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 2984fee23f9Smrg <entry><function>__gnu_parallel::find_first_of</function></entry> 2994fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3004fee23f9Smrg </row> 3014fee23f9Smrg 3024fee23f9Smrg <row> 3034fee23f9Smrg <entry><function>std::for_each</function></entry> 3044fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3054fee23f9Smrg <entry><function>__gnu_parallel::for_each</function></entry> 3064fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3074fee23f9Smrg </row> 3084fee23f9Smrg 3094fee23f9Smrg <row> 3104fee23f9Smrg <entry><function>std::generate</function></entry> 3114fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3124fee23f9Smrg <entry><function>__gnu_parallel::generate</function></entry> 3134fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3144fee23f9Smrg </row> 3154fee23f9Smrg 3164fee23f9Smrg <row> 3174fee23f9Smrg <entry><function>std::generate_n</function></entry> 3184fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3194fee23f9Smrg <entry><function>__gnu_parallel::generate_n</function></entry> 3204fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3214fee23f9Smrg </row> 3224fee23f9Smrg 3234fee23f9Smrg <row> 3244fee23f9Smrg <entry><function>std::lexicographical_compare</function></entry> 3254fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3264fee23f9Smrg <entry><function>__gnu_parallel::lexicographical_compare</function></entry> 3274fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3284fee23f9Smrg </row> 3294fee23f9Smrg 3304fee23f9Smrg <row> 3314fee23f9Smrg <entry><function>std::mismatch</function></entry> 3324fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3334fee23f9Smrg <entry><function>__gnu_parallel::mismatch</function></entry> 3344fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3354fee23f9Smrg </row> 3364fee23f9Smrg 3374fee23f9Smrg <row> 3384fee23f9Smrg <entry><function>std::search</function></entry> 3394fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3404fee23f9Smrg <entry><function>__gnu_parallel::search</function></entry> 3414fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3424fee23f9Smrg </row> 3434fee23f9Smrg 3444fee23f9Smrg <row> 3454fee23f9Smrg <entry><function>std::search_n</function></entry> 3464fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3474fee23f9Smrg <entry><function>__gnu_parallel::search_n</function></entry> 3484fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3494fee23f9Smrg </row> 3504fee23f9Smrg 3514fee23f9Smrg <row> 3524fee23f9Smrg <entry><function>std::transform</function></entry> 3534fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3544fee23f9Smrg <entry><function>__gnu_parallel::transform</function></entry> 3554fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3564fee23f9Smrg </row> 3574fee23f9Smrg 3584fee23f9Smrg <row> 3594fee23f9Smrg <entry><function>std::replace</function></entry> 3604fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3614fee23f9Smrg <entry><function>__gnu_parallel::replace</function></entry> 3624fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3634fee23f9Smrg </row> 3644fee23f9Smrg 3654fee23f9Smrg <row> 3664fee23f9Smrg <entry><function>std::replace_if</function></entry> 3674fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3684fee23f9Smrg <entry><function>__gnu_parallel::replace_if</function></entry> 3694fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3704fee23f9Smrg </row> 3714fee23f9Smrg 3724fee23f9Smrg <row> 3734fee23f9Smrg <entry><function>std::max_element</function></entry> 3744fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3754fee23f9Smrg <entry><function>__gnu_parallel::max_element</function></entry> 3764fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3774fee23f9Smrg </row> 3784fee23f9Smrg 3794fee23f9Smrg <row> 3804fee23f9Smrg <entry><function>std::merge</function></entry> 3814fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3824fee23f9Smrg <entry><function>__gnu_parallel::merge</function></entry> 3834fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3844fee23f9Smrg </row> 3854fee23f9Smrg 3864fee23f9Smrg <row> 3874fee23f9Smrg <entry><function>std::min_element</function></entry> 3884fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3894fee23f9Smrg <entry><function>__gnu_parallel::min_element</function></entry> 3904fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3914fee23f9Smrg </row> 3924fee23f9Smrg 3934fee23f9Smrg <row> 3944fee23f9Smrg <entry><function>std::nth_element</function></entry> 3954fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 3964fee23f9Smrg <entry><function>__gnu_parallel::nth_element</function></entry> 3974fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 3984fee23f9Smrg </row> 3994fee23f9Smrg 4004fee23f9Smrg <row> 4014fee23f9Smrg <entry><function>std::partial_sort</function></entry> 4024fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 4034fee23f9Smrg <entry><function>__gnu_parallel::partial_sort</function></entry> 4044fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 4054fee23f9Smrg </row> 4064fee23f9Smrg 4074fee23f9Smrg <row> 4084fee23f9Smrg <entry><function>std::partition</function></entry> 4094fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 4104fee23f9Smrg <entry><function>__gnu_parallel::partition</function></entry> 4114fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 4124fee23f9Smrg </row> 4134fee23f9Smrg 4144fee23f9Smrg <row> 4154fee23f9Smrg <entry><function>std::random_shuffle</function></entry> 4164fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 4174fee23f9Smrg <entry><function>__gnu_parallel::random_shuffle</function></entry> 4184fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 4194fee23f9Smrg </row> 4204fee23f9Smrg 4214fee23f9Smrg <row> 4224fee23f9Smrg <entry><function>std::set_union</function></entry> 4234fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 4244fee23f9Smrg <entry><function>__gnu_parallel::set_union</function></entry> 4254fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 4264fee23f9Smrg </row> 4274fee23f9Smrg 4284fee23f9Smrg <row> 4294fee23f9Smrg <entry><function>std::set_intersection</function></entry> 4304fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 4314fee23f9Smrg <entry><function>__gnu_parallel::set_intersection</function></entry> 4324fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 4334fee23f9Smrg </row> 4344fee23f9Smrg 4354fee23f9Smrg <row> 4364fee23f9Smrg <entry><function>std::set_symmetric_difference</function></entry> 4374fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 4384fee23f9Smrg <entry><function>__gnu_parallel::set_symmetric_difference</function></entry> 4394fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 4404fee23f9Smrg </row> 4414fee23f9Smrg 4424fee23f9Smrg <row> 4434fee23f9Smrg <entry><function>std::set_difference</function></entry> 4444fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 4454fee23f9Smrg <entry><function>__gnu_parallel::set_difference</function></entry> 4464fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 4474fee23f9Smrg </row> 4484fee23f9Smrg 4494fee23f9Smrg <row> 4504fee23f9Smrg <entry><function>std::sort</function></entry> 4514fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 4524fee23f9Smrg <entry><function>__gnu_parallel::sort</function></entry> 4534fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 4544fee23f9Smrg </row> 4554fee23f9Smrg 4564fee23f9Smrg <row> 4574fee23f9Smrg <entry><function>std::stable_sort</function></entry> 4584fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 4594fee23f9Smrg <entry><function>__gnu_parallel::stable_sort</function></entry> 4604fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 4614fee23f9Smrg </row> 4624fee23f9Smrg 4634fee23f9Smrg <row> 4644fee23f9Smrg <entry><function>std::unique_copy</function></entry> 4654fee23f9Smrg <entry><filename class="headerfile">algorithm</filename></entry> 4664fee23f9Smrg <entry><function>__gnu_parallel::unique_copy</function></entry> 4674fee23f9Smrg <entry><filename class="headerfile">parallel/algorithm</filename></entry> 4684fee23f9Smrg </row> 4694fee23f9Smrg</tbody> 4704fee23f9Smrg</tgroup> 4714fee23f9Smrg</table> 4724fee23f9Smrg 47348fb7bfaSmrg</section> 4744fee23f9Smrg 47548fb7bfaSmrg</section> 4764fee23f9Smrg 47748fb7bfaSmrg<section xml:id="manual.ext.parallel_mode.design" xreflabel="Design"><info><title>Design</title></info> 47848fb7bfaSmrg<?dbhtml filename="parallel_mode_design.html"?> 47948fb7bfaSmrg 4804fee23f9Smrg <para> 4814fee23f9Smrg </para> 48248fb7bfaSmrg<section xml:id="parallel_mode.design.intro" xreflabel="Intro"><info><title>Interface Basics</title></info> 48348fb7bfaSmrg 4844fee23f9Smrg 4854fee23f9Smrg<para> 4864fee23f9SmrgAll parallel algorithms are intended to have signatures that are 4874fee23f9Smrgequivalent to the ISO C++ algorithms replaced. For instance, the 4884fee23f9Smrg<function>std::adjacent_find</function> function is declared as: 4894fee23f9Smrg</para> 4904fee23f9Smrg<programlisting> 4914fee23f9Smrgnamespace std 4924fee23f9Smrg{ 4934fee23f9Smrg template<typename _FIter> 4944fee23f9Smrg _FIter 4954fee23f9Smrg adjacent_find(_FIter, _FIter); 4964fee23f9Smrg} 4974fee23f9Smrg</programlisting> 4984fee23f9Smrg 4994fee23f9Smrg<para> 5004fee23f9SmrgWhich means that there should be something equivalent for the parallel 5014fee23f9Smrgversion. Indeed, this is the case: 5024fee23f9Smrg</para> 5034fee23f9Smrg 5044fee23f9Smrg<programlisting> 5054fee23f9Smrgnamespace std 5064fee23f9Smrg{ 5074fee23f9Smrg namespace __parallel 5084fee23f9Smrg { 5094fee23f9Smrg template<typename _FIter> 5104fee23f9Smrg _FIter 5114fee23f9Smrg adjacent_find(_FIter, _FIter); 5124fee23f9Smrg 5134fee23f9Smrg ... 5144fee23f9Smrg } 5154fee23f9Smrg} 5164fee23f9Smrg</programlisting> 5174fee23f9Smrg 5184fee23f9Smrg<para>But.... why the ellipses? 5194fee23f9Smrg</para> 5204fee23f9Smrg 5214fee23f9Smrg<para> The ellipses in the example above represent additional overloads 5224fee23f9Smrgrequired for the parallel version of the function. These additional 5234fee23f9Smrgoverloads are used to dispatch calls from the ISO C++ function 5244fee23f9Smrgsignature to the appropriate parallel function (or sequential 5254fee23f9Smrgfunction, if no parallel functions are deemed worthy), based on either 5264fee23f9Smrgcompile-time or run-time conditions. 5274fee23f9Smrg</para> 5284fee23f9Smrg 5294fee23f9Smrg<para> The available signature options are specific for the different 5304fee23f9Smrgalgorithms/algorithm classes.</para> 5314fee23f9Smrg 5324fee23f9Smrg<para> The general view of overloads for the parallel algorithms look like this: 5334fee23f9Smrg</para> 5344fee23f9Smrg<itemizedlist> 5354fee23f9Smrg <listitem><para>ISO C++ signature</para></listitem> 5364fee23f9Smrg <listitem><para>ISO C++ signature + sequential_tag argument</para></listitem> 5374fee23f9Smrg <listitem><para>ISO C++ signature + algorithm-specific tag type 5384fee23f9Smrg (several signatures)</para></listitem> 5394fee23f9Smrg</itemizedlist> 5404fee23f9Smrg 5414fee23f9Smrg<para> Please note that the implementation may use additional functions 5424fee23f9Smrg(designated with the <code>_switch</code> suffix) to dispatch from the 5434fee23f9SmrgISO C++ signature to the correct parallel version. Also, some of the 5444fee23f9Smrgalgorithms do not have support for run-time conditions, so the last 5454fee23f9Smrgoverload is therefore missing. 5464fee23f9Smrg</para> 5474fee23f9Smrg 5484fee23f9Smrg 54948fb7bfaSmrg</section> 5504fee23f9Smrg 55148fb7bfaSmrg<section xml:id="parallel_mode.design.tuning" xreflabel="Tuning"><info><title>Configuration and Tuning</title></info> 5524fee23f9Smrg 5534fee23f9Smrg 55448fb7bfaSmrg 55548fb7bfaSmrg<section xml:id="parallel_mode.design.tuning.omp" xreflabel="OpenMP Environment"><info><title>Setting up the OpenMP Environment</title></info> 55648fb7bfaSmrg 5574fee23f9Smrg 5584fee23f9Smrg<para> 5594fee23f9SmrgSeveral aspects of the overall runtime environment can be manipulated 5604fee23f9Smrgby standard OpenMP function calls. 5614fee23f9Smrg</para> 5624fee23f9Smrg 5634fee23f9Smrg<para> 5644fee23f9SmrgTo specify the number of threads to be used for the algorithms globally, 5654fee23f9Smrguse the function <function>omp_set_num_threads</function>. An example: 5664fee23f9Smrg</para> 5674fee23f9Smrg 5684fee23f9Smrg<programlisting> 5694fee23f9Smrg#include <stdlib.h> 5704fee23f9Smrg#include <omp.h> 5714fee23f9Smrg 5724fee23f9Smrgint main() 5734fee23f9Smrg{ 5744fee23f9Smrg // Explicitly set number of threads. 5754fee23f9Smrg const int threads_wanted = 20; 5764fee23f9Smrg omp_set_dynamic(false); 5774fee23f9Smrg omp_set_num_threads(threads_wanted); 5784fee23f9Smrg 5794fee23f9Smrg // Call parallel mode algorithms. 5804fee23f9Smrg 5814fee23f9Smrg return 0; 5824fee23f9Smrg} 5834fee23f9Smrg</programlisting> 5844fee23f9Smrg 5854fee23f9Smrg<para> 5864fee23f9Smrg Some algorithms allow the number of threads being set for a particular call, 5874fee23f9Smrg by augmenting the algorithm variant. 5884fee23f9Smrg See the next section for further information. 5894fee23f9Smrg</para> 5904fee23f9Smrg 5914fee23f9Smrg<para> 5924fee23f9SmrgOther parts of the runtime environment able to be manipulated include 5934fee23f9Smrgnested parallelism (<function>omp_set_nested</function>), schedule kind 5944fee23f9Smrg(<function>omp_set_schedule</function>), and others. See the OpenMP 5954fee23f9Smrgdocumentation for more information. 5964fee23f9Smrg</para> 5974fee23f9Smrg 59848fb7bfaSmrg</section> 5994fee23f9Smrg 60048fb7bfaSmrg<section xml:id="parallel_mode.design.tuning.compile" xreflabel="Compile Switches"><info><title>Compile Time Switches</title></info> 60148fb7bfaSmrg 6024fee23f9Smrg 6034fee23f9Smrg<para> 6044fee23f9SmrgTo force an algorithm to execute sequentially, even though parallelism 6054fee23f9Smrgis switched on in general via the macro <constant>_GLIBCXX_PARALLEL</constant>, 6064fee23f9Smrgadd <classname>__gnu_parallel::sequential_tag()</classname> to the end 6074fee23f9Smrgof the algorithm's argument list. 6084fee23f9Smrg</para> 6094fee23f9Smrg 6104fee23f9Smrg<para> 6114fee23f9SmrgLike so: 6124fee23f9Smrg</para> 6134fee23f9Smrg 6144fee23f9Smrg<programlisting> 6154fee23f9Smrgstd::sort(v.begin(), v.end(), __gnu_parallel::sequential_tag()); 6164fee23f9Smrg</programlisting> 6174fee23f9Smrg 6184fee23f9Smrg<para> 6194fee23f9SmrgSome parallel algorithm variants can be excluded from compilation by 6204fee23f9Smrgpreprocessor defines. See the doxygen documentation on 6214fee23f9Smrg<code>compiletime_settings.h</code> and <code>features.h</code> for details. 6224fee23f9Smrg</para> 6234fee23f9Smrg 6244fee23f9Smrg<para> 6254fee23f9SmrgFor some algorithms, the desired variant can be chosen at compile-time by 6264fee23f9Smrgappending a tag object. The available options are specific to the particular 6274fee23f9Smrgalgorithm (class). 6284fee23f9Smrg</para> 6294fee23f9Smrg 6304fee23f9Smrg<para> 6314fee23f9SmrgFor the "embarrassingly parallel" algorithms, there is only one "tag object 6324fee23f9Smrgtype", the enum _Parallelism. 6334fee23f9SmrgIt takes one of the following values, 6344fee23f9Smrg<code>__gnu_parallel::parallel_tag</code>, 6354fee23f9Smrg<code>__gnu_parallel::balanced_tag</code>, 6364fee23f9Smrg<code>__gnu_parallel::unbalanced_tag</code>, 6374fee23f9Smrg<code>__gnu_parallel::omp_loop_tag</code>, 6384fee23f9Smrg<code>__gnu_parallel::omp_loop_static_tag</code>. 6394fee23f9SmrgThis means that the actual parallelization strategy is chosen at run-time. 6404fee23f9Smrg(Choosing the variants at compile-time will come soon.) 6414fee23f9Smrg</para> 6424fee23f9Smrg 6434fee23f9Smrg<para> 6444fee23f9SmrgFor the following algorithms in general, we have 6454fee23f9Smrg<code>__gnu_parallel::parallel_tag</code> and 6464fee23f9Smrg<code>__gnu_parallel::default_parallel_tag</code>, in addition to 6474fee23f9Smrg<code>__gnu_parallel::sequential_tag</code>. 6484fee23f9Smrg<code>__gnu_parallel::default_parallel_tag</code> chooses the default 6494fee23f9Smrgalgorithm at compiletime, as does omitting the tag. 6504fee23f9Smrg<code>__gnu_parallel::parallel_tag</code> postpones the decision to runtime 6514fee23f9Smrg(see next section). 6524fee23f9SmrgFor all tags, the number of threads desired for this call can optionally be 6534fee23f9Smrgpassed to the respective tag's constructor. 6544fee23f9Smrg</para> 6554fee23f9Smrg 6564fee23f9Smrg<para> 6574fee23f9SmrgThe <code>multiway_merge</code> algorithm comes with the additional choices, 6584fee23f9Smrg<code>__gnu_parallel::exact_tag</code> and 6594fee23f9Smrg<code>__gnu_parallel::sampling_tag</code>. 6604fee23f9SmrgExact and sampling are the two available splitting strategies. 6614fee23f9Smrg</para> 6624fee23f9Smrg 6634fee23f9Smrg<para> 6644fee23f9SmrgFor the <code>sort</code> and <code>stable_sort</code> algorithms, there are 6654fee23f9Smrgseveral additional choices, namely 6664fee23f9Smrg<code>__gnu_parallel::multiway_mergesort_tag</code>, 6674fee23f9Smrg<code>__gnu_parallel::multiway_mergesort_exact_tag</code>, 6684fee23f9Smrg<code>__gnu_parallel::multiway_mergesort_sampling_tag</code>, 6694fee23f9Smrg<code>__gnu_parallel::quicksort_tag</code>, and 6704fee23f9Smrg<code>__gnu_parallel::balanced_quicksort_tag</code>. 6714fee23f9SmrgMultiway mergesort comes with the two splitting strategies for multi-way 6724fee23f9Smrgmerging. The quicksort options cannot be used for <code>stable_sort</code>. 6734fee23f9Smrg</para> 6744fee23f9Smrg 67548fb7bfaSmrg</section> 6764fee23f9Smrg 67748fb7bfaSmrg<section xml:id="parallel_mode.design.tuning.settings" xreflabel="_Settings"><info><title>Run Time Settings and Defaults</title></info> 67848fb7bfaSmrg 6794fee23f9Smrg 6804fee23f9Smrg<para> 6814fee23f9SmrgThe default parallelization strategy, the choice of specific algorithm 6824fee23f9Smrgstrategy, the minimum threshold limits for individual parallel 6834fee23f9Smrgalgorithms, and aspects of the underlying hardware can be specified as 6844fee23f9Smrgdesired via manipulation 6854fee23f9Smrgof <classname>__gnu_parallel::_Settings</classname> member data. 6864fee23f9Smrg</para> 6874fee23f9Smrg 6884fee23f9Smrg<para> 6894fee23f9SmrgFirst off, the choice of parallelization strategy: serial, parallel, 6904fee23f9Smrgor heuristically deduced. This corresponds 6914fee23f9Smrgto <code>__gnu_parallel::_Settings::algorithm_strategy</code> and is a 6924fee23f9Smrgvalue of enum <type>__gnu_parallel::_AlgorithmStrategy</type> 6934fee23f9Smrgtype. Choices 6944fee23f9Smrginclude: <type>heuristic</type>, <type>force_sequential</type>, 6954fee23f9Smrgand <type>force_parallel</type>. The default is <type>heuristic</type>. 6964fee23f9Smrg</para> 6974fee23f9Smrg 6984fee23f9Smrg 6994fee23f9Smrg<para> 7004fee23f9SmrgNext, the sub-choices for algorithm variant, if not fixed at compile-time. 7014fee23f9SmrgSpecific algorithms like <function>find</function> or <function>sort</function> 7024fee23f9Smrgcan be implemented in multiple ways: when this is the case, 7034fee23f9Smrga <classname>__gnu_parallel::_Settings</classname> member exists to 7044fee23f9Smrgpick the default strategy. For 7054fee23f9Smrgexample, <code>__gnu_parallel::_Settings::sort_algorithm</code> can 7064fee23f9Smrghave any values of 7074fee23f9Smrgenum <type>__gnu_parallel::_SortAlgorithm</type>: <type>MWMS</type>, <type>QS</type>, 7084fee23f9Smrgor <type>QS_BALANCED</type>. 7094fee23f9Smrg</para> 7104fee23f9Smrg 7114fee23f9Smrg<para> 7124fee23f9SmrgLikewise for setting the minimal threshold for algorithm 7134fee23f9Smrgparallelization. Parallelism always incurs some overhead. Thus, it is 7144fee23f9Smrgnot helpful to parallelize operations on very small sets of 7154fee23f9Smrgdata. Because of this, measures are taken to avoid parallelizing below 7164fee23f9Smrga certain, pre-determined threshold. For each algorithm, a minimum 7174fee23f9Smrgproblem size is encoded as a variable in the 7184fee23f9Smrgactive <classname>__gnu_parallel::_Settings</classname> object. This 7194fee23f9Smrgthreshold variable follows the following naming scheme: 7204fee23f9Smrg<code>__gnu_parallel::_Settings::[algorithm]_minimal_n</code>. So, 7214fee23f9Smrgfor <function>fill</function>, the threshold variable 7224fee23f9Smrgis <code>__gnu_parallel::_Settings::fill_minimal_n</code>, 7234fee23f9Smrg</para> 7244fee23f9Smrg 7254fee23f9Smrg<para> 7264fee23f9SmrgFinally, hardware details like L1/L2 cache size can be hardwired 7274fee23f9Smrgvia <code>__gnu_parallel::_Settings::L1_cache_size</code> and friends. 7284fee23f9Smrg</para> 7294fee23f9Smrg 7304fee23f9Smrg<para> 7314fee23f9Smrg</para> 7324fee23f9Smrg 7334fee23f9Smrg<para> 7344fee23f9SmrgAll these configuration variables can be changed by the user, if 7354fee23f9Smrgdesired. 7364fee23f9SmrgThere exists one global instance of the class <classname>_Settings</classname>, 7374fee23f9Smrgi. e. it is a singleton. It can be read and written by calling 7384fee23f9Smrg<code>__gnu_parallel::_Settings::get</code> and 7394fee23f9Smrg<code>__gnu_parallel::_Settings::set</code>, respectively. 7404fee23f9SmrgPlease note that the first call return a const object, so direct manipulation 7414fee23f9Smrgis forbidden. 742181254a7SmrgSee <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/index.html"> 743181254a7Smrg <filename class="headerfile"><parallel/settings.h></filename></link> 7444fee23f9Smrgfor complete details. 7454fee23f9Smrg</para> 7464fee23f9Smrg 7474fee23f9Smrg<para> 7484fee23f9SmrgA small example of tuning the default: 7494fee23f9Smrg</para> 7504fee23f9Smrg 7514fee23f9Smrg<programlisting> 7524fee23f9Smrg#include <parallel/algorithm> 7534fee23f9Smrg#include <parallel/settings.h> 7544fee23f9Smrg 7554fee23f9Smrgint main() 7564fee23f9Smrg{ 7574fee23f9Smrg __gnu_parallel::_Settings s; 7584fee23f9Smrg s.algorithm_strategy = __gnu_parallel::force_parallel; 7594fee23f9Smrg __gnu_parallel::_Settings::set(s); 7604fee23f9Smrg 7614fee23f9Smrg // Do work... all algorithms will be parallelized, always. 7624fee23f9Smrg 7634fee23f9Smrg return 0; 7644fee23f9Smrg} 7654fee23f9Smrg</programlisting> 7664fee23f9Smrg 76748fb7bfaSmrg</section> 7684fee23f9Smrg 76948fb7bfaSmrg</section> 7704fee23f9Smrg 77148fb7bfaSmrg<section xml:id="parallel_mode.design.impl" xreflabel="Impl"><info><title>Implementation Namespaces</title></info> 77248fb7bfaSmrg 7734fee23f9Smrg 7744fee23f9Smrg<para> One namespace contain versions of code that are always 7754fee23f9Smrgexplicitly sequential: 7764fee23f9Smrg<code>__gnu_serial</code>. 7774fee23f9Smrg</para> 7784fee23f9Smrg 7794fee23f9Smrg<para> Two namespaces contain the parallel mode: 7804fee23f9Smrg<code>std::__parallel</code> and <code>__gnu_parallel</code>. 7814fee23f9Smrg</para> 7824fee23f9Smrg 7834fee23f9Smrg<para> Parallel implementations of standard components, including 7844fee23f9Smrgtemplate helpers to select parallelism, are defined in <code>namespace 7854fee23f9Smrgstd::__parallel</code>. For instance, <function>std::transform</function> from <filename class="headerfile">algorithm</filename> has a parallel counterpart in 7864fee23f9Smrg<function>std::__parallel::transform</function> from <filename class="headerfile">parallel/algorithm</filename>. In addition, these parallel 7874fee23f9Smrgimplementations are injected into <code>namespace 7884fee23f9Smrg__gnu_parallel</code> with using declarations. 7894fee23f9Smrg</para> 7904fee23f9Smrg 7914fee23f9Smrg<para> Support and general infrastructure is in <code>namespace 7924fee23f9Smrg__gnu_parallel</code>. 7934fee23f9Smrg</para> 7944fee23f9Smrg 7954fee23f9Smrg<para> More information, and an organized index of types and functions 7964fee23f9Smrgrelated to the parallel mode on a per-namespace basis, can be found in 7974fee23f9Smrgthe generated source documentation. 7984fee23f9Smrg</para> 7994fee23f9Smrg 80048fb7bfaSmrg</section> 8014fee23f9Smrg 80248fb7bfaSmrg</section> 8034fee23f9Smrg 80448fb7bfaSmrg<section xml:id="manual.ext.parallel_mode.test" xreflabel="Testing"><info><title>Testing</title></info> 80548fb7bfaSmrg<?dbhtml filename="parallel_mode_test.html"?> 80648fb7bfaSmrg 8074fee23f9Smrg 8084fee23f9Smrg <para> 8094fee23f9Smrg Both the normal conformance and regression tests and the 8104fee23f9Smrg supplemental performance tests work. 8114fee23f9Smrg </para> 8124fee23f9Smrg 8134fee23f9Smrg <para> 8144fee23f9Smrg To run the conformance and regression tests with the parallel mode 8154fee23f9Smrg active, 8164fee23f9Smrg </para> 8174fee23f9Smrg 8184fee23f9Smrg <screen> 8194fee23f9Smrg <userinput>make check-parallel</userinput> 8204fee23f9Smrg </screen> 8214fee23f9Smrg 8224fee23f9Smrg <para> 8234fee23f9Smrg The log and summary files for conformance testing are in the 8244fee23f9Smrg <filename class="directory">testsuite/parallel</filename> directory. 8254fee23f9Smrg </para> 8264fee23f9Smrg 8274fee23f9Smrg <para> 8284fee23f9Smrg To run the performance tests with the parallel mode active, 8294fee23f9Smrg </para> 8304fee23f9Smrg 8314fee23f9Smrg <screen> 8324fee23f9Smrg <userinput>make check-performance-parallel</userinput> 8334fee23f9Smrg </screen> 8344fee23f9Smrg 8354fee23f9Smrg <para> 8364fee23f9Smrg The result file for performance testing are in the 8374fee23f9Smrg <filename class="directory">testsuite</filename> directory, in the file 8384fee23f9Smrg <filename>libstdc++_performance.sum</filename>. In addition, the 8394fee23f9Smrg policy-based containers have their own visualizations, which have 8404fee23f9Smrg additional software dependencies than the usual bare-boned text 8414fee23f9Smrg file, and can be generated by using the <code>make 8424fee23f9Smrg doc-performance</code> rule in the testsuite's Makefile. 8434fee23f9Smrg</para> 84448fb7bfaSmrg</section> 8454fee23f9Smrg 84648fb7bfaSmrg<bibliography xml:id="parallel_mode.biblio"><info><title>Bibliography</title></info> 84748fb7bfaSmrg 8484fee23f9Smrg 8494fee23f9Smrg <biblioentry> 85048fb7bfaSmrg <citetitle> 8514fee23f9Smrg Parallelization of Bulk Operations for STL Dictionaries 85248fb7bfaSmrg </citetitle> 8534fee23f9Smrg 85448fb7bfaSmrg <author><personname><firstname>Johannes</firstname><surname>Singler</surname></personname></author> 85548fb7bfaSmrg <author><personname><firstname>Leonor</firstname><surname>Frias</surname></personname></author> 8564fee23f9Smrg 8574fee23f9Smrg <copyright> 8584fee23f9Smrg <year>2007</year> 85948fb7bfaSmrg <holder/> 8604fee23f9Smrg </copyright> 8614fee23f9Smrg 8624fee23f9Smrg <publisher> 8634fee23f9Smrg <publishername> 8644fee23f9Smrg Workshop on Highly Parallel Processing on a Chip (HPPC) 2007. (LNCS) 8654fee23f9Smrg </publishername> 8664fee23f9Smrg </publisher> 8674fee23f9Smrg </biblioentry> 8684fee23f9Smrg 8694fee23f9Smrg <biblioentry> 87048fb7bfaSmrg <citetitle> 8714fee23f9Smrg The Multi-Core Standard Template Library 87248fb7bfaSmrg </citetitle> 8734fee23f9Smrg 87448fb7bfaSmrg <author><personname><firstname>Johannes</firstname><surname>Singler</surname></personname></author> 87548fb7bfaSmrg <author><personname><firstname>Peter</firstname><surname>Sanders</surname></personname></author> 87648fb7bfaSmrg <author><personname><firstname>Felix</firstname><surname>Putze</surname></personname></author> 8774fee23f9Smrg 8784fee23f9Smrg <copyright> 8794fee23f9Smrg <year>2007</year> 88048fb7bfaSmrg <holder/> 8814fee23f9Smrg </copyright> 8824fee23f9Smrg 8834fee23f9Smrg <publisher> 8844fee23f9Smrg <publishername> 8854fee23f9Smrg Euro-Par 2007: Parallel Processing. (LNCS 4641) 8864fee23f9Smrg </publishername> 8874fee23f9Smrg </publisher> 8884fee23f9Smrg </biblioentry> 8894fee23f9Smrg 8904fee23f9Smrg</bibliography> 8914fee23f9Smrg 8924fee23f9Smrg</chapter> 893