1 .. _parallel_compute_page:
9 This functionality is a work in progress.
11 It is only available for NETGEN.
13 It is only available in TUI.
16 The goal here is to speed up computation by running sub-meshes in parallel
22 .. image:: ../images/diagram_parallel_mesh.png
24 In order to parallelise the computation of the mesh we split the geometry into:
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
32 We will first compute sequentially the 1D+2D compound with NETGEN_1D2D.
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.
41 You follow the same principle as the creation of a sequential Mesh.
44 1. First you create the mesh:
46 .. code-block:: python
48 par_mesh = smesh.ParallelMesh(my_geom, name="par_mesh")
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:
53 .. code-block:: python
55 NETGEN_3D_Parameters_1 = smesh.CreateHypothesisByAverageLength( 'NETGEN_Parameters',
56 'NETGENEngine', 34.641, 0 )
57 par_mesh.AddGlobalHypothesis(NETGEN_3D_Parameters_1)
59 3. Set the method for the parallelisation:
61 You have two methods for parallelisation:
63 * Multihtreading: Will run the computation on your computer using the processors on your computer.
65 .. code-block:: python
67 par_mesh.SetParallelismMethod(smeshBuilder.MULTITHREAD)
70 * MultiNodal: Will run the computation on a remote resource (cluster) that is defined in your salome catalog.
72 .. code-block:: python
74 par_mesh.SetParallelismMethod(smeshBuilder.MULTINODE)
77 4. Set the parameters for the parallelism:
81 .. code-block:: python
83 param = par_mesh.GetParallelismSettings()
88 .. code-block:: python
90 param = par_mesh.GetParallelismSettings()
91 param.SetResource("cronos")
92 param.SetNbProc(nbox**3)
93 param.SetNbProcPerNode(2)
95 param.SetWcKey("P11N0:SALOME_COFEE")
98 .. code-block:: python
100 is_done = par_mesh.Compute()
102 raise Exception("Error when computing Mesh")
104 **See Also** a sample script of :ref:`tui_create_parallel_mesh`.