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

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

parallel_ad.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>Enable AD Calculations During Parallel Mode</title>
<meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
<meta name="description" id="description" content="Enable AD Calculations During Parallel Mode"/>
<meta name="keywords" id="keywords" content=" enable ad calculations during parallel mode syntax purpose discussion checksimplevector example restriction "/>
<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='_parallel_ad_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="multi_thread.xml" target="_top">Prev</a>
</td><td><a href="thread_test.cpp.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>multi_thread</option>
<option>parallel_ad</option>
</select>
</td>
<td>
<select onchange='choose_down2(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_down1(this)'>
<option>multi_thread-&gt;</option>
<option>parallel_ad</option>
<option>thread_test.cpp</option>
</select>
</td>
<td>parallel_ad</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Syntax</option>
<option>Purpose</option>
<option>Discussion</option>
<option>CheckSimpleVector</option>
<option>Example</option>
<option>Restriction</option>
</select>
</td>
</tr></table><br/>
<center><b><big><big>Enable AD Calculations During Parallel Mode</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'>parallel_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>


<br/>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
The function

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

must be called before any 
<code><font color="blue"><span style='white-space: nowrap'>AD&lt;</span></font><i><font color="black"><span style='white-space: nowrap'>Base&gt;</span></font></i></code>
 objects are used
in <a href="ta_in_parallel.xml" target="_top"><span style='white-space: nowrap'>parallel</span></a>
 mode.
In addition, if this routine is called after one is done using 
parallel mode, it will free extra memory used to keep track of 
the multiple 
<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>
 tapes required for parallel execution.

<br/>
<br/>
<b><big><a name="Discussion" id="Discussion">Discussion</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 threads at the same time. 
The <a href="ta_parallel_setup.xml" target="_top"><span style='white-space: nowrap'>parallel_setup</span></a>
 function informs CppAD of the
maximum number of threads that can be active in parallel mode.
This routine does extra setup 
(and teardown) for the particular 
<code><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i></code>
 type.

<br/>
<br/>
<b><big><a name="CheckSimpleVector" id="CheckSimpleVector">CheckSimpleVector</a></big></b>
<br/>
This routine has the side effect of calling the routines

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;CheckSimpleVector&lt;&#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;CppAD::vector&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;&#xA0;&gt;()<br/>
</span></font></code>
where 
<code><i><font color="black"><span style='white-space: nowrap'>Type</span></font></i></code>
 is 
<code><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i></code>
 and 
<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>
.

<br/>
<br/>
<b><big><a name="Example" id="Example">Example</a></big></b>
<br/>
The files 
<a href="team_openmp.cpp.xml" target="_top"><span style='white-space: nowrap'>team_openmp.cpp</span></a>
, 
<a href="team_bthread.cpp.xml" target="_top"><span style='white-space: nowrap'>team_bthread.cpp</span></a>
, and
<a href="team_pthread.cpp.xml" target="_top"><span style='white-space: nowrap'>team_pthread.cpp</span></a>
, 
contain examples and tests that implement this function.   

<br/>
<br/>
<b><big><a name="Restriction" id="Restriction">Restriction</a></big></b>
<br/>
This routine cannot be called in parallel mode or while
there is a tape recording 
<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>
 operations.


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

</body>
</html>