<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 08/14/2014 07:27 AM, Matthew
Supernaw wrote:<br>
<br>
One other thing is that the code executed on the graident stack
takes aobut the same amount of time as<br>
the function itself so it makes little sense to multi-thread the
function without multi-threading the<br>
gradient stack calculations even if they could be done in a single
thread.<br>
<br>
Dave<br>
</div>
<blockquote cite="mid:D2EE0DB5-39A8-4120-BCE5-E19A03EBAB0E@noaa.gov"
type="cite">
<div><font class="Apple-style-span" size="4">Hi Dave,</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4">I'd be surprised if
you find that cppad(running sequentially) is superior to
autodiff. Autodiff is really fast. If I recall
correctly, cppad was used in tmb because it plays well with
openmp. And given that most ADMB users no little about c++
development, it may be a desired feature to have Autodiff work
with something like openmp.</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4">A while ago I started
reviewing the autodiff code, focusing on the operations that
interface prevariables and the gradient stack. What I quickly
came to realize is almost everything is accessed via pointer,
which is good for atomic operations. Without fully
understanding the subtle details of these interactions and
whether or not order in the gradient stack is important, It
appears there are a lot of areas that could benefit from
atomic ops and thus allowing admb to run concurrently without
doing any locking(accept when absolutely necessary). </font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4">For instance:</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4"> if
(++gradient_structure::RETURN_PTR >
gradient_structure::MAX_RETURN) {</font></div>
<div><font class="Apple-style-span" size="4">
gradient_structure::RETURN_PTR =
gradient_structure::MIN_RETURN;</font></div>
<div><font class="Apple-style-span" size="4"> }</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><span class="Apple-style-span" style="font-size: large; ">may
work as:</span></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div>
<div><font class="Apple-style-span" size="4"> if (<b>atomic_increment(</b>gradient_structure::RETURN_PTR)
> gradient_structure::MAX_RETURN) {</font></div>
<div><font class="Apple-style-span" size="4"> <b>compare_and_swap</b>(gradient_structure::RETURN_PTR
, gradient_structure::MIN_RETURN);</font></div>
<div><font class="Apple-style-span" size="4"> }</font></div>
</div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4">*this code is
repeated at every prevariable op/function and could probably
just be put into a function. </font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4">And this:</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4">/**</font></div>
<div><font class="Apple-style-span" size="4"> * Description not
yet available.</font></div>
<div><font class="Apple-style-span" size="4"> * \param</font></div>
<div><font class="Apple-style-span" size="4"> */</font></div>
<div><font class="Apple-style-span" size="4">inline void
grad_stack::set_gradient_stack4(void (*func) (void),</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span>
double *dep_addr,</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span>
double *ind_addr1,</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span>
double *ind_addr2)</font></div>
<div><font class="Apple-style-span" size="4">{</font></div>
<div><font class="Apple-style-span" size="4">#ifdef NO_DERIVS</font></div>
<div><font class="Apple-style-span" size="4"> if
(!gradient_structure::no_derivatives)</font></div>
<div><font class="Apple-style-span" size="4"> {</font></div>
<div><font class="Apple-style-span" size="4">#endif</font></div>
<div><font class="Apple-style-span" size="4"> if (ptr >
ptr_last)</font></div>
<div><font class="Apple-style-span" size="4"> {</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span> //
current buffer is full -- write it to disk and reset pointer</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span> //
and counter</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span> this->write_grad_stack_buffer();</font></div>
<div><font class="Apple-style-span" size="4"> }</font></div>
<div><font class="Apple-style-span" size="4"> ptr->func
= func;</font></div>
<div><font class="Apple-style-span" size="4">
ptr->dep_addr = dep_addr;</font></div>
<div><font class="Apple-style-span" size="4">
ptr->ind_addr1 = ind_addr1;</font></div>
<div><font class="Apple-style-span" size="4">
ptr->ind_addr2 = ind_addr2;</font></div>
<div><font class="Apple-style-span" size="4"> ptr++;</font></div>
<div><font class="Apple-style-span" size="4">#ifdef NO_DERIVS</font></div>
<div><font class="Apple-style-span" size="4"> }</font></div>
<div><font class="Apple-style-span" size="4">#endif</font></div>
<div><font class="Apple-style-span" size="4">}</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4">Might work as:</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4">/**</font></div>
<div><font class="Apple-style-span" size="4"> * Description not
yet available.</font></div>
<div><font class="Apple-style-span" size="4"> * \param</font></div>
<div><font class="Apple-style-span" size="4"> */</font></div>
<div><font class="Apple-style-span" size="4">inline void
grad_stack::set_gradient_stack4(void (*func) (void),</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span>
double *dep_addr,</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span>
double *ind_addr1,</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span>
double *ind_addr2)</font></div>
<div><font class="Apple-style-span" size="4">{</font></div>
<div><font class="Apple-style-span" size="4">#ifdef NO_DERIVS</font></div>
<div><font class="Apple-style-span" size="4"> if
(!gradient_structure::no_derivatives)</font></div>
<div><font class="Apple-style-span" size="4"> {</font></div>
<div><font class="Apple-style-span" size="4">#endif</font></div>
<div><font class="Apple-style-span" size="4">
<div style="font-size: medium; "><font
class="Apple-style-span" size="4"> <b>
grad_stack_entry* ptr_l = ptr;</b></font></div>
<div style="font-size: medium; "><font
class="Apple-style-span" size="4"> <b>atomic_increment</b>(ptr);</font></div>
<div style="font-size: medium; "><font
class="Apple-style-span" size="4"><br>
</font></div>
</font></div>
<div><font class="Apple-style-span" size="4"> if (</font><span
class="Apple-style-span" style="font-size: large; ">ptr_l</span> <span
class="Apple-style-span" style="font-size: large; ">>
ptr_last)</span></div>
<div><font class="Apple-style-span" size="4"> {</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span><b>lock</b>();</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span> //
current buffer is full -- write it to disk and reset pointer</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span> //
and counter</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span> this->write_grad_stack_buffer();</font></div>
<div><font class="Apple-style-span" size="4"><span
class="Apple-tab-span" style="white-space: pre; "> </span><b>unlock</b>();</font></div>
<div><font class="Apple-style-span" size="4"> }</font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4"> </font></div>
<div><font class="Apple-style-span" size="4"> </font><span
class="Apple-style-span" style="font-size: large; "><b>ptr_l</b></span><font
class="Apple-style-span" size="4">->func = func;</font></div>
<div><font class="Apple-style-span" size="4"> </font><span
class="Apple-style-span" style="font-size: large; "><b>ptr_l</b></span><font
class="Apple-style-span" size="4">->dep_addr = dep_addr;</font></div>
<div><font class="Apple-style-span" size="4"> </font><span
class="Apple-style-span" style="font-size: large; "><b>ptr_l</b></span><font
class="Apple-style-span" size="4">->ind_addr1 =
ind_addr1;</font></div>
<div><font class="Apple-style-span" size="4"> </font><span
class="Apple-style-span" style="font-size: large; "><b>ptr_l</b></span><font
class="Apple-style-span" size="4">->ind_addr2 =
ind_addr2;</font></div>
<div><font class="Apple-style-span" size="4"> </font></div>
<div><font class="Apple-style-span" size="4">#ifdef NO_DERIVS</font></div>
<div><font class="Apple-style-span" size="4"> }</font></div>
<div><font class="Apple-style-span" size="4">#endif</font></div>
<div><font class="Apple-style-span" size="4">}</font></div>
</div>
<div><font class="Apple-style-span" size="4"> </font></div>
<div><font class="Apple-style-span" size="4">The above code is
untested and not well though out. It may also require some
memory barriers. </font></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4">Anyway, I may be on
the wrong track here, but at a first glance it seems like a
real possibility as far simplifying concurrent operations for
the average user. </font><span class="Apple-style-span"
style="font-size: large; ">Do you think this would work?</span></div>
<div><font class="Apple-style-span" size="4"><br>
</font></div>
<div><font class="Apple-style-span" size="4">Matthew</font></div>
<div><span class="Apple-style-span" style="font-size: 17px; "><br>
</span></div>
<div>
<span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: Helvetica; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: -webkit-auto; text-indent: 0px; text-transform:
none; white-space: normal; widows: 2; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px; font-size: medium; ">
<div>
<div>Matthew Supernaw</div>
<div>Scientific Programmer</div>
<div>National Oceanic and Atmospheric Administration</div>
<div>National Marine Fisheries Service</div>
<div>Sustainable Fisheries Division</div>
<div>St. Petersburg, FL, 33701</div>
<div>Office 727-551-5606</div>
<div>Fax 727-824-5300</div>
</div>
</span>
</div>
<br>
<div>
<div>On Aug 13, 2014, at 12:26 PM, <a moz-do-not-send="true"
href="mailto:developers-request@admb-project.org">developers-request@admb-project.org</a>
wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div>Send Developers mailing list submissions to<br>
<span class="Apple-tab-span" style="white-space:pre"> </span><a
moz-do-not-send="true"
href="mailto:developers@admb-project.org">developers@admb-project.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<span class="Apple-tab-span" style="white-space:pre"> </span><a class="moz-txt-link-freetext" href="http://lists.admb-project.org/mailman/listinfo/developers">http://lists.admb-project.org/mailman/listinfo/developers</a><br>
or, via email, send a message with subject or body 'help' to<br>
<span class="Apple-tab-span" style="white-space:pre"> </span><a class="moz-txt-link-abbreviated" href="mailto:developers-request@admb-project.org">developers-request@admb-project.org</a><br>
<br>
You can reach the person managing the list at<br>
<span class="Apple-tab-span" style="white-space:pre"> </span><a class="moz-txt-link-abbreviated" href="mailto:developers-owner@admb-project.org">developers-owner@admb-project.org</a><br>
<br>
When replying, please edit your Subject line so it is more
specific<br>
than "Re: Contents of Developers digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. trying to compare autodif with cppad (dave fournier)<br>
2. Re: trying to compare autodif with cppad (dave
fournier)<br>
3. Re: trying to compare autodif with cppad (Steve
Martell)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 12 Aug 2014 20:26:23 -0700<br>
From: dave fournier <a class="moz-txt-link-rfc2396E" href="mailto:davef@otter-rsch.com"><davef@otter-rsch.com></a><br>
To: <a class="moz-txt-link-rfc2396E" href="mailto:developers@admb-project.org">"developers@admb-project.org"</a>
<a class="moz-txt-link-rfc2396E" href="mailto:developers@admb-project.org"><developers@admb-project.org></a><br>
Subject: [Developers] trying to compare autodif with cppad<br>
Message-ID: <a class="moz-txt-link-rfc2396E" href="mailto:53EADADF.8080002@otter-rsch.com"><53EADADF.8080002@otter-rsch.com></a><br>
Content-Type: text/plain; charset="iso-8859-1";
Format="flowed"<br>
<br>
<br>
There has been a lot of material about TMB lately. I
think that TMB <br>
uses cppad as its underlying AD engine. I am interested in<br>
trying to understand if cppad is superior to autodif and if
so whether <br>
ADMB could be modified to use cppad.<br>
<br>
As a first attempt I have been working at reproducing the LU
<br>
decomposition to calculate the log of<br>
(the absolutevalue of ) the determinant of a matrix. The
code is <br>
attached. myreverse.cpp calculates the log det and<br>
the gradient via reverse model AD using cppad.
myreverse_admb.cpp does <br>
the same thing using autodif.<br>
<br>
For a 300x300 matrix the time required for these
calculations is <br>
approximately .25 seconds for autodif and 19 seconds for
cppad so that<br>
autodif is about 75 times faster. Obviously there may be
techniques <br>
which can speed up cppad or I may have made<br>
some beginners error. Perhaps the experts among us could
comment.<br>
<br>
I could not compare matrices larger than 300x300 because the
cppad code <br>
crashed. The autodif version<br>
could do a 500x500 matrix in 1.23 seconds and a 1000x1000
matrix in 11 <br>
seconds.<br>
<br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: myreverse_admb.cpp<br>
Type: text/x-c++src<br>
Size: 1243 bytes<br>
Desc: not available<br>
URL:
<a class="moz-txt-link-rfc2396E" href="http://lists.admb-project.org/pipermail/developers/attachments/20140812/649cb355/attachment-0002.cpp"><http://lists.admb-project.org/pipermail/developers/attachments/20140812/649cb355/attachment-0002.cpp></a><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: myreverse.cpp<br>
Type: text/x-c++src<br>
Size: 3464 bytes<br>
Desc: not available<br>
URL:
<a class="moz-txt-link-rfc2396E" href="http://lists.admb-project.org/pipermail/developers/attachments/20140812/649cb355/attachment-0003.cpp"><http://lists.admb-project.org/pipermail/developers/attachments/20140812/649cb355/attachment-0003.cpp></a><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Wed, 13 Aug 2014 06:57:31 -0700<br>
From: dave fournier <a class="moz-txt-link-rfc2396E" href="mailto:davef@otter-rsch.com"><davef@otter-rsch.com></a><br>
To: Kasper Kristensen <a class="moz-txt-link-rfc2396E" href="mailto:kaskr@dtu.dk"><kaskr@dtu.dk></a><br>
Cc: <a class="moz-txt-link-rfc2396E" href="mailto:developers@admb-project.org">"developers@admb-project.org"</a>
<a class="moz-txt-link-rfc2396E" href="mailto:developers@admb-project.org"><developers@admb-project.org></a><br>
Subject: Re: [Developers] trying to compare autodif with
cppad<br>
Message-ID: <a class="moz-txt-link-rfc2396E" href="mailto:53EB6ECB.1000604@otter-rsch.com"><53EB6ECB.1000604@otter-rsch.com></a><br>
Content-Type: text/plain; charset="iso-8859-1";
Format="flowed"<br>
<br>
On 08/12/2014 10:01 PM, Kasper Kristensen wrote:<br>
<br>
Sorry about forgetting the hpp file. It is now attached.
CPPAD version <br>
is now much faster<br>
with the -DNDEBUG option. However when I increase the
matrix size to <br>
500x500 (I'm aiming for fast 2,000x2,000)<br>
the cppad version produces NANS. Also note that the autodif
version <br>
produces the numbers and stores them<br>
in a file named vector for the cppad version.<br>
<br>
Dave<br>
<br>
<br>
<br>
<blockquote type="cite">Dave,<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">I could not run your test because
"myldet.hpp" was not attached.<br>
</blockquote>
<blockquote type="cite">Did you try set the "-DNDEBUG" flag
with the cppad compilation? If I recall correctly this
could make a big difference.<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Kasper<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">________________________________________<br>
</blockquote>
<blockquote type="cite">From:
<a class="moz-txt-link-abbreviated" href="mailto:developers-bounces@admb-project.org">developers-bounces@admb-project.org</a>
[<a class="moz-txt-link-abbreviated" href="mailto:developers-bounces@admb-project.org">developers-bounces@admb-project.org</a>] on behalf of dave
fournier [<a class="moz-txt-link-abbreviated" href="mailto:davef@otter-rsch.com">davef@otter-rsch.com</a>]<br>
</blockquote>
<blockquote type="cite">Sent: Wednesday, August 13, 2014
5:26 AM<br>
</blockquote>
<blockquote type="cite">To: <a class="moz-txt-link-abbreviated" href="mailto:developers@admb-project.org">developers@admb-project.org</a><br>
</blockquote>
<blockquote type="cite">Subject: [Developers] trying to
compare autodif with cppad<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"> There has been a lot of
material about TMB lately. I think that TMB<br>
</blockquote>
<blockquote type="cite">uses cppad as its underlying AD
engine. I am interested in<br>
</blockquote>
<blockquote type="cite">trying to understand if cppad is
superior to autodif and if so whether<br>
</blockquote>
<blockquote type="cite">ADMB could be modified to use cppad.<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">As a first attempt I have been
working at reproducing the LU<br>
</blockquote>
<blockquote type="cite">decomposition to calculate the log
of<br>
</blockquote>
<blockquote type="cite">(the absolutevalue of ) the
determinant of a matrix. The code is<br>
</blockquote>
<blockquote type="cite">attached. myreverse.cpp calculates
the log det and<br>
</blockquote>
<blockquote type="cite">the gradient via reverse model AD
using cppad. myreverse_admb.cpp does<br>
</blockquote>
<blockquote type="cite">the same thing using autodif.<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">For a 300x300 matrix the time
required for these calculations is<br>
</blockquote>
<blockquote type="cite">approximately .25 seconds for
autodif and 19 seconds for cppad so that<br>
</blockquote>
<blockquote type="cite">autodif is about 75 times faster.
Obviously there may be techniques<br>
</blockquote>
<blockquote type="cite">which can speed up cppad or I may
have made<br>
</blockquote>
<blockquote type="cite">some beginners error. Perhaps the
experts among us could comment.<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">I could not compare matrices larger
than 300x300 because the cppad code<br>
</blockquote>
<blockquote type="cite">crashed. The autodif version<br>
</blockquote>
<blockquote type="cite">could do a 500x500 matrix in 1.23
seconds and a 1000x1000 matrix in 11<br>
</blockquote>
<blockquote type="cite">seconds.<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: myldet.hpp<br>
Type: text/x-c++hdr<br>
Size: 4652 bytes<br>
Desc: not available<br>
URL:
<a class="moz-txt-link-rfc2396E" href="http://lists.admb-project.org/pipermail/developers/attachments/20140813/33736199/attachment-0001.hpp"><http://lists.admb-project.org/pipermail/developers/attachments/20140813/33736199/attachment-0001.hpp></a><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: myreverse.cpp<br>
Type: text/x-c++src<br>
Size: 3464 bytes<br>
Desc: not available<br>
URL:
<a class="moz-txt-link-rfc2396E" href="http://lists.admb-project.org/pipermail/developers/attachments/20140813/33736199/attachment-0002.cpp"><http://lists.admb-project.org/pipermail/developers/attachments/20140813/33736199/attachment-0002.cpp></a><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: reverse_one.cpp<br>
Type: text/x-c++src<br>
Size: 2858 bytes<br>
Desc: not available<br>
URL:
<a class="moz-txt-link-rfc2396E" href="http://lists.admb-project.org/pipermail/developers/attachments/20140813/33736199/attachment-0003.cpp"><http://lists.admb-project.org/pipermail/developers/attachments/20140813/33736199/attachment-0003.cpp></a><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Wed, 13 Aug 2014 16:26:23 +0000<br>
From: Steve Martell <a class="moz-txt-link-rfc2396E" href="mailto:SteveM@iphc.int"><SteveM@iphc.int></a><br>
To: dave fournier <a class="moz-txt-link-rfc2396E" href="mailto:davef@otter-rsch.com"><davef@otter-rsch.com></a><br>
Cc: <a class="moz-txt-link-rfc2396E" href="mailto:developers@admb-project.org">"developers@admb-project.org"</a>
<a class="moz-txt-link-rfc2396E" href="mailto:developers@admb-project.org"><developers@admb-project.org></a>,<br>
<span class="Apple-tab-span" style="white-space:pre"> </span>Kasper
Kristensen <a class="moz-txt-link-rfc2396E" href="mailto:kaskr@dtu.dk"><kaskr@dtu.dk></a><br>
Subject: Re: [Developers] trying to compare autodif with
cppad<br>
Message-ID:
<a class="moz-txt-link-rfc2396E" href="mailto:29A1581F-2ADE-412F-85C2-6D2904CEA97D@iphc.int"><29A1581F-2ADE-412F-85C2-6D2904CEA97D@iphc.int></a><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Dave I was able to compile and run your examples.<br>
---------------------------------------------------------------------<br>
With n=300 here are the run times.<br>
myreverse_admb (safe mode):<br>
real 0m0.643s<br>
user 0m0.615s<br>
sys 0m0.015s<br>
<br>
<br>
myreverse_admb (optimize):<br>
real 0m0.368s<br>
user 0m0.337s<br>
sys 0m0.014s<br>
<br>
Using the cppad<br>
myreverse:<br>
real 0m17.875s<br>
user 0m17.010s<br>
sys 0m0.847s<br>
<br>
<br>
myreverse with -DNDEBUG flag:<br>
real 0m5.287s<br>
user 0m4.894s<br>
sys 0m0.378s<br>
<br>
---------------------------------------------------------------------<br>
With n=500<br>
myreverse_admb (safe mode):<br>
real 0m2.414s<br>
user 0m2.341s<br>
sys 0m0.035s<br>
<br>
myreverse_admb (optimize):<br>
real 0m1.450s<br>
user 0m1.378s<br>
sys 0m0.035s<br>
<br>
Using the cppad<br>
myreverse:<br>
n = 500<br>
cppad-20140530 error from a known source:<br>
dw = f.Reverse(q, w): has a nan,<br>
but none of its Taylor coefficents are nan.<br>
Error detected by false result for<br>
! ( hasnan(value) && check_for_nan_ )<br>
at line 202 in the file<br>
/usr/include/cppad/local/reverse.hpp<br>
Assertion failed: (false), function Default, file
/usr/include/cppad/error_handler.hpp, line 210.<br>
Abort trap: 6<br>
<br>
real 1m19.457s<br>
user 1m15.951s<br>
sys 0m3.180s<br>
bash-3.2$<br>
<br>
myreverse with -DNDEBUG flag:<br>
n=500<br>
output is nan's<br>
real 0m23.766s<br>
user 0m22.090s<br>
sys 0m1.643s<br>
---------------------------------------------------------------------<br>
Steve<br>
<br>
<br>
On Aug 13, 2014, at 6:58 AM, dave fournier
<a class="moz-txt-link-rfc2396E" href="mailto:davef@otter-rsch.com"><davef@otter-rsch.com></a> wrote:<br>
<br>
<blockquote type="cite">On 08/12/2014 10:01 PM, Kasper
Kristensen wrote:<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Sorry about forgetting the hpp file.
It is now attached. CPPAD version is now much faster<br>
</blockquote>
<blockquote type="cite">with the -DNDEBUG option. However
when I increase the matrix size to 500x500 (I'm aiming
for fast 2,000x2,000)<br>
</blockquote>
<blockquote type="cite">the cppad version produces NANS.
Also note that the autodif version produces the numbers
and stores them<br>
</blockquote>
<blockquote type="cite">in a file named vector for the cppad
version.<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"> Dave<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">Dave,<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">I could not run your test because
"myldet.hpp" was not attached.<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">Did you try set the "-DNDEBUG"
flag with the cppad compilation? If I recall correctly
this could make a big difference.<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">Kasper<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">________________________________________<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">From:
<a class="moz-txt-link-abbreviated" href="mailto:developers-bounces@admb-project.org">developers-bounces@admb-project.org</a>
[<a class="moz-txt-link-abbreviated" href="mailto:developers-bounces@admb-project.org">developers-bounces@admb-project.org</a>] on behalf of dave
fournier [<a class="moz-txt-link-abbreviated" href="mailto:davef@otter-rsch.com">davef@otter-rsch.com</a>]<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">Sent: Wednesday, August 13, 2014
5:26 AM<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">To: <a class="moz-txt-link-abbreviated" href="mailto:developers@admb-project.org">developers@admb-project.org</a><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">Subject: [Developers] trying to
compare autodif with cppad<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"> There has been a lot of
material about TMB lately. I think that TMB<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">uses cppad as its underlying AD
engine. I am interested in<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">trying to understand if cppad is
superior to autodif and if so whether<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">ADMB could be modified to use
cppad.<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">As a first attempt I have been
working at reproducing the LU<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">decomposition to calculate the log
of<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">(the absolutevalue of ) the
determinant of a matrix. The code is<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">attached. myreverse.cpp
calculates the log det and<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">the gradient via reverse model AD
using cppad. myreverse_admb.cpp does<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">the same thing using autodif.<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">For a 300x300 matrix the time
required for these calculations is<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">approximately .25 seconds for
autodif and 19 seconds for cppad so that<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">autodif is about 75 times faster.
Obviously there may be techniques<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">which can speed up cppad or I may
have made<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">some beginners error. Perhaps the
experts among us could comment.<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">I could not compare matrices
larger than 300x300 because the cppad code<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">crashed. The autodif version<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">could do a 500x500 matrix in 1.23
seconds and a 1000x1000 matrix in 11<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite">seconds.<br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite">
<blockquote type="cite"><br>
</blockquote>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"><myldet.hpp><myreverse.cpp><reverse_one.cpp>_______________________________________________<br>
</blockquote>
<blockquote type="cite">Developers mailing list<br>
</blockquote>
<blockquote type="cite"><a class="moz-txt-link-abbreviated" href="mailto:Developers@admb-project.org">Developers@admb-project.org</a><br>
</blockquote>
<blockquote type="cite"><a class="moz-txt-link-freetext" href="http://lists.admb-project.org/mailman/listinfo/developers">http://lists.admb-project.org/mailman/listinfo/developers</a><br>
</blockquote>
<br>
<br>
________________________________<br>
<br>
This internet e-mail message, and any files transmitted with
it, contains confidential, privileged information that is
intended only for the addressee. If you have received this
e-mail message in error, please call us at (206) 634-1838
collect if necessary) and ask to speak to the message
sender. Nothing in this e-mail or the act of transmitting
it, is to be construed as a waiver of any rights or
privileges enjoyed by the sender or the International
Pacific Halibut Commission pursuant to the International
Organizations Immunities Act, 22 U.S.C. Sec. 288 et seq.<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Developers mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:Developers@admb-project.org">Developers@admb-project.org</a><br>
<a class="moz-txt-link-freetext" href="http://lists.admb-project.org/mailman/listinfo/developers">http://lists.admb-project.org/mailman/listinfo/developers</a><br>
<br>
<br>
End of Developers Digest, Vol 64, Issue 12<br>
******************************************<br>
</div>
</blockquote>
</div>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Developers@admb-project.org">Developers@admb-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.admb-project.org/mailman/listinfo/developers">http://lists.admb-project.org/mailman/listinfo/developers</a>
</pre>
</blockquote>
<br>
</body>
</html>