<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>OpenMP Parallel Setup</title>
<meta name="description" id="description" content="OpenMP Parallel Setup"/>
<meta name="keywords" id="keywords" content=" depreciated omp_max_thread "/>
<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="fundeprecated.xml" target="_top">Prev</a>
</td><td><a href="tracknewdel.xml" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-&gt;</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-&gt;</option>
<option>CppAD</option>
<option>Appendix</option>
<option>deprecated</option>
<option>omp_max_thread</option>
</select>
</td>
<td>
<select onchange='choose_down3(this)'>
<option>CppAD-&gt;</option>
<option>Install</option>
<option>Introduction</option>
<option>AD</option>
<option>ADFun</option>
<option>preprocessor</option>
<option>multi_thread</option>
<option>library</option>
<option>ipopt_solve</option>
<option>Example</option>
<option>speed</option>
<option>Appendix</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>Appendix-&gt;</option>
<option>Faq</option>
<option>Theory</option>
<option>glossary</option>
<option>Bib</option>
<option>Bugs</option>
<option>WishList</option>
<option>whats_new</option>
<option>deprecated</option>
<option>compare_c</option>
<option>License</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>deprecated-&gt;</option>
<option>include_deprecated</option>
<option>FunDeprecated</option>
<option>omp_max_thread</option>
<option>TrackNewDel</option>
<option>omp_alloc</option>
<option>memory_leak</option>
<option>epsilon</option>
<option>test_vector</option>
<option>cppad_ipopt_nlp</option>
<option>old_atomic</option>
</select>
</td>
<td>omp_max_thread</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Deprecated</option>
<option>Syntax</option>
<option>Purpose</option>
<option>number</option>
<option>Independent</option>
<option>Restriction</option>
</select>
</td>
</tr></table><br/>



<center><b><big><big>OpenMP Parallel Setup</big></big></b></center>
<br/>
<b><big><a name="Deprecated" id="Deprecated">Deprecated</a></big></b>


<br/>
Use <a href="ta_parallel_setup.xml" target="_top"><span style='white-space: nowrap'>thread_alloc::parallel_setup</span></a>
 
to set the number of threads.

<br/>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>

<br/>

<code><font color="blue"><span style='white-space: nowrap'>AD&lt;</span></font><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i><font color="blue"><span style='white-space: nowrap'>&gt;::omp_max_thread(</span></font><i><font color="black"><span style='white-space: nowrap'>number</span></font></i><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&lt;</span></font><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i><font color="blue"><span style='white-space: nowrap'>&gt;</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&#xA0;of&#xA0;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&lt;</span></font><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i><font color="blue"><span style='white-space: nowrap'>&gt;</span></font></code>
 class and thread pair. 

<br/>
<br/>
<b><big><a name="number" id="number">number</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>number</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>number</span></font></i><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&#xA0;f(x,&#xA0;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.


<hr/>Input File: cppad/local/omp_max_thread.hpp

</body>
</html>
