Codebase list cppad / upstream/2015.00.00.7 doc / omp_create_array.xml
upstream/2015.00.00.7

Tree @upstream/2015.00.00.7 (Download .tar.gz)

omp_create_array.xml @upstream/2015.00.00.7raw · history · blame

<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>Allocate Memory and Create A Raw Array</title>
<meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
<meta name="description" id="description" content="Allocate Memory and Create A Raw Array"/>
<meta name="keywords" id="keywords" content=" allocate memory and create a raw array deprecated create_array omp_alloc syntax purpose type size_min size_out delta example "/>
<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_create_array_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_available.xml" target="_top">Prev</a>
</td><td><a href="omp_delete_array.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_create_array</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_create_array</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Deprecated</option>
<option>Syntax</option>
<option>Purpose</option>
<option>Type</option>
<option>size_min</option>
<option>size_out</option>
<option>array</option>
<option>Delta</option>
<option>Example</option>
</select>
</td>
</tr></table><br/>



<center><b><big><big>Allocate Memory and Create A Raw Array</big></big></b></center>
<br/>
<b><big><a name="Deprecated" id="Deprecated">Deprecated</a></big></b>


<br/>
Use the function <a href="ta_create_array.xml" target="_top"><span style='white-space: nowrap'>thread_alloc::create_array</span></a>
 instead.

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

<br/>

<code><i><font color="black"><span style='white-space: nowrap'>array</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;omp_alloc::create_array&lt;</span></font><i><font color="black"><span style='white-space: nowrap'>Type</span></font></i><font color="blue"><span style='white-space: nowrap'>&gt;(</span></font><i><font color="black"><span style='white-space: nowrap'>size_min</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>size_out</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>
.

<br/>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
Create a new raw array using <a href="omp_alloc.xml" target="_top"><span style='white-space: nowrap'>omp_alloc</span></a>
 a fast memory allocator 
that works well in a multi-threading OpenMP environment.

<br/>
<br/>
<b><big><a name="Type" id="Type">Type</a></big></b>
<br/>
The type of the elements of the array.

<br/>
<br/>
<b><big><a name="size_min" id="size_min">size_min</a></big></b>
<br/>
This argument 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'>size_min</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
This is the minimum number of elements that there can be
in the resulting 
<code><i><font color="black"><span style='white-space: nowrap'>array</span></font></i></code>
.

<br/>
<br/>
<b><big><a name="size_out" id="size_out">size_out</a></big></b>
<br/>
This argument has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&amp;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>size_out</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The input value of this argument does not matter.
Upon return, it is the actual number of elements 
in 
<code><i><font color="black"><span style='white-space: nowrap'>array</span></font></i></code>
 
(
<code><i><font color="black"><span style='white-space: nowrap'>&#xA0;size_min&#xA0;</span></font></i><font color="blue"><span style='white-space: nowrap'>&lt;=</span></font><i><font color="black"><span style='white-space: nowrap'>&#xA0;size_out</span></font></i></code>
).

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

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Type</span></font></i><font color="blue"><span style='white-space: nowrap'>*&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>array</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It is array with 
<code><i><font color="black"><span style='white-space: nowrap'>size_out</span></font></i></code>
 elements.
The default constructor for 
<code><i><font color="black"><span style='white-space: nowrap'>Type</span></font></i></code>
 is used to initialize the 
elements of 
<code><i><font color="black"><span style='white-space: nowrap'>array</span></font></i></code>
.
Note that <a href="omp_delete_array.xml" target="_top"><span style='white-space: nowrap'>omp_delete_array</span></a>

should be used to destroy the array when it is no longer needed.

<br/>
<br/>
<b><big><a name="Delta" id="Delta">Delta</a></big></b>
<br/>
The amount of memory <a href="omp_inuse.xml" target="_top"><span style='white-space: nowrap'>omp_inuse</span></a>
 by the current thread, 
will increase 
<code><i><font color="black"><span style='white-space: nowrap'>delta</span></font></i></code>
 where

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;sizeof(</span></font><i><font color="black"><span style='white-space: nowrap'>Type</span></font></i><font color="blue"><span style='white-space: nowrap'>)&#xA0;*&#xA0;(</span></font><i><font color="black"><span style='white-space: nowrap'>size_out</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;+&#xA0;1)&#xA0;&gt;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>delta</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&gt;=&#xA0;sizeof(</span></font><i><font color="black"><span style='white-space: nowrap'>Type</span></font></i><font color="blue"><span style='white-space: nowrap'>)&#xA0;*&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>size_out</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The <a href="omp_available.xml" target="_top"><span style='white-space: nowrap'>omp_available</span></a>
 memory will decrease by 
<code><i><font color="black"><span style='white-space: nowrap'>delta</span></font></i></code>
,
(and the allocation will be faster)
if a previous allocation with 
<code><i><font color="black"><span style='white-space: nowrap'>size_min</span></font></i></code>
 between its current value
and 
<code><i><font color="black"><span style='white-space: nowrap'>size_out</span></font></i></code>
 is available. 

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

<br/>
<a href="omp_alloc.cpp.xml" target="_top"><span style='white-space: nowrap'>omp_alloc.cpp</span></a>



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

</body>
</html>