Skip to content

Commit 12c405b

Browse files
authored
Merge pull request #197 from alxbilger/multithreading
dispatch component description into dedicated files
2 parents fb45e10 + ea6f0e8 commit 12c405b

8 files changed

Lines changed: 48 additions & 102 deletions

35_Plugins/50_Usual_plugins/80_MultiThreading.md

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -14,108 +14,6 @@ This pipeline requires two components for the [broad phase](../../../components/
1414
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.
1515
Both of these components can be replaced with a parallel version from the MultiThreading plugin.
1616

17-
### ParallelBruteForceBroadPhase
18-
19-
This component is a parallel implementation of [BruteForceBroadPhase](../../../components/collision/detection/algorithm/bruteforcebroadphase/) using a global thread pool.
20-
It means the result of a simulation with [BruteForceBroadPhase](../../../components/collision/detection/algorithm/bruteforcebroadphase/) or with ParallelBruteForceBroadPhase is expected to be equal.
21-
ParallelBruteForceBroadPhase is the most efficient compared to [BruteForceBroadPhase](../../../components/collision/detection/algorithm/bruteforcebroadphase/) when there is a lot of objects in the scene.
22-
23-
#### Examples
24-
25-
Examples of ParallelBruteForceBroadPhase can be found in:
26-
27-
* [ParallelBruteForceBroadPhase.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelBruteForceBroadPhase.scn)
28-
* [ParallelCollisionDetection.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelCollisionDetection.scn)
29-
* [5DeformableCubesConstraints.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/5DeformableCubesConstraints.scn)
30-
31-
### ParallelBVHNarrowPhase
32-
33-
This component is a parallel implementation of [BVHNarrowPhase](../../../components/collision/detection/algorithm/bvhnarrowphase/) using a global thread pool.
34-
It means the result of a simulation with [BVHNarrowPhase](../../../components/collision/detection/algorithm/bvhnarrowphase/) or with ParallelBVHNarrowPhase is expected to be equal.
35-
36-
#### Examples
37-
38-
Examples of ParallelBruteForceBroadPhase can be found in:
39-
40-
* [ParallelBruteForceBroadPhase.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelBruteForceBroadPhase.scn)
41-
* [ParallelCollisionDetection.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelCollisionDetection.scn)
42-
* [5DeformableCubesConstraints.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/5DeformableCubesConstraints.scn)
43-
44-
# Physics
45-
46-
## Parallel FEM
47-
48-
### ParallelTetrahedronFEMForceField
49-
50-
ParallelTetrahedronFEMForceField is the multi-threaded equivalent of [TetrahedronFEMForceField](../../../components/solidmechanics/fem/elastic/tetrahedronfemforcefield).
51-
52-
This implementation is the most efficient when the number of tetrahedron is large (> 1000).
53-
54-
The following methods are executed in parallel:
55-
- `addDForce`
56-
- `addKToMatrix`
57-
58-
#### Examples
59-
60-
Examples of ParallelTetrahedronFEMForceField can be found in:
61-
62-
* [ParallelTetrahedronFEMForceField.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelTetrahedronFEMForceField.scn)
63-
64-
### ParallelHexahedronFEMForceField
65-
66-
ParallelHexahedronFEMForceField is the multi-threaded equivalent of [HexahedronFEMForceField](../../../components/solidmechanics/fem/elastic/hexahedronfemforcefield).
67-
68-
This implementation is the most efficient when:
69-
70-
1) the number of hexahedron is large (> 1000)
71-
2) the global system matrix is not assembled. It is usually the case with a [CGLinearSolver](../../../components/linearsolver/iterative/cglinearsolver/) templated with GraphScattered types.
72-
3) the method is 'large'. If the method is 'polar' or 'small', `addForce` is executed sequentially, but `addDForce` in parallel.
73-
74-
The following methods are executed in parallel:
75-
76-
- `addForce` for method 'large'.
77-
- `addDForce`
78-
79-
The method `addKToMatrix` is not executed in parallel.
80-
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.
81-
In this case, the most time-consuming step is to invert the matrix. This is where efforts should be put to accelerate the simulation.
82-
83-
#### Examples
84-
85-
Examples of ParallelHexahedronFEMForceField can be found in:
86-
87-
* [ParallelHexahedronFEMForceField.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelHexahedronFEMForceField.scn)
88-
89-
## BeamLinearMapping_mt
90-
91-
This component inherits all the functionality from the BeamLinearMapping component and overrides three virtual functions that contain a `for` loop: `apply()`, `applyJ()` and `applyJT()`.
92-
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.
93-
If this number is lower than the number of iterations the loop won't be parallelized, and the corresponding BeamLinearMapping function is called.
94-
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.
95-
96-
### Examples
97-
98-
Examples of BeamLinearMapping_mt can be found in:
99-
100-
* [BeamLinearMapping_mt.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/BeamLinearMapping_mt.scn)
101-
102-
## Springs
103-
104-
### ParallelStiffSpringForceField
105-
106-
ParallelStiffSpringForceField is the multi-threaded equivalent of StiffSpringForceField.
107-
108-
### ParallelMeshSpringForceField
109-
110-
ParallelMeshSpringForceField is the multi-threaded equivalent of MeshSpringForceField.
111-
112-
### Examples
113-
114-
Examples of ParallelMeshSpringForceField can be found in:
115-
116-
* [ParallelMeshSpringForceField.scn](https://github.com/sofa-framework/sofa/blob/master/applications/plugins/MultiThreading/examples/ParallelMeshSpringForceField.scn)
117-
118-
11917
## Independent SOFA Scenes
12018

12119
The AnimationLoopParallelScheduler component was implemented to run the physics simulation of independent scenes in parallel.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## BeamLinearMapping_mt
2+
3+
This component inherits all the functionality from the BeamLinearMapping component and overrides three virtual functions that contain a `for` loop: `apply()`, `applyJ()` and `applyJT()`.
4+
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.
5+
If this number is lower than the number of iterations the loop won't be parallelized, and the corresponding BeamLinearMapping function is called.
6+
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.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# ParallelBVHNarrowPhase
2+
3+
This component is a parallel implementation of [BVHNarrowPhase](../../../../components/collision/detection/algorithm/bvhnarrowphase/) using a global thread pool.
4+
It means the result of a simulation with [BVHNarrowPhase](../../../../components/collision/detection/algorithm/bvhnarrowphase/) or with ParallelBVHNarrowPhase is expected to be equal.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ParallelBruteForceBroadPhase
2+
3+
This component is a parallel implementation of [BruteForceBroadPhase](../../../../components/collision/detection/algorithm/bruteforcebroadphase/) using a global thread pool.
4+
It means the result of a simulation with [BruteForceBroadPhase](../../../../components/collision/detection/algorithm/bruteforcebroadphase/) or with ParallelBruteForceBroadPhase is expected to be equal.
5+
ParallelBruteForceBroadPhase is the most efficient compared to [BruteForceBroadPhase](../../../../components/collision/detection/algorithm/bruteforcebroadphase/) when there is a lot of objects in the scene.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ParallelHexahedronFEMForceField
2+
3+
ParallelHexahedronFEMForceField is the multi-threaded equivalent of [HexahedronFEMForceField](../../../../components/solidmechanics/fem/elastic/hexahedronfemforcefield).
4+
5+
This implementation is the most efficient when:
6+
7+
1) the number of hexahedron is large (> 1000)
8+
2) the global system matrix is not assembled. It is usually the case with a [CGLinearSolver](../../../../components/linearsolver/iterative/cglinearsolver/) templated with GraphScattered types.
9+
3) the method is 'large'. If the method is 'polar' or 'small', `addForce` is executed sequentially, but `addDForce` in parallel.
10+
11+
The following methods are executed in parallel:
12+
13+
- `addForce` for method 'large'.
14+
- `addDForce`
15+
16+
The method `addKToMatrix` is not executed in parallel.
17+
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.
18+
In this case, the most time-consuming step is to invert the matrix. This is where efforts should be put to accelerate the simulation.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ParallelMeshSpringForceField
2+
3+
ParallelMeshSpringForceField is the multi-threaded equivalent of MeshSpringForceField.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ParallelSpringForceField
2+
3+
ParallelSpringForceField is the multi-threaded equivalent of SpringForceField.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ParallelTetrahedronFEMForceField
2+
3+
ParallelTetrahedronFEMForceField is the multi-threaded equivalent of [TetrahedronFEMForceField](../../../../components/solidmechanics/fem/elastic/tetrahedronfemforcefield).
4+
5+
This implementation is the most efficient when the number of tetrahedron is large (> 1000).
6+
7+
The following methods are executed in parallel:
8+
- `addDForce`
9+
- `addKToMatrix`

0 commit comments

Comments
 (0)