[CppAD] overflow of tape id when using many tapes

Stefan Vigerske stefan at math.hu-berlin.de
Sun Jul 1 06:25:12 EDT 2012


Hi,

in my code I use CppAD to evaluate function values and derivatives in 
many different places.
For that, it is easier to create a new tape for each function.
When the program runs a while (say, 8 hours), I seem to get an overflow 
in the tape_id, because CppAD seem to assign the id's with increasing 
numbers but does not reuse id's of tapes that are no longer in use.

Originally, I had set CPPAD_MAX_NUM_THREADS to 48, which already gave a 
failure after 4 hours. When setting it to a power of 2, it works better, 
because after an overflow the tapeid is at a 0 again.
However, changing CPPAD_MAX_NUM_THREADS to 1 does not seem to help much.
Actually, the last tape id before I get a segmentation fault is 8173126, 
which is even far below the maximum for an unsigned int.
I'm now trying with CPPAD_TAPE_ID_TYPE changed to size_t.

Anyhow, is there some better solution on how to use many tapes (but not 
all at the same time) in a longrunning program?
If I were able to remember which tape id's are still in use, is there a 
way I can tell CppAD which id to use next?

Best,
Stefan


More information about the CppAD mailing list