<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>Set and Get Maximum Number of Threads for omp_alloc Allocator</title>
<meta name="description" id="description" content="Set and Get Maximum Number of Threads for omp_alloc Allocator"/>
<meta name="keywords" id="keywords" content=" set_max_num_threads omp_alloc get_max_num_threads "/>
<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_num_threads_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="omp_alloc.xml" target="_top">Prev</a>
</td><td><a href="omp_in_parallel.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_alloc</option>
<option>omp_max_num_threads</option>
</select>
</td>
<td>
<select onchange='choose_down3(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_down2(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>
<select onchange='choose_down1(this)'>
<option>omp_alloc-&gt;</option>
<option>omp_max_num_threads</option>
<option>omp_in_parallel</option>
<option>omp_get_thread_num</option>
<option>omp_get_memory</option>
<option>omp_return_memory</option>
<option>omp_free_available</option>
<option>omp_inuse</option>
<option>omp_available</option>
<option>omp_create_array</option>
<option>omp_delete_array</option>
<option>omp_efficient</option>
<option>old_max_num_threads</option>
<option>omp_alloc.cpp</option>
</select>
</td>
<td>omp_max_num_threads</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Deprecated</option>
<option>Syntax</option>
<option>Purpose</option>
<option>number</option>
<option>set_max_num_threads</option>
<option>get_max_num_threads</option>
<option>Restrictions</option>
</select>
</td>
</tr></table><br/>
<center><b><big><big>Set and Get Maximum Number of Threads for omp_alloc Allocator</big></big></b></center>
<br/>
<b><big><a name="Deprecated" id="Deprecated">Deprecated</a></big></b>


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

and <a href="ta_num_threads.xml" target="_top"><span style='white-space: nowrap'>thread_alloc:num_threads</span></a>
 instead.

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

<br/>

<code><font color="blue"><span style='white-space: nowrap'>omp_alloc::set_max_num_threads(</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>

<code><i><font color="black"><span style='white-space: nowrap'>number</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;omp_alloc::get_max_num_threads()<br/>
</span></font></code>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
By default there is only one thread and all execution is in sequential mode
(not <a href="omp_in_parallel.xml" target="_top"><span style='white-space: nowrap'>parallel</span></a>
).

<br/>
<br/>
<b><big><a name="number" id="number">number</a></big></b>
<br/>
The argument and return value 
<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>
and must be greater than zero.

<br/>
<br/>
<b><big><a name="set_max_num_threads" id="set_max_num_threads">set_max_num_threads</a></big></b>
<br/>
Informs <a href="omp_alloc.xml" target="_top"><span style='white-space: nowrap'>omp_alloc</span></a>
 of the maximum number of OpenMP threads. 

<br/>
<br/>
<b><big><a name="get_max_num_threads" id="get_max_num_threads">get_max_num_threads</a></big></b>
<br/>
Returns the valued used in the previous call to <code><font color="blue">set_max_num_threads</font></code>.
If there was no such previous call, the value one is returned
(and only thread number zero can use <a href="omp_alloc.xml" target="_top"><span style='white-space: nowrap'>omp_alloc</span></a>
).

<br/>
<br/>
<b><big><a name="Restrictions" id="Restrictions">Restrictions</a></big></b>
<br/>
The function <code><font color="blue">set_max_num_threads</font></code> must be called before 
the program enters <a href="omp_in_parallel.xml" target="_top"><span style='white-space: nowrap'>parallel</span></a>
 execution mode.
In addition, this function cannot be called while in parallel mode.


<hr/>Input File: cppad/omp_alloc.hpp

</body>
</html>
