text stringlengths 128 2.05k |
|---|
[MATH] and [MATH] , an additional equation is solved to obtain the subgrid scale [MATH] A typical assembly for the grid scale equations consists in a loop over the elements of the mesh, as shown in Algorithm |
1: for elements [MATH] do 2: Compute element matrix and RHS: [MATH] [MATH] 3: Assemble matrix [MATH] into [MATH] 4: Assemble RHS [MATH] into [MATH] |
5: end for Algorithm 1 Assembly of a generic matrix [MATH] and vector [MATH] 2.1.2 Algebraic system solution After the assembly step, the following monolithic algebraic system for the grid scale unknowns, velocity [MATH] and pressure [MATH] , is obtained: |
[EQUATION] This system can be solved directly using a Krylov solver and efficient preconditioner . However, an algebraic-split approach is used instead in this work. We extract the pressure Schur complement of the pressure unknown [MATH] |
and solve it with the Orthomin(1) method, as detailed in . The resulting algorithm is shown in Algorithm 1: Solve momentum eqn [MATH] |
2: Compute Schur complement residual [MATH] 3: Solve continuity eqn [MATH] 4: Solve momentum eqn [MATH] 5: Compute [MATH] 6: Compute [MATH] |
7: Update velocity and pressure [EQUATION] Algorithm 2 Algebraic solver: Orthomin(1) method for the pressure Schur complement. In the algorithm, matrix [MATH] is the pressure Schur complement preconditioner, computed here as an algebraic approximation of the Uzawa operator, and as explained |
. On the one hand, the momentum equation is solved with the GMRES method and diagonal preconditioning in steps and of the algorithm. On the other hand, the continuity equation is solved with the Deflated Conjugate Gradient (DCG) method |
with linelet preconditioning in step of the algorithm. The deflation provides a low frequency damping across the domain, especially very efficient for the case study considered in this work, where the geometry is elongated. The linelet preconditioner consists of a tridiagonal preconditioner applied in the normal direct... |
At each time step, this system is solved until convergence is achieved. Convergence is necessary because the original equation is non-linear (the convective term makes matrix [MATH] depend on |
[MATH] itself). For any information concerning the parallel solution system on distributed memory supercomputers, see Only a brief description will be given herein in Section 3.1 |
2.1.3 Subgrid scale Once the velocity [MATH] and pressure [MATH] are obtained on the nodes of the mesh, the velocity subgrid scale vector is obtained through a general equation of the form |
[EQUATION] where [MATH] is the so-called stabilization diagonal matrix and [MATH] is the residual rectangular matrix, as the subgrid scale is obtained element-wise and not node-wise. Both [MATH] and [MATH] may depend on |
[MATH] and thus Equation 13 can be non-linear. Note finally that in practice, [MATH] is obtained via a simple loop over the elements of the mesh and the system of the equation does not need to be explicitly formed. |
2.1.4 Solution strategy In practice, the iterations of the Orthomin(1) iterative solver to solve for the pressure Schur complement are coupled to the non-linearity iterations of the Navier-Stokes equations, which include not only the convective term but also the subgrid scale. The resulting workflow is shown in Algorit... |
1: for time steps do 2: while until convergence do 3: Assemble global matrices and RHS of Equation using Algorithm 4: Solve momentum equation with GMRES, step of Algorithm |
5: Solve continuity equation with DCG, step of Algorithm 6: Solve momentum equation with GMRES, step of Algorithm 7: Compute subgrid scale using Equation 13 |
8: end while 9: end for Algorithm 3 Solution strategy for solving Navier-Stokes equations. The workflow consists of three main computational kernels. The assembly which carries out operations on the elements of the mesh in order to construct the algebraic system; the algebraic solver , that is the algorithm for the pre... |
2.1.5 Case example: respiratory system For the evaluation of the different techniques described in the following sections we will consider the case of the respiratory system, similar to that described in |
The mesh is hybrid and composed of 17.7 million elements: prisms to resolve accurately the boundary layer; tetrahedra in the core flow; pyramids to enable the transition from prism quadrilateral faces to tetrahedra. This kind of mesh is quite representative in fluid dynamics, as most of the fluid problems of interest i... |
2.2 Structure solver The structure mechanics solver is extensively described in . For the sake of completeness, we will only briefly describe the set of equations to be solved. |
2.2.1 Physical and Numerical models The equation of balance of momentum with respect to the reference configuration can be written as |
[EQUATION] where [MATH] is the mass density (with respect to the reference volume) and [MATH] is the divergence operator with respect to the reference configuration. Tensor [MATH] and vector [MATH] stand for the first Piola-Kirchhoff stress and the distributed body force on the undeformed body, respectively. Equation 1... |
To discretize this equation, the Galerkin method is used in space and the Newmark method in time. A Newton-Raphson method is used to solve the linearized system. For each time step, and until convergence, one has to assemble the algebraic system using Algorithm (where [MATH] is the Jacobian and [MATH] is the residual o... |
2.2.2 Case example: Iter The mesh is a slice of a torus shaped chamber, representing the center part of a nuclear fusion reactor called the vacuum vessel. In Figure we can see the representation of the mesh made of 31.5 million hexahedra, prisms, pyramids and tetrahedra elements. |
Parallelization of Algebraic System Assembly For the sake of completeness, this section describes briefly the classical parallelization techniques of a finite element assembly in an HPC environment. |
3.1 Distributed Memory Parallelization Using MPI In the finite element context, two options are available when defining a distributed memory parallelization, which we refer to as partial-row and full-row methods |
In the finite difference context or in the finite volume context using a cell centered discretization scheme, the second method is generally considered, as it emerges naturally. |
In the finite element community, the partial-row method is quite natural when partitioning the original element set (mesh) into disjoint subsets of elements (subdomains). In this case, nodes belonging to several subdomains (interface nodes) are duplicated. As the matrix coefficients come from element integrations, the ... |
[MATH] . Thus, there is no need for obtaining these global coefficients, as the result [MATH] can be computed locally on each subdomain and then assembled later on interface nodes using MPI send and receive messages (by associativity of the multiplication operation). |
The full-row approach consists in assigning nodes exclusively to one subdomain. This strategy leads to local rectangular matrices, and these matrices are fully assembled blocks of rows of the global matrix. Two options are thus possible. A first option in which the global matrix coefficients of the interface nodes can ... |
A second option in which the mesh is partitioned into disjoint subsets of nodes. The full rows of the matrix are thus obtained by assigning all the necessary elements to the subdomains in order to get all the element contributions. In this case, interface elements must be duplicated (halo elements), leading to duplicat... |
The advantage of the partial-row approach is that the load balance of the assembly can be controlled, in principle, when partitioning the mesh. With partitioners like METIS |
, the number of elements per subdomain can in addition be constrained with the minimization of the interface sizes. The main drawback is that while balancing the number of elements per subdomain, one loses control on the number of nodes, which dictates the balance of SpMV. On the other hand, the presence of halo elemen... |
When considering hybrid meshes, an additional difficulty arises, as one has to estimate the relative weights of the different element types in order to balance the total weight per subdomain, as we will show in Section Thus, no matter if full-row or partial-row is ultimately chosen, load imbalance will occur before sta... |
, while load imbalance will be treated in Section 3.2 Shared Memory Parallelization Using OpenMP 3.2.1 Loop parallelism During the last decade, the predominance of general purpose clusters have obliged parallel code designers to devise distributed memory techniques, mainly based on MPI, as briefly described in last sub... |
All of these techniques are based on loop parallelism, each of them offering different advantages and drawbacks. The main issue is the race condition appearing in the assembly scattering the element arrays [MATH] and [MATH] into the local ones, |
[MATH] and [MATH] The first method consists in avoiding the race condition using ATOMIC pragmas to protect these shared variables (Figure (left)). The cost of the ATOMIC limits the scalability of the assembly. This strategy is shown in Algorithm |
do 6: Compute element matrix and RHS: [MATH] [MATH] 7: !$OMP ATOMIC 8: Assemble matrix [MATH] into [MATH] 9: !$OMP ATOMIC 10: Assemble RHS [MATH] into [MATH] |
11: end for Algorithm 4 Matrix Assembly without coloring in each MPI partition In the context of vectorization, the element coloring technique has been proposed |
. By coloring elements such that elements with the same color do not share nodes, no ATOMIC is required to protect [MATH] and [MATH] . The main drawback of this method is that any spatial locality of data is lost which implies a low IPC (instructions per cycle). In the performance evaluation based in hardware counters ... |
1: Partition local mesh in [MATH] subdomains using a coloring strategy 2: for [MATH] do 3: !$OMP PARALLEL DO & 4: !$OMP SCHEDULE (DYNAMIC,Chunk_Size) & |
5: !$OMP PRIVATE (...) & 6: !$OMP SHARED (...) 7: for elements [MATH] in [MATH] do 8: Compute element matrix and RHS: [MATH] [MATH] |
9: Assemble matrix [MATH] into [MATH] 10: Assemble RHS [MATH] into [MATH] 11: end for 12: !$OMP END PARALLEL DO 13: end for Algorithm 5 |
Matrix assembly with coloring in each MPI partition To circumvent these two inconveniences, local partitioning techniques (in each MPI partition independently) have been proposed |
Here, classical partitioners like METIS or Space Filling Curve based partitioners can be used. Elements are assigned to subdomains, and subdomains are unconnected through separators (layer of elements) such that elements of neighboring subdomains do not share nodes. By assigning elements to a subdomain, the loop over e... |
1: Partition local mesh in [MATH] subdomains using METIS 2: for [MATH] do 3: !$OMP PARALLEL DO & 4: !$OMP SCHEDULE (DYNAMIC,Chunk_Size) & |
9: Assemble matrix [MATH] into [MATH] 10: Assemble RHS [MATH] into [MATH] 11: end for 12: !$OMP END PARALLEL DO 13: end for 14: Treat separators |
Algorithm 6 Matrix assembly with local partitioning in each MPI partition We can observe the similitude between the loops of the coloring and local partitioning techniques. The differences are in the way the subdomains are obtained (coloring vs METIS) and the existence of separators in the local partitioning technique. |
3.2.2 Task parallelism It is possible to implement another strategy by forgoing the loop parallelism approaches shown above and using a task parallelism approach instead. |
As of OpenMP 3.0 a new tasking model was introduced which allows the OpenMP programmer to parallelize a set of problems with irregular parallelism. When a thread of the OpenMP program encounters a TASK construct it creates a task which is then run by one of the threads of the parallel region. In principle the order, i.... |
While intuitive, the dependency approach based on input and output dependences is too strict for a problem like the finite element assembly. It forces the runtime to determine a particular order (necessarily influenced by the task creation order) that fulfills the dependences when executing the tasks. |
The research in the OmpSs programming model led to the proposal of a new kind of dependency between tasks called COMMUTATIVE . This new dependency kind means that two tasks cannot be run concurrently if they refer to the same data object but does not impose any other restriction in the particular order in which such ex... |
A further complication exists, though, for the current dependency support in OpenMP 4.0 implies that the number of dependences is statically defined at compile time. This is inconvenient as each subdomain may have a variable number of neighbors. To address this we use the multidependences extensions in which each task ... |
In this way, the tasking parallelization is possible by first computing the adjacency list of each subdomain. Figure depicts this idea, where the subdomain 3 has 5 neighbors (including itself). Given that adjacency list, it is then possible to use a COMMUTATIVE multidependence on the neighbors. This causes the runtime ... |
As subdomains are processed, less of them will remain and the parallelism available will decrease. It is possible to get higher concurrency levels if, of all the non-neighboring subdomains, we first process those with a bigger number of neighbors: intuitively this potentially can free more subdomains that are not neigh... |
Algorithm shows the final task parallelization. For each subdomain: we create a task (step ); then we declare a commutative dependency with all its neighbors (step ); we prioritize tasks with a higher number of neighbors (step ). These tasks are created by a single thread inside of a parallel region (not shown in the l... |
1: Partition local mesh in [MATH] subdomains of size Chunk_Size 2: Store connectivity graph of subdomains in structure [MATH] 3: for |
[MATH] do 4: [MATH] 5: !$OMP TASK & 6: !$OMP COMMUTATIVE 7: ([subd(subd%lneig(i)), i=1,nneig]) & 8: !$OMP PRIORITY (nneig) & 9: !$OMP PRIVATE (...) & |
10: !$OMP SHARED (subd, ...) 11: for Elements [MATH] in [MATH] do 12: Compute element matrix and RHS: [MATH] [MATH] 13: Assemble matrix [MATH] into [MATH] |
14: Assemble RHS [MATH] into [MATH] 15: end for 16: !$OMP END TASK 17: end for 18: !$OMP TASKWAIT Algorithm 7 Matrix assembly with commutative multidependences in each MPI partition |
Dynamic Load Balancing 4.1 MPI Load Imbalance As we explained in Section 3.1 , using an MPI parallelization implies partitioning the original mesh into [MATH] subdomains. The essential characteristic of MPI is that it works on distributed memory, thus, each MPI process will work on the data in its subdomain. This fact ... |
The mesh partitioning software provides, in general, load balancing features which necessarily are based on optimizing a metric. As we discussed in the introduction, the main computational tasks of a CFD and structure mechanics codes are the algebraic system assembly and the iterative solver. |
We want to obtain a partition that ensures load balance in the matrix assembly. But in hybrid meshes the number of elements might not be a good metric to measure the load balance, as their relative weights in constructing the matrix may be different. |
In this paper we focus on the assembly phase, for this reason we want to obtain a partition that achieves a well balanced distribution of elements among the different MPI processes. In a hybrid mesh, the computational loads of different elements are not the same. As a intuitive guess, we will assign as a weight to each... |
We define Load Balance as the percentage of time that the computational resources are doing useful computation: {EQ} Load Balance Useful CPU time Total CPU time |
= ∑ i=1 n ⋅max i=1 Let us define [MATH] the weight of element [MATH] and [MATH] the number of elements of partition [MATH] . We define two theoretical load balance (LB) measures: the non-weighted load balance which is the ratio of the average number of elements to the maximum number of elements, as well as the |
weighted load balance , which represents the same including the weights given to METIS (that is what METIS load balances). We also introduce the measured load balance obtained by measuring the elapsed time ( [MATH] ) of each MPI task in the assembly or subgrid scale loop and dividing the average by the maximum of the e... |
{EQ} [llll] Theo. weighted LB (∑ MPI ) / n MPI max ( ∑ ), Theo. non-weighted LB ( ∑ MPI ) / n MPI max Measured LB ( ∑ MPI time ) / n MPI max (time ). |
Figures and show the load balance measured for the two use cases presented in the previous section. The X axis represents the number of MPI partitions used for each simulation. The different values have been computed using the formulas presented above and the Measured LB |
has been measured from an execution of the simulation and averaged over 10 time steps. We first observe that METIS provides a fairly good load balance based on the heuristic provided for both meshes (weighted LB), even though an imbalance up to [MATH] is observed for 512 partitions in the respiratory system. We can say... |
But if we compare this theoretical result with the measured one, we can see a significant difference. In practice the load imbalance increases with the number of partitions, specially for the Respiratory system, for both the assembly and for the subgrid scale element loops (which are quite similar). We conclude that th... |
Finally, let us take a look at typical partitions and traces. Figures 7(a) and 8(a) shows some statistics of the partitions for the fluid and solid problems using 256 CPUs. The nodes are placed at the centers of gravity of the MPI subdomains, while the edges represent neighboring relations. We observe that in the case ... |
The associated traces are shown in Figures 7(b) and 8(b) In the case of the Respirartory system, we can easily identify the subdomains responsible for the load imbalance, near the bottom of the trace. These are the subdomains mentioned previously, in the front face region. This is because the element weight based on th... |
In the case of the Iter simulation, we can observe that we have some subdomains with much less work than others. Once more, this indicates that the weights based on Gauss points is not a good heuristic for load, although it affects much less the load balance than for the fluid simulation. |
4.2 DLB library Load imbalance is a concern that has been targeted since the beginning of parallel programming. In the literature, we can see that it has been attacked from very different points of view (data partition, data redistribution, resource migration, etc.). |
In this case we are using METIS to partition the mesh and obtain a balanced distribution among MPI tasks. But as we have seen in the previous section, the actual load balance obtained is far from optimal. There are several reasons for this, the geometry of the mesh and the weight of the elements given to METIS. |
Additionally, the algorithm or the physics (or both together) could produce very strong work imbalance by increasing the computing needs locally (i.e. particle concentrations |
, solid mechanics fracture, shock in compressible flows, etc.) For these reasons, we opt for a dynamic approach applied at runtime, with no need for an a-priori imbalance analysis. |
In this work we will use DLB (Dynamic Load Balancing Library). The DLB library aims at balancing MPI applications using a second level of parallelism (i.e. Hybrid parallelization MPI+OpenMP). Currently, the implemented modules balance hybrid MPI + OpenMP and MPI + OmpSs applications, where MPI is the outer level of par... |
An important feature of the DLB library is that a runtime interposition technique is used to intercept MPI calls. With this technique we do not need to modify the application, the DLB library is loaded dynamically when running the application to load balance the execution. |
The DLB library will reassign the computational resources (i.e. cores) of an MPI process waiting in an MPI blocking call, to another MPI process running on the same node that it is still doing computation. |
Figure illustrates the load balancing process. In the example, the application is running on a node with 4 cores. Two MPI tasks are started on the same node, and each MPI task spawns 2 OpenMP threads (represented by the wavy lines). Eventually, an MPI blocking operation (in green) synchronizes the execution. Regarding ... |
On the one hand, Figure (Left) shows the behavior of an unbalanced application where the excessive work of the threads running on core3 and core4 delays the execution of the MPI call. On the other side, Figure (Right) shows the execution of the same application with the DLB library. We can see that when the MPI task 1 ... |
The fact that DLB relies on the shared memory to load balance the different MPI tasks means that it needs to run more than one MPI task per node. In current many-cores architectures this is the normal trend |
The dynamic load balancing algorithm illustrated previously relies on the OpenMP parallelization. One important characteristic of this strategy is that not the whole application needs to be fully parallelized, as the second level of parallelism can be introduced only for load balancing purposes, in the main imbalanced ... |
Performance Evaluation 5.1 Environment and Methodology All the experiments presented in Section have been executed on MareNostrum 3 supercomputer. Each node of MareNostrum 3 is composed of two Intel Xeon processors (E5-2670), each of this two sockets includes 8 cores and 16 GB of main memory. In total each compute node... |
We have used the Intel MPI library version 4.1.3 and as the underlying Fortran compiler Intel 13.0.1. For OpenMP we have used Nanos 0.12 |
with the source to source compiler Mercurium 2.0 . For the dynamic load balancing we have used the DLB library 1.3. We have executed the experiments on 16, 32 and 64 nodes of MareNostrum 3 that correspond to 256, 512 and 1024 cores, respectively. For each experiment we will consider 5 different configurations of MPI pr... |
1x16: 1 MPI process with 16 threads, this is the pure hybrid approach, where MPI is used across nodes and OpenMP/OmpSs inside the shared memory node. In this configuration, DLB cannot load balance, but we show it for completeness. |
2x8: 2 MPI processes with 8 threads each. This is another typical configuration when running in nodes with two sockets, each MPI process is mapped to one socket, and 8 threads are spawn on each socket. |
4x4: 4 MPI processes with 4 threads each. 8x2: 8 MPI processes with 2 threads each. 16x1: 16 MPI processes with 1 thread each. In this case, the shared memory level is only used for load balancing. This configuration is useful when the application is not fully parallelized with OpenMP/OmpSs and it is launched as a pure... |
Pure MPI: As a reference we show the performance of the pure MPI version of the application, in this case 16 MPI processes are launched on each node. |
For each experiment we will execute different versions, in Table we present detailed summary of each data series that we will see in the charts. |
We have divided the evaluation into four parts: Chunk size: In this section we will study the impact of the chunk size on the performance of the different parallelizations and when using DLB. From this evaluation, we will try to find the optimum chunk size, and use it for the following experiments. |
Execution Time: In this evaluation we will show the performance obtained by the three shared memory parallelization alternatives: No Coloring, Coloring, and Multidependencies, in terms of elapsed execution time. We will also see the impact in performance of using the dynamic load balancing mechanism. |
Hardware Counters: In this section we demonstrate our hypothesis in the performance of each parallelization, based in the different hardware counters collected during the execution. |
Scalability: Finally we will present some scalability tests of the Respiratory system simulations using up to 16K cores of MareNostrum 3. |
5.2 Chunk Size Study In this section, we want to evaluate the impact of the chunk size on the performance of the different parallelization alternatives and DLB. In OpenMP the chunk size determines the number of iterations (in our test case one iteration corresponds to the computation of one element) that are executed s... |
All the experiments have been executed with 16 MPI processes per node and 1 thread per process. With this configuration, we want to evaluate the impact of the chunk duration, the amount of chunks in the queue and the impact in the malleability when using DLB. Using only one thread will avoid seeing the overhead of seve... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.