Skip to content

dispatch component description into dedicated files #197

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 0 additions & 102 deletions 35_Plugins/50_Usual_plugins/80_MultiThreading.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,108 +14,6 @@ This pipeline requires two components for the [broad phase](../../../components/
A usual choice is [BruteForceBroadPhase](../../../components/collision/detection/algorithm/bruteforcebroadphase/) for the broad phase, and [BVHNarrowPhase](../../../components/collision/detection/algorithm/bvhnarrowphase/) for the narrow phase.
Both of these components can be replaced with a parallel version from the MultiThreading plugin.

### ParallelBruteForceBroadPhase

This component is a parallel implementation of [BruteForceBroadPhase](../../../components/collision/detection/algorithm/bruteforcebroadphase/) using a global thread pool.
It means the result of a simulation with [BruteForceBroadPhase](../../../components/collision/detection/algorithm/bruteforcebroadphase/) or with ParallelBruteForceBroadPhase is expected to be equal.
ParallelBruteForceBroadPhase is the most efficient compared to [BruteForceBroadPhase](../../../components/collision/detection/algorithm/bruteforcebroadphase/) when there is a lot of objects in the scene.

#### Examples

Examples of ParallelBruteForceBroadPhase can be found in:

* [ParallelBruteForceBroadPhase.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelBruteForceBroadPhase.scn)
* [ParallelCollisionDetection.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelCollisionDetection.scn)
* [5DeformableCubesConstraints.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/5DeformableCubesConstraints.scn)

### ParallelBVHNarrowPhase

This component is a parallel implementation of [BVHNarrowPhase](../../../components/collision/detection/algorithm/bvhnarrowphase/) using a global thread pool.
It means the result of a simulation with [BVHNarrowPhase](../../../components/collision/detection/algorithm/bvhnarrowphase/) or with ParallelBVHNarrowPhase is expected to be equal.

#### Examples

Examples of ParallelBruteForceBroadPhase can be found in:

* [ParallelBruteForceBroadPhase.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelBruteForceBroadPhase.scn)
* [ParallelCollisionDetection.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelCollisionDetection.scn)
* [5DeformableCubesConstraints.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/5DeformableCubesConstraints.scn)

# Physics

## Parallel FEM

### ParallelTetrahedronFEMForceField

ParallelTetrahedronFEMForceField is the multi-threaded equivalent of [TetrahedronFEMForceField](../../../components/solidmechanics/fem/elastic/tetrahedronfemforcefield).

This implementation is the most efficient when the number of tetrahedron is large (> 1000).

The following methods are executed in parallel:
- `addDForce`
- `addKToMatrix`

#### Examples

Examples of ParallelTetrahedronFEMForceField can be found in:

* [ParallelTetrahedronFEMForceField.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelTetrahedronFEMForceField.scn)

### ParallelHexahedronFEMForceField

ParallelHexahedronFEMForceField is the multi-threaded equivalent of [HexahedronFEMForceField](../../../components/solidmechanics/fem/elastic/hexahedronfemforcefield).

This implementation is the most efficient when:

1) the number of hexahedron is large (> 1000)
2) the global system matrix is not assembled. It is usually the case with a [CGLinearSolver](../../../components/linearsolver/iterative/cglinearsolver/) templated with GraphScattered types.
3) the method is 'large'. If the method is 'polar' or 'small', `addForce` is executed sequentially, but `addDForce` in parallel.

The following methods are executed in parallel:

- `addForce` for method 'large'.
- `addDForce`

The method `addKToMatrix` is not executed in parallel.
This method is called with an assembled system, usually with a direct solver or a [CGLinearSolver](../../../components/linearsolver/iterative/cglinearsolver/) templated with types different from GraphScattered.
In this case, the most time-consuming step is to invert the matrix. This is where efforts should be put to accelerate the simulation.

#### Examples

Examples of ParallelHexahedronFEMForceField can be found in:

* [ParallelHexahedronFEMForceField.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelHexahedronFEMForceField.scn)

## BeamLinearMapping_mt

This component inherits all the functionality from the BeamLinearMapping component and overrides three virtual functions that contain a `for` loop: `apply()`, `applyJ()` and `applyJT()`.
It adds only one data attribute, the granularity. This attribute sets the number of iterations of the `for` loop, corresponding to the number of points along the beam elements that must be assigned and executed for each task.
If this number is lower than the number of iterations the loop won't be parallelized, and the corresponding BeamLinearMapping function is called.
If this number is greater than the number of iterations of the loop the tasks are created, and each task executes the granularity value of iterations of the loop.

### Examples

Examples of BeamLinearMapping_mt can be found in:

* [BeamLinearMapping_mt.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/BeamLinearMapping_mt.scn)

## Springs

### ParallelStiffSpringForceField

ParallelStiffSpringForceField is the multi-threaded equivalent of StiffSpringForceField.

### ParallelMeshSpringForceField

ParallelMeshSpringForceField is the multi-threaded equivalent of MeshSpringForceField.

### Examples

Examples of ParallelMeshSpringForceField can be found in:

* [ParallelMeshSpringForceField.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelMeshSpringForceField.scn)


## Independent SOFA Scenes

The AnimationLoopParallelScheduler component was implemented to run the physics simulation of independent scenes in parallel.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## BeamLinearMapping_mt

This component inherits all the functionality from the BeamLinearMapping component and overrides three virtual functions that contain a `for` loop: `apply()`, `applyJ()` and `applyJT()`.
It adds only one data attribute, the granularity. This attribute sets the number of iterations of the `for` loop, corresponding to the number of points along the beam elements that must be assigned and executed for each task.
If this number is lower than the number of iterations the loop won't be parallelized, and the corresponding BeamLinearMapping function is called.
If this number is greater than the number of iterations of the loop the tasks are created, and each task executes the granularity value of iterations of the loop.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ParallelBVHNarrowPhase

This component is a parallel implementation of [BVHNarrowPhase](../../../../components/collision/detection/algorithm/bvhnarrowphase/) using a global thread pool.
It means the result of a simulation with [BVHNarrowPhase](../../../../components/collision/detection/algorithm/bvhnarrowphase/) or with ParallelBVHNarrowPhase is expected to be equal.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ParallelBruteForceBroadPhase

This component is a parallel implementation of [BruteForceBroadPhase](../../../../components/collision/detection/algorithm/bruteforcebroadphase/) using a global thread pool.
It means the result of a simulation with [BruteForceBroadPhase](../../../../components/collision/detection/algorithm/bruteforcebroadphase/) or with ParallelBruteForceBroadPhase is expected to be equal.
ParallelBruteForceBroadPhase is the most efficient compared to [BruteForceBroadPhase](../../../../components/collision/detection/algorithm/bruteforcebroadphase/) when there is a lot of objects in the scene.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ParallelHexahedronFEMForceField

ParallelHexahedronFEMForceField is the multi-threaded equivalent of [HexahedronFEMForceField](../../../../components/solidmechanics/fem/elastic/hexahedronfemforcefield).

This implementation is the most efficient when:

1) the number of hexahedron is large (> 1000)
2) the global system matrix is not assembled. It is usually the case with a [CGLinearSolver](../../../../components/linearsolver/iterative/cglinearsolver/) templated with GraphScattered types.
3) the method is 'large'. If the method is 'polar' or 'small', `addForce` is executed sequentially, but `addDForce` in parallel.

The following methods are executed in parallel:

- `addForce` for method 'large'.
- `addDForce`

The method `addKToMatrix` is not executed in parallel.
This method is called with an assembled system, usually with a direct solver or a [CGLinearSolver](../../../../components/linearsolver/iterative/cglinearsolver/) templated with types different from GraphScattered.
In this case, the most time-consuming step is to invert the matrix. This is where efforts should be put to accelerate the simulation.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ParallelMeshSpringForceField

ParallelMeshSpringForceField is the multi-threaded equivalent of MeshSpringForceField.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ParallelSpringForceField

ParallelSpringForceField is the multi-threaded equivalent of SpringForceField.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ParallelTetrahedronFEMForceField

ParallelTetrahedronFEMForceField is the multi-threaded equivalent of [TetrahedronFEMForceField](../../../../components/solidmechanics/fem/elastic/tetrahedronfemforcefield).

This implementation is the most efficient when the number of tetrahedron is large (> 1000).

The following methods are executed in parallel:
- `addDForce`
- `addKToMatrix`