<?xml version='1.0'?> <?xml-stylesheet type='text/xsl' href='pmathml.xsl'?> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>OpenMP Maximum Thread Number</title> <meta name="description" id="description" content="OpenMP Maximum Thread Number"/> <meta name="keywords" id="keywords" content=" omp_max_thread thread multiple Openmp Cppad "/> <style type='text/css'> body { color : black } body { background-color : white } A:link { color : blue } A:visited { color : purple } A:active { color : purple } </style> <script type='text/javascript' language='JavaScript' src='_omp_max_thread_xml.js'> </script> </head> <body> <table><tr> <td> <a href="http://www.coin-or.org/CppAD/" target="_top"><img border="0" src="_image.gif"/></a> </td> <td><a href="funcheck.cpp.xml" target="_top">Prev</a> </td><td><a href="openmp_run.sh.xml" target="_top">Next</a> </td><td> <select onchange='choose_across0(this)'> <option>Index-></option> <option>contents</option> <option>reference</option> <option>index</option> <option>search</option> <option>external</option> </select> </td> <td> <select onchange='choose_up0(this)'> <option>Up-></option> <option>CppAD</option> <option>ADFun</option> <option>omp_max_thread</option> </select> </td> <td> <select onchange='choose_down2(this)'> <option>CppAD-></option> <option>Install</option> <option>Introduction</option> <option>AD</option> <option>ADFun</option> <option>library</option> <option>Example</option> <option>configure</option> <option>Appendix</option> </select> </td> <td> <select onchange='choose_down1(this)'> <option>ADFun-></option> <option>Independent</option> <option>FunConstruct</option> <option>Dependent</option> <option>abort_recording</option> <option>seq_property</option> <option>FunEval</option> <option>Drivers</option> <option>FunCheck</option> <option>omp_max_thread</option> <option>optimize</option> <option>FunDeprecated</option> </select> </td> <td> <select onchange='choose_down0(this)'> <option>omp_max_thread-></option> <option>openmp_run.sh</option> </select> </td> <td> <select onchange='choose_current0(this)'> <option>Headings-></option> <option>Syntax</option> <option>Purpose</option> <option>number</option> <option>Independent</option> <option>Restriction</option> <option>Example and Tests</option> </select> </td> </tr></table><br/> <center><b><big><big>OpenMP Maximum Thread Number</big></big></b></center> <br/> <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b> <br/> <code><font color="blue"><span style='white-space: nowrap'>AD<</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>>::omp_max_thread(</span></font></code><i><span style='white-space: nowrap'>number</span></i><code><font color="blue"><span style='white-space: nowrap'>)<br/> </span></font></code><br/> <b><big><a name="Purpose" id="Purpose">Purpose</a></big></b> <br/> By default, for each <code><font color="blue"><span style='white-space: nowrap'>AD<</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>></span></font></code> class there is only one tape that records <a href="glossary.xml#AD of Base" target="_top"><span style='white-space: nowrap'>AD of Base</span></a> operations. This tape is a global variable and hence it cannot be used by multiple OpenMP threads at the same time. The <code><font color="blue">omp_max_thread</font></code> function is used to set the maximum number of OpenMP threads that can be active. In this case, there is a different tape corresponding to each <code><font color="blue"><span style='white-space: nowrap'>AD<</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>></span></font></code> class and thread pair. <br/> <br/> <b><big><a name="number" id="number">number</a></big></b> <br/> The argument <i>number</i> has prototype <code><font color="blue"><span style='white-space: nowrap'><br/>      size_t </span></font></code><i><span style='white-space: nowrap'>number</span></i><code><font color="blue"><span style='white-space: nowrap'><br/> </span></font></code>It must be greater than zero and specifies the maximum number of OpenMp threads that will be active at one time. <br/> <br/> <b><big><a name="Independent" id="Independent">Independent</a></big></b> <br/> Each call to <a href="independent.xml" target="_top"><span style='white-space: nowrap'>Independent(x)</span></a> creates a new <a href="glossary.xml#Tape.Active" target="_top"><span style='white-space: nowrap'>active</span></a> tape. All of the operations with the corresponding variables must be preformed by the same OpenMP thread. This includes the corresponding call to <a href="dependent.xml" target="_top"><span style='white-space: nowrap'>f.Dependent(x,y)</span></a> or the <a href="funconstruct.xml#Sequence Constructor" target="_top"><span style='white-space: nowrap'>ADFun f(x, y)</span></a> during which the tape stops recording and the variables become parameters. <br/> <br/> <b><big><a name="Restriction" id="Restriction">Restriction</a></big></b> <br/> No tapes can be <a href="glossary.xml#Tape.Active" target="_top"><span style='white-space: nowrap'>active</span></a> when this function is called. <br/> <br/> <b><big><a name="Example and Tests" id="Example and Tests">Example and Tests</a></big></b> <br/> The shell script <a href="openmp_run.sh.xml" target="_top"><span style='white-space: nowrap'>openmp_run.sh</span></a> can be used to compile and run the OpenMP examples and tests. <hr/>Input File: cppad/local/omp_max_thread.hpp </body> </html>