-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimization slowdown since 4.1.0 with python #1165
Comments
Could you share the timings for just the optimizer call in line 76? That will disambiguate whether this is a graph construction issue with python wrapper, or a true slowdown in optimization. |
@dellaert here are the results from those lines of code at the bottom, the timer is sampling only the optimizer.optimize() call:
gtsam=4.2a5: gtsam=4.0.3: |
Wow! Well, that's certainly annoying. @ProfFan ? |
|
OK, most time is wasted in throwing @shteren1 Change L69 to |
@ProfFan Thanks! i wasn't aware of values.insert_point3 option at all, it didn't exist in 4.0.3 and i didn't see it in any example. |
@shteren1 You don't need to change any code, the PR will fix the slowdown :) |
Yeah, the reason is that because we need to handle arbitrary sized matrices and vectors, but not arbitrary sized Poses, so the poses code is all fixed-sized and good.... |
So the final verdict is that if you use the So, if your code is not too sensitive to performance, just use |
I think we should not point people to insert_point3, which is an accidental name generated by pybind11. I would support adding an explicit insertPoint2 and insertPoint3 and properly document their reason for existence. @ProfFan , would you be willing to add that in the same PR? |
@shteren1 I think you can now use |
@ProfFan thanks! i'll try it out asap. btw, how did you run that profiling, it looks usefull. Edit: |
@shteren1 That one is done using Apple's Instruments app. Just compile and use instruments to run the resulting binary. |
Description
Since gtsam=4.1.0 i notice slow down of factor x2-3 when running a LM optimization on standard Visual Slam problem.
Steps to reproduce
This script generate 20 uniform poses on a circle of radius 20m all facing towards the center, it then generate 1000 landmarks around the center of the circle and generate measurements for them in each of the cameras represented by the poses.
it adds the generated landmarks positions + some random noise and poses position + random noise as initial guess and optimizes.
The script is compatible with both versions of gtsam before and after 4.1
Expected behavior
runtime should be nearly the same, or ideally even better with newer versions
Environment
tested on ubuntu 18.04 using clean python virtual environment
EDIT:
added priors on the first pose and landmark that were missing, the timing diff is x4 now instead of the x2.5 it was before. and its possible to use GN and DL optimizers also, without the prior they were throwing indeterminant linear system error.
The text was updated successfully, but these errors were encountered: