-
Notifications
You must be signed in to change notification settings - Fork 312
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
[StateContainer] Accelerate copy of MatrixDeriv for CRS matrices #4443
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
No more template specialization
including CompressedRowSparseMatrixConstraint
alxbilger
added
enhancement
About a possible enhancement
pr: status to review
To notify reviewers to review this pull-request
labels
Jan 18, 2024
[ci-build][with-all-tests] |
The call stack of the runtime error on Linux is the following:
and with GDB:
|
hugtalbot
approved these changes
Jan 24, 2024
hugtalbot
added
pr: status ready
Approved a pull-request, ready to be squashed
and removed
pr: status to review
To notify reviewers to review this pull-request
labels
Jan 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
About a possible enhancement
pr: status ready
Approved a pull-request, ready to be squashed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #4442
Diff: alxbilger/sofa@filtervalues...alxbilger:sofa:copymatrixderiv
The goal is to accelerate the computation of mappings jacobians when projecting the mapped stiffness matrices. In some cases, the conversion from the MatrixDeriv (stored in the mechanical objects) is really slow, even slower than the actual computation of the matrix. A special case is now added when the destination is a
CompressedRowSparseMatrixMechanical
. Unfortunately, this is detected with adynamic_cast
.To benchmark the changes, let's add the following timers in MatrixLinearSystem.inl (line 1076):
Reduced Diamond (1000 time steps)
ModelOrderReduction relies heavily on mapped matrices (a huge matrix projected on a small matrix)
Before
After
Speedup
Speed up of x1.4 on the timer
projectMappedMatrices
. The bottleneck is now in the computation ofJ^T * K * J
.MatrixLinearSystem.scn (1000 time steps)
Before
After
Conclusion
In both scenes, the timer
fullRows
is almost at zero because the functionscopyNonZeros
already produces a compressed matrix. In addition, the timercopyToBaseMatrix
is faster.FYI @olivier-goury @VannesteFelix
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if