Skip to content
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

[multibody] Experiment using M frame for Inverse Dynamics, for timings/sanity check #22253

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sherm1
Copy link
Member

@sherm1 sherm1 commented Dec 3, 2024

WIP, not intended to merge, don't review

This branch will be an experiment to integrate Alejandro's M-frame inverse dynamics prototype into Drake to see what speedups we can get in real life switching from W to M.


This change is Reviewable

@sherm1
Copy link
Member Author

sherm1 commented Dec 5, 2024

Preliminary performance results for M-frame Inverse Dynamics. TL/DR: switching from W to M frame resulted in a 25% speedup for ID. Combined with previous changes ID is 2X faster than when we started. Details:

This PR ID-M Master ID-W Before speedup work
time μs 11.6 15.2 21.4
speedup 24% 26% --
total 46% 26% --

Cassie benchmark times on my old Puget Xeon [email protected], g++ 11.4
(ID-W is the World frame version in master, ID-M is the new M-frame method)

I'm still studying this to see where we can squeeze out more speed.
cc @amcastro-tri

@sherm1
Copy link
Member Author

sherm1 commented Dec 6, 2024

Since we're trying to match Pinocchio timings (we think about 2μs for Cassie-size ID), there are some further considerations to make an apples-to-apples comparison. We've been including position & velocity kinematics in ID timings. Possibly Pinocchio is leaving kinematics fixed and just measuring the ID time alone. Also, the above timings were with gcc 11.4 which does a poor optimizing job compared to clang 14.0.0. And, the Pinocchio timings were presumably run on a faster machine than my 7yo Puget. Let's see how those factors affect things. TL/DR: this gets us to 2μs. And we're within 2X even with kinematics included.

P+V+ID-W P+V+ID-M Just ID-M
time μs 4.95 3.74 2.14

Timed on my laptop: Xeon W-11855M CPU @ 3.20GHz, using clang 14.0.0
(ID-W is the World frame version in master, ID-M is the new M-frame method)

@sherm1 sherm1 force-pushed the better_inverse_dynamics branch 2 times, most recently from a1754dd to 5adfeef Compare December 16, 2024 20:02
@sherm1 sherm1 force-pushed the better_inverse_dynamics branch from 5adfeef to c910091 Compare December 17, 2024 02:05
@sherm1 sherm1 force-pushed the better_inverse_dynamics branch from fe6adf8 to 18faf6a Compare December 20, 2024 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant