[Developers] trying to compare autodif with cppad

dave fournier davef at otter-rsch.com
Wed Aug 13 06:57:31 PDT 2014


On 08/12/2014 10:01 PM, Kasper Kristensen wrote:

Sorry about forgetting the hpp file. It is now attached.  CPPAD version 
is now much faster
with the -DNDEBUG option.  However when I increase the matrix size to 
500x500  (I'm aiming for fast 2,000x2,000)
  the cppad version produces NANS. Also note that the autodif version 
produces the numbers and stores them
in a file named vector for the cppad version.

       Dave



> Dave,
>
> I could not run your test because "myldet.hpp" was not attached.
> Did you try set the "-DNDEBUG" flag with the cppad compilation? If I recall correctly this could make a big difference.
>
> Kasper
>
>
>
> ________________________________________
> From: developers-bounces at admb-project.org [developers-bounces at admb-project.org] on behalf of dave fournier [davef at otter-rsch.com]
> Sent: Wednesday, August 13, 2014 5:26 AM
> To: developers at admb-project.org
> Subject: [Developers] trying to compare autodif with cppad
>
>      There has been a lot of material about TMB lately.  I think that TMB
> uses cppad as its underlying AD engine.   I am interested in
> trying to understand if cppad is superior to autodif and if so whether
> ADMB could be modified to use cppad.
>
> As a first attempt I have been working at reproducing the LU
> decomposition to calculate the log of
> (the absolutevalue of ) the determinant of a matrix.  The code is
> attached.  myreverse.cpp calculates the log det and
> the gradient via reverse model AD using cppad.  myreverse_admb.cpp does
> the same thing using autodif.
>
> For a 300x300 matrix the time required for these calculations is
> approximately  .25 seconds for autodif and 19 seconds for cppad so that
> autodif is about 75 times faster.  Obviously there may be techniques
> which can speed up cppad or I may have made
> some beginners error.  Perhaps the experts among us could comment.
>
> I could not compare matrices larger than 300x300 because the cppad code
> crashed.  The autodif version
> could do a 500x500 matrix in 1.23 seconds and a 1000x1000 matrix in 11
> seconds.
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: myldet.hpp
Type: text/x-c++hdr
Size: 4652 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20140813/33736199/attachment.hpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myreverse.cpp
Type: text/x-c++src
Size: 3464 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20140813/33736199/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reverse_one.cpp
Type: text/x-c++src
Size: 2858 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20140813/33736199/attachment-0001.cpp>


More information about the Developers mailing list