<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>libstdc++: settings.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(initResizable); /* @license-end */</script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">libstdc++ </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('a00959.html','');}); /* @license-end */ </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> | <a href="#namespaces">Namespaces</a> | <a href="#define-members">Macros</a> </div> <div class="headertitle"> <div class="title">settings.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p><a href="a00959_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Classes</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="a09632.html">__gnu_parallel::_Settings</a></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a> Namespaces</h2></td></tr> <tr class="memitem:a01572"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="a01572.html">__gnu_parallel</a></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> Macros</h2></td></tr> <tr class="memitem:ad816e8f52b933c9300598977cada7d18"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00959.html#ad816e8f52b933c9300598977cada7d18">_GLIBCXX_PARALLEL_CONDITION</a>(__c)</td></tr> <tr class="separator:ad816e8f52b933c9300598977cada7d18"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Runtime settings and tuning parameters, heuristics to decide whether to use parallelized algorithms. This file is a GNU parallel extension to the Standard C++ Library. </p> <h1><a class="anchor" id="parallelization_decision"></a> parallelization_decision</h1> <p>The decision whether to run an algorithm in parallel.</p> <p>There are several ways the user can switch on and __off the parallel execution of an algorithm, both at compile- and run-time.</p> <p>Only sequential execution can be forced at compile-time. This reduces code size and protects code parts that have non-thread-safe side effects.</p> <p>Ultimately, forcing parallel execution at compile-time makes sense. Often, the sequential algorithm implementation is used as a subroutine, so no reduction in code size can be achieved. Also, the machine the program is run on might have only one processor core, so to avoid overhead, the algorithm is executed sequentially.</p> <p>To force sequential execution of an algorithm ultimately at compile-time, the user must add the tag gnu_parallel::sequential_tag() to the end of the parameter list, e. g.</p> <div class="fragment"><div class="line"><a class="code" href="a01482.html#gae3c0067ae83db1824367ded659a960b2">std::sort</a>(__v.begin(), __v.end(), <a class="code" href="a09636.html">__gnu_parallel::sequential_tag</a>());</div></div><!-- fragment --><p>This is compatible with all overloaded algorithm variants. No additional code will be instantiated, at all. The same holds for most algorithm calls with iterators not providing random access.</p> <p>If the algorithm call is not forced to be executed sequentially at compile-time, the decision is made at run-time. The global variable __gnu_parallel::_Settings::algorithm_strategy is checked. _It is a tristate variable corresponding to:</p> <p>a. force_sequential, meaning the sequential algorithm is executed. b. force_parallel, meaning the parallel algorithm is executed. c. heuristic</p> <p>For heuristic, the parallel algorithm implementation is called only if the input size is sufficiently large. For most algorithms, the input size is the (combined) length of the input sequence(__s). The threshold can be set by the user, individually for each algorithm. The according variables are called gnu_parallel::_Settings::[algorithm]_minimal_n .</p> <p>For some of the algorithms, there are even more tuning options, e. g. the ability to choose from multiple algorithm variants. See below for details. </p> <p class="definition">Definition in file <a class="el" href="a00959_source.html">settings.h</a>.</p> </div><h2 class="groupheader">Macro Definition Documentation</h2> <a id="ad816e8f52b933c9300598977cada7d18"></a> <h2 class="memtitle"><span class="permalink"><a href="#ad816e8f52b933c9300598977cada7d18">◆ </a></span>_GLIBCXX_PARALLEL_CONDITION</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define _GLIBCXX_PARALLEL_CONDITION</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">__c</td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Determine at compile(?)-time if the parallel variant of an algorithm should be called. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">__c</td><td>A condition that is convertible to bool that is overruled by __gnu_parallel::_Settings::algorithm_strategy. Usually a decision based on the input size. </td></tr> </table> </dd> </dl> <p class="definition">Definition at line <a class="el" href="a00959_source.html#l00095">95</a> of file <a class="el" href="a00959_source.html">settings.h</a>.</p> </div> </div> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="dir_e0ca5f9b79afec9781b100dc0e5c7504.html">include</a></li><li class="navelem"><a class="el" href="dir_d2331c0d6b7f7f8ed85dc9efb934eb07.html">parallel</a></li><li class="navelem"><a class="el" href="a00959.html">settings.h</a></li> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li> </ul> </div> </body> </html>