Salome HOME
[bos #32739][CEA] 3D warp
[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 Concept
20 #######
21
22 .. image:: ../images/diagram_parallel_mesh.png
23
24 In order to parallelise the computation of the mesh we split the geometry into:
25
26   * A 1D+2D compound
27   * A list of 3D solids
28
29 Then create a sub-mesh for each of those geometry.
30 And associate Hypothesis to the mesh using a hypothesis on the whole geometry
31
32 We will first compute sequentially the 1D+2D compound with NETGEN_1D2D.
33
34 Then we will compute all the solids in parallel. Having done the 1D+2D first
35 ensure that all the solids can be computed without any concurrency.
36
37
38 How to
39 ######
40
41 You follow the same principle as the creation of a sequential Mesh.
42
43
44 1. First you create the mesh:
45
46         .. code-block:: python
47
48                 par_mesh = smesh.ParallelMesh(my_geom, name="par_mesh")
49
50 2. Define the Global Hypothesis that will be split into an hypothesis for the
51    1D+2D compound and one for each of the 3D solids:
52
53   .. code-block:: python
54
55                 NETGEN_3D_Parameters_1 = smesh.CreateHypothesisByAverageLength( 'NETGEN_Parameters',
56                                                  'NETGENEngine', 34.641, 0 )
57                 par_mesh.AddGlobalHypothesis(NETGEN_3D_Parameters_1)
58
59 3. Set the method for the parallelisation:
60
61   You have two methods for parallelisation:
62
63   * Multihtreading: Will run the computation on your computer using the processors on your computer.
64
65   .. code-block:: python
66
67      par_mesh.SetParallelismMethod(smeshBuilder.MULTITHREAD)
68
69
70   * MultiNodal: Will run the computation on a remote resource (cluster) that is defined in your salome catalog.
71
72   .. code-block:: python
73
74      par_mesh.SetParallelismMethod(smeshBuilder.MULTINODE)
75
76
77 4.  Set the parameters for the parallelism:
78
79   *  Multithread:
80
81         .. code-block:: python
82
83                 param = par_mesh.GetParallelismSettings()
84                 param.SetNbThreads(6)
85
86   * Multinode:
87
88   .. code-block:: python
89
90      param = par_mesh.GetParallelismSettings()
91      param.SetResource("cronos")
92      param.SetNbProc(nbox**3)
93      param.SetNbProcPerNode(2)
94      param.SetNbNode(6)
95      param.SetWcKey("P11N0:SALOME_COFEE")
96
97 5. Compute the mesh:
98         .. code-block:: python
99
100                 is_done = par_mesh.Compute()
101                 if not is_done:
102                     raise Exception("Error when computing Mesh")
103
104 **See Also** a sample script of :ref:`tui_create_parallel_mesh`.