<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>A Quick OpenMP Memory Allocator Used by CppAD</title>
<meta name="description" id="description" content="A Quick OpenMP Memory Allocator Used by CppAD"/>
<meta name="keywords" id="keywords" content=" multi-threading memory allocation openmp "/>
<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_alloc_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="tracknewdel.cpp.xml" target="_top">Prev</a>
</td><td><a href="omp_max_num_threads.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>
</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>
<select onchange='choose_down0(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>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Syntax</option>
<option>Purpose</option>
<option>Include</option>
<option>Contents</option>
</select>
</td>
</tr></table><br/>



<center><b><big><big>A Quick OpenMP Memory Allocator Used by CppAD</big></big></b></center>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>

<code><font color="blue"><br/>
# include &lt;cppad/omp_alloc.hpp&gt;</font></code>

<br/>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
The C++ <code><font color="blue">new</font></code> and <code><font color="blue">delete</font></code> operators are thread safe,
but this means that a thread may have to wait for a lock on these operations.
Once memory is obtained for a thread, the <code><font color="blue">omp_alloc</font></code> memory
allocator keeps that memory <a href="omp_available.xml" target="_top"><span style='white-space: nowrap'>omp_available</span></a>
 for the thread so that
it can be re-used without waiting for a lock.
All the CppAD memory allocations use this utility. 
The <a href="omp_free_available.xml" target="_top"><span style='white-space: nowrap'>omp_free_available</span></a>
 function should be used to return memory
to the system (once it is no longer required by a thread).

<br/>
<br/>
<b><big><a name="Include" id="Include">Include</a></big></b>
<br/>
The routines in sections below are defined by <code><font color="blue">cppad/omp_alloc.hpp</font></code>.
This file is included by
<code><font color="blue">cppad/cppad.hpp</font></code>, but it can also be included separately with out
the rest of the <code><font color="blue">CppAD</font></code>.

<br/>
<br/>
<b><big><a name="Contents" id="Contents">Contents</a></big></b>
<br/>
<table>
<tr><td><a href="omp_max_num_threads.xml" target="_top">omp_max_num_threads</a></td><td>Set&#xA0;and&#xA0;Get&#xA0;Maximum&#xA0;Number&#xA0;of&#xA0;Threads&#xA0;for&#xA0;omp_alloc&#xA0;Allocator</td></tr><tr><td><a href="omp_in_parallel.xml" target="_top">omp_in_parallel</a></td><td>Is&#xA0;The&#xA0;Current&#xA0;Execution&#xA0;in&#xA0;OpenMP&#xA0;Parallel&#xA0;Mode</td></tr><tr><td><a href="omp_get_thread_num.xml" target="_top">omp_get_thread_num</a></td><td>Get&#xA0;the&#xA0;Current&#xA0;OpenMP&#xA0;Thread&#xA0;Number</td></tr><tr><td><a href="omp_get_memory.xml" target="_top">omp_get_memory</a></td><td>Get&#xA0;At&#xA0;Least&#xA0;A&#xA0;Specified&#xA0;Amount&#xA0;of&#xA0;Memory</td></tr><tr><td><a href="omp_return_memory.xml" target="_top">omp_return_memory</a></td><td>Return&#xA0;Memory&#xA0;to&#xA0;omp_alloc</td></tr><tr><td><a href="omp_free_available.xml" target="_top">omp_free_available</a></td><td>Free&#xA0;Memory&#xA0;Currently&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</td></tr><tr><td><a href="omp_inuse.xml" target="_top">omp_inuse</a></td><td>Amount&#xA0;of&#xA0;Memory&#xA0;a&#xA0;Thread&#xA0;is&#xA0;Currently&#xA0;Using</td></tr><tr><td><a href="omp_available.xml" target="_top">omp_available</a></td><td>Amount&#xA0;of&#xA0;Memory&#xA0;Available&#xA0;for&#xA0;Quick&#xA0;Use&#xA0;by&#xA0;a&#xA0;Thread</td></tr><tr><td><a href="omp_create_array.xml" target="_top">omp_create_array</a></td><td>Allocate&#xA0;Memory&#xA0;and&#xA0;Create&#xA0;A&#xA0;Raw&#xA0;Array</td></tr><tr><td><a href="omp_delete_array.xml" target="_top">omp_delete_array</a></td><td>Return&#xA0;A&#xA0;Raw&#xA0;Array&#xA0;to&#xA0;The&#xA0;Available&#xA0;Memory&#xA0;for&#xA0;a&#xA0;Thread</td></tr><tr><td><a href="omp_efficient.xml" target="_top">omp_efficient</a></td><td>Check&#xA0;If&#xA0;A&#xA0;Memory&#xA0;Allocation&#xA0;is&#xA0;Efficient&#xA0;for&#xA0;Another&#xA0;Use</td></tr><tr><td><a href="old_max_num_threads.xml" target="_top">old_max_num_threads</a></td><td>Set&#xA0;Maximum&#xA0;Number&#xA0;of&#xA0;Threads&#xA0;for&#xA0;omp_alloc&#xA0;Allocator</td></tr><tr><td><a href="omp_alloc.cpp.xml" target="_top">omp_alloc.cpp</a></td><td>OpenMP&#xA0;Memory&#xA0;Allocator:&#xA0;Example&#xA0;and&#xA0;Test</td></tr></table>
<hr/>Input File: omh/deprecated/omp_alloc.omh

</body>
</html>
