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

[MultiThreading] Introduce ParallelTetrahedronFEMForceField #3552

Merged
merged 6 commits into from
Jan 12, 2023

Conversation

alxbilger
Copy link
Contributor

Based on #3548

Similar to ParallelHexahedronFEMForceField.

addDForce and addKToMatrix are the parallelized functions.
addForce is not parallelized. It would require to duplicate code from the base class. Hence a refactoring is needed for a proper implementation (in another PR). Note that addForce is usually not the bottleneck.

Quick benchmarks show performances improvement on the provided example.

I think there is still room for improvement in addDForce. But it would require a few changes in the base class. Instead of having a force vector for each task, I suggest to store only the force on the DoFs that have been visited during the task. I am not sure if it will bring more perfs improvements.

In this PR, addKToMatrix is parallelized. It is not in ParallelHexahedronFEMForceField, but the same principle can be applied (in another PR).


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

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger alxbilger added pr: status to review To notify reviewers to review this pull-request pr: new feature Implement a new feature pr: highlighted in next release Highlight this contribution in the notes of the upcoming release labels Dec 17, 2022
@alxbilger alxbilger added this to the v23.06 milestone Dec 17, 2022
@alxbilger
Copy link
Contributor Author

[ci-build][with-all-tests]

@alxbilger
Copy link
Contributor Author

Benchmark on the provided example

Matrix-free CG:

Sequential:
[INFO] [BatchGUI] 1000 iterations done in 4.1899 s ( 238.669 FPS).
CG-Solve 3.21 ms (mean)

Parallel:
[INFO] [BatchGUI] 1000 iterations done in 2.82476 s ( 354.012 FPS).
CG-Solve 1.85 ms (mean)

Assembled CG

(CG with template="CompressedRowSparseMatrixMat3x3d"

Sequential:
[INFO] [BatchGUI] 1000 iterations done in 6.65858 s ( 150.182 FPS).
CG-setSystemMBKMatrix 2.34 ms (mean)

Parallel:
[INFO] [BatchGUI] 1000 iterations done in 4.1272 s ( 242.295 FPS).
CG-setSystemMBKMatrix 4.94 ms (mean)

@fredroy fredroy 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 11, 2023
@fredroy fredroy merged commit e32cf7d into sofa-framework:master Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: highlighted in next release Highlight this contribution in the notes of the upcoming release pr: new feature Implement a new feature pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants