You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While playing with the example code you helped me fix in #7, I started to get randomly erratic behavior while changing lines of code completely unrelated to the optimizer. Sometimes by simply adding or removing a line of code I can consistently reproduce the optimizer going into a completely different direction, and subsequently throwing due to some unfulfilled condition.
Since in my experience these kind of problems are usually reserved for uninitialized values, I got curious and compiled my example in debug mode, and running it through valgrind --leak-check=full --track-origins=yes. Valgrind found many cases of conditional jumps being performed depending on uninitialized variables, which confirmed my suspicions.
The source seems to be the various matrix resizing operation in the reset() functions of the optimizer/matrices(BGFSMat)/etc. I'm not sure if you are aware, but when resizing, Eigen does not automatically zero the matrices. I have fixed the problems by calling, after each resize, setZero(), but I am not sure whether this is OK or if you are explicitly avoiding the initialization because you want to do it in another place in the code to be more efficient.
An example of the change I have made to LBFGSBSolver to fix the problem:
Interesting finding. I thought I had already taken into account the uninitialized values and avoided reading those values, but your report seems to indicate that some edge cases exist. I'll look into it later.
While playing with the example code you helped me fix in #7, I started to get randomly erratic behavior while changing lines of code completely unrelated to the optimizer. Sometimes by simply adding or removing a line of code I can consistently reproduce the optimizer going into a completely different direction, and subsequently throwing due to some unfulfilled condition.
Since in my experience these kind of problems are usually reserved for uninitialized values, I got curious and compiled my example in debug mode, and running it through
valgrind --leak-check=full --track-origins=yes
. Valgrind found many cases of conditional jumps being performed depending on uninitialized variables, which confirmed my suspicions.The source seems to be the various matrix resizing operation in the
reset()
functions of the optimizer/matrices(BGFSMat)/etc. I'm not sure if you are aware, but when resizing, Eigen does not automatically zero the matrices. I have fixed the problems by calling, after each resize,setZero()
, but I am not sure whether this is OK or if you are explicitly avoiding the initialization because you want to do it in another place in the code to be more efficient.An example of the change I have made to LBFGSBSolver to fix the problem:
I am attaching the report here in case you need it, as it is fairly long (~5000 lines). Please let me know if I can help you more.
valgrind_report.txt
The text was updated successfully, but these errors were encountered: