Salome HOME
Adding Multinode method for smesh parallelism + cleanup and doc
[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 1. First you create the mesh:
47
48         .. code-block:: python
49
50                 par_mesh = smesh.ParallelMesh(my_geom, name="par_mesh")
51
52 2. Define the Global Hypothesis that will be split into an hypothesis for the
53    1D+2D compound and one for each of the 3D solids:
54
55   .. code-block:: python
56
57                 NETGEN_3D_Parameters_1 = smesh.CreateHypothesisByAverageLength( 'NETGEN_Parameters',
58                                                  'NETGENEngine', 34.641, 0 )
59                 par_mesh.AddGlobalHypothesis(NETGEN_3D_Parameters_1)
60
61 3. Set the method for the parallelisation:
62
63   You have two methods for parallelisation:
64
65   * Multihtreading: Will run the computation on your computer using the processors on your computer.
66
67   .. code-block:: python
68
69      par_mesh.SetParallelismMethod(smeshBuilder.MULTITHREAD)
70
71
72   * MultiNodal: Will run the computation on a remote resource (cluster) that is defined in your salome catalog.
73
74   .. code-block:: python
75
76      par_mesh.SetParallelismMethod(smeshBuilder.MULTINODE)
77
78
79 4.  Set the parameters for the parallelism:
80
81   *  Multithread:
82
83         .. code-block:: python
84
85                 param = par_mesh.GetParallelismSettings()
86                 param.SetNbThreads(6)
87
88   * Multinode:
89
90   .. code-block:: python
91
92      param = par_mesh.GetParallelismSettings()
93      param.SetResource("cronos")
94      param.SetNbProc(nbox**3)
95      param.SetNbProcPerNode(2)
96      param.SetNbNode(6)
97      param.SetWcKey("P11N0:SALOME_COFEE")
98
99 5. Compute the mesh:
100         .. code-block:: python
101
102                 is_done = par_mesh.Compute()
103                 if not is_done:
104                     raise Exception("Error when computing Mesh")
105
106 **See Also** a sample script of :ref:`tui_create_parallel_mesh`.