[ADOL-C] Operations on passive adoubles? Nonsequential active adouble memory?

David.Seelbinder at dlr.de David.Seelbinder at dlr.de
Tue May 13 05:20:24 EDT 2014


Dear all,

I did more testing on the problem I described earlier. I made a minimum working example (see attachment), that causes the error.

sparse_hess(...) crashes, when you perform operations on adoubles in the traced function which are not marked as independents.
sparse_jac(...) does not show this behavior.

Kind regards,
David

--------------------------

Dipl. Inform. David Seelbinder
Phone +49 421 24420-1283 | david.seelbinder at dlr.de<mailto:david.seelbinder at dlr.de>

Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
Institute of Space Systems| GNC Systems (RY-GNC) | Robert-Hooke-Str. 7 | 28359 Bremen | www.DLR.de<http://www.dlr.de/>


Von: adol-c-bounces at list.coin-or.org [mailto:adol-c-bounces at list.coin-or.org] Im Auftrag von David.Seelbinder at dlr.de
Gesendet: Montag, 12. Mai 2014 22:04
An: adol-c at list.coin-or.org
Betreff: [ADOL-C] Operations on passive adoubles? Nonsequential active adouble memory?

Dear all,

I have recently started to work with ADOL-C and I came across some unexpected behavior. Now I am wondering if I am doing something that is not allowed. I tried to reduce my problem to minimal size and describe it below. I would much appreciate any hints!

Problem setup:

I want to compute the sparse_hess(...) of a function

adouble Func(const vector<vector<adouble>& myContainer, double* otherArg)

But I am not interested in the hessian with respect to all values in  myContainer, but only some subset.

So when I trace Func (...) I selectively set some of the adoubles active, e.g.:

double x[] = {1, 2, 3};
trace_on(tag);
myContainer[3][2] <<= x[0];
myContainer[1][2] <<= x[1];
myContainer[5][0] <<= x[2];
adouble result = Func(myContainer, ...otherArgs)
double result2;
result >>= result2;
trace_off();

int options[] = {0, 0};
double* rind = NULL;
double* cind = NULL;
double* val  = NULL;
int nnz = 0;
sparse_hess(tag, 3, 0, x, &nnz, &rind, &cind, &val, options);

Problem description:

The problem occurs when I perform operations in Func on other adoubles than the ones I activated. E.g If Func contains

adouble dummy = myContainer[0][0] * myContainer[0][0];

This leads to a crash in sparse_hess->hess_pat->nonl_ind_forward_safe->traverse_unary

Uni5_for.c line 5622  if (tree->left != NULL)

Tree->left is undefined memory, probably because already in

Line 2016: traverse_unary(&fod[arg_index[arg1]], nonl_dom, &fod[arg_index[arg2]], indcheck+1,maxopind+2);

the index arg1 was wrong.

However, if I only perform operations on the activated adoubles in Func, the sparse_hess works fine!

That makes me wonder:

Questions:

1.       I am doing something wrong, when using "passive" adoubles just as normal doubles?

2.       Does ADOL-C require activated adoubles to be in sequential memory or fulfill other conditions?

3.       Can adoubles be manipulated through pointers and references the same as normal doubles? What about the "const" ness of adouble arguments?

Any hints would be very welcome!

Kind regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/adol-c/attachments/20140513/a0f75b9c/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ADOLC_sparse_hess_test.cpp
URL: <http://list.coin-or.org/pipermail/adol-c/attachments/20140513/a0f75b9c/attachment.ksh>


More information about the ADOL-C mailing list