kaskr / adcomp

AD computation with Template Model Builder (TMB)
Other
176 stars 80 forks source link

TMB crashing after working for 10 seconds #315

Open awstringer1 opened 4 years ago

awstringer1 commented 4 years ago

Hello,

I am learning TMB and love it! I have gone through the process of porting my (quite complicated) objective function over to the C++ language as provided by TMB. I have debugged compiler errors and run-time errors including using the extra package for floating point exceptions. gdbsource returns a "Program ran without errors" message when run.

I am now, however, running into a very tricky problem:

  1. I compile the code without errors using compile(), and load it using dynload(),
  2. I link it with ff = MakeADFun(...),
  3. I can run ff$fn(...), ff$gr(...), ff$he(...) immediately after, obtaining sensible results. However,
  4. regardless of what I do, about 10 seconds after calling MakeADFun(...), R crashes (as if there was a runtime error)– EVEN after ff$fn(...) etc runs successfully during that blissful 10 second interval.

I have to say I'm stumped here. It's too onerous and probably not too helpful to provide a full reproducible example here, since both the R and C++ code are quite long. I'd appreciate any direction anyone could give.

R version: 3.6.2 System: Ubuntu 18.04 LTS

Let me know if I can provide anything else, thanks!

Alex