Salome HOME
fecbf2fea1b70be8ac688979df395ef0d277b563
[modules/smesh.git] / doc / gui / input / parallel_compute.rst
1 .. _parallel_compute_page:
2
3 ******************
4 Parallel Computing
5 ******************
6
7
8 .. warning::
9   This functionality is a work in progress.
10
11   It is only available for NETGEN.
12
13   It is only available in TUI.
14
15
16 The goal here is to speed up computation by running sub-meshes in parallel
17 (multi-threading).
18
19 *******
20 Concept
21 *******
22
23 .. image:: ../images/diagram_parallel_mesh.png
24
25 In order to parallelise the computation of the mesh we split the geometry into:
26
27   * A 1D+2D compound
28   * A list of 3D solids
29
30 Then create a sub-mesh for each of those geometry.
31 And associate Hypothesis to the mesh using a hypothesis on the whole geometry
32
33 We will first compute sequentially the 1D+2D compound with NETGEN_1D2D.
34
35 Then we will compute all the solids in parallel. Having done the 1D+2D first
36 ensure that all the solids can be computed without any concurrency.
37
38
39 ******
40 How to
41 ******
42
43 You follow the same principle as the creation of a sequential Mesh.
44
45
46 #. First you create the mesh:
47         .. code-block:: python
48
49                 par_mesh = smesh.ParallelMesh(geom, name="par_mesh")
50
51 #. Define the Global Hypothesis that will be split into an hypothesis for the
52    1D+2D compound and one for each of the 3D solids:
53         .. code-block:: python
54
55                 NETGEN_3D_Parameters_1 = smesh.CreateHypothesisByAverageLength( 'NETGEN_Parameters',
56                                                  'NETGENEngine', 34.641, 0 )
57                 par_mesh.AddGlobalHypothesis(netgen_parameters)
58
59 #. Set the parameters for the parallelisation:
60         .. code-block:: python
61
62                 param = par_mesh.GetParallelismSettings()
63                 param.SetNbThreads(6)
64
65 #. Compute the mesh:
66         .. code-block:: python
67
68                 mesh.Compute()
69
70 **See Also** a sample script of :ref:`tui_create_parallel_mesh`.