diff --git a/35_Plugins/50_Usual_plugins/80_MultiThreading.md b/35_Plugins/50_Usual_plugins/80_MultiThreading.md index 793a2b359..b7409cb9d 100644 --- a/35_Plugins/50_Usual_plugins/80_MultiThreading.md +++ b/35_Plugins/50_Usual_plugins/80_MultiThreading.md @@ -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. diff --git a/35_Plugins/50_Usual_plugins/MultiThreading/BeamLinearMapping_mt.md b/35_Plugins/50_Usual_plugins/MultiThreading/BeamLinearMapping_mt.md new file mode 100644 index 000000000..0dc98a017 --- /dev/null +++ b/35_Plugins/50_Usual_plugins/MultiThreading/BeamLinearMapping_mt.md @@ -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. diff --git a/35_Plugins/50_Usual_plugins/MultiThreading/ParallelBVHNarrowPhase.md b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelBVHNarrowPhase.md new file mode 100644 index 000000000..001237907 --- /dev/null +++ b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelBVHNarrowPhase.md @@ -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. diff --git a/35_Plugins/50_Usual_plugins/MultiThreading/ParallelBruteForceBroadPhase.md b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelBruteForceBroadPhase.md new file mode 100644 index 000000000..09d10c7bf --- /dev/null +++ b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelBruteForceBroadPhase.md @@ -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. diff --git a/35_Plugins/50_Usual_plugins/MultiThreading/ParallelHexahedronFEMForceField.md b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelHexahedronFEMForceField.md new file mode 100644 index 000000000..755eb0c44 --- /dev/null +++ b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelHexahedronFEMForceField.md @@ -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. diff --git a/35_Plugins/50_Usual_plugins/MultiThreading/ParallelMeshSpringForceField.md b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelMeshSpringForceField.md new file mode 100644 index 000000000..efff71511 --- /dev/null +++ b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelMeshSpringForceField.md @@ -0,0 +1,3 @@ +# ParallelMeshSpringForceField + +ParallelMeshSpringForceField is the multi-threaded equivalent of MeshSpringForceField. diff --git a/35_Plugins/50_Usual_plugins/MultiThreading/ParallelStiffSpringForceField.md b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelStiffSpringForceField.md new file mode 100644 index 000000000..8957ec9d1 --- /dev/null +++ b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelStiffSpringForceField.md @@ -0,0 +1,3 @@ +# ParallelSpringForceField + +ParallelSpringForceField is the multi-threaded equivalent of SpringForceField. diff --git a/35_Plugins/50_Usual_plugins/MultiThreading/ParallelTetrahedronFEMForceField.md b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelTetrahedronFEMForceField.md new file mode 100644 index 000000000..701db5828 --- /dev/null +++ b/35_Plugins/50_Usual_plugins/MultiThreading/ParallelTetrahedronFEMForceField.md @@ -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`