[Developers] trying to compare autodif with cppad
Steve Martell
SteveM at iphc.int
Wed Aug 13 09:26:23 PDT 2014
Dave I was able to compile and run your examples.
---------------------------------------------------------------------
With n=300 here are the run times.
myreverse_admb (safe mode):
real 0m0.643s
user 0m0.615s
sys 0m0.015s
myreverse_admb (optimize):
real 0m0.368s
user 0m0.337s
sys 0m0.014s
Using the cppad
myreverse:
real 0m17.875s
user 0m17.010s
sys 0m0.847s
myreverse with -DNDEBUG flag:
real 0m5.287s
user 0m4.894s
sys 0m0.378s
---------------------------------------------------------------------
With n=500
myreverse_admb (safe mode):
real 0m2.414s
user 0m2.341s
sys 0m0.035s
myreverse_admb (optimize):
real 0m1.450s
user 0m1.378s
sys 0m0.035s
Using the cppad
myreverse:
n = 500
cppad-20140530 error from a known source:
dw = f.Reverse(q, w): has a nan,
but none of its Taylor coefficents are nan.
Error detected by false result for
! ( hasnan(value) && check_for_nan_ )
at line 202 in the file
/usr/include/cppad/local/reverse.hpp
Assertion failed: (false), function Default, file /usr/include/cppad/error_handler.hpp, line 210.
Abort trap: 6
real 1m19.457s
user 1m15.951s
sys 0m3.180s
bash-3.2$
myreverse with -DNDEBUG flag:
n=500
output is nan's
real 0m23.766s
user 0m22.090s
sys 0m1.643s
---------------------------------------------------------------------
Steve
On Aug 13, 2014, at 6:58 AM, dave fournier <davef at otter-rsch.com> wrote:
> 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.
>>
>>
>
> <myldet.hpp><myreverse.cpp><reverse_one.cpp>_______________________________________________
> Developers mailing list
> Developers at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/developers
________________________________
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.
More information about the Developers
mailing list