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
23 .. image:: ../images/diagram_parallel_mesh.png
25 In order to parallelise the computation of the mesh we split the geometry into:
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
33 We will first compute sequentially the 1D+2D compound with NETGEN_1D2D.
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.
43 You follow the same principle as the creation of a sequential Mesh.
46 1. First you create the mesh:
48 .. code-block:: python
50 par_mesh = smesh.ParallelMesh(my_geom, name="par_mesh")
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:
55 .. code-block:: python
57 NETGEN_3D_Parameters_1 = smesh.CreateHypothesisByAverageLength( 'NETGEN_Parameters',
58 'NETGENEngine', 34.641, 0 )
59 par_mesh.AddGlobalHypothesis(NETGEN_3D_Parameters_1)
61 3. Set the method for the parallelisation:
63 You have two methods for parallelisation:
65 * Multihtreading: Will run the computation on your computer using the processors on your computer.
67 .. code-block:: python
69 par_mesh.SetParallelismMethod(smeshBuilder.MULTITHREAD)
72 * MultiNodal: Will run the computation on a remote resource (cluster) that is defined in your salome catalog.
74 .. code-block:: python
76 par_mesh.SetParallelismMethod(smeshBuilder.MULTINODE)
79 4. Set the parameters for the parallelism:
83 .. code-block:: python
85 param = par_mesh.GetParallelismSettings()
90 .. code-block:: python
92 param = par_mesh.GetParallelismSettings()
93 param.SetResource("cronos")
94 param.SetNbProc(nbox**3)
95 param.SetNbProcPerNode(2)
97 param.SetWcKey("P11N0:SALOME_COFEE")
100 .. code-block:: python
102 is_done = par_mesh.Compute()
104 raise Exception("Error when computing Mesh")
106 **See Also** a sample script of :ref:`tui_create_parallel_mesh`.