## 3 Parallel Computing Based on a Hybrid OpenMP-MPI Approach
### Parallelization Strategy Based on Hybrid OpenMP-MPI Approach
Figure 4: Case study 1: (**a**) one fourth of the double wall vacuum vessel and of the surface (in yellow) for the integration of the Maxwell stress tensor; (**b**) the time history of the x resultant on the tilted filament due to the toroidal field (TF). ### Case Study 2: Fusion Reactor Eddy Currents Analysis

Case study 2 is taken from a typical eddy current problem in nuclear fusion machines, associated with the fast electromagnetic transients produced by disruption of the confined plasma. The reference machine is the fusion reactor ITER [18]. By exploiting the symmetry and periodicity of the problem, the computational domain can be limited to a sector of 40\({}^{\circ}\) of the tokamak (Figure 5a). The main conducting components falling into such a sector have been modelled, such as the vacuum vessel, the thermal shield, the coils, and the supports, etc. The 3D mesh consists of 80,573 elements, 138,762 nodes, and \(N_{dof}\) = 106,544 DoFs. As pointed out, the boundary conditions impose cyclic symmetry at \(\pm\)20\({}^{\circ}\). Table 4 provides the computed costs of the assembly of \(\mathbf{L}\) (task b). As a reference case, here we have assumed the choice of 22 OpenMP threads and 1 MPI task per node. The reference time is 16,064 s. Table 5 reports the speed up values for the inversion of \(\mathbf{Z}\) (task d), with the reference solution given by 22 OpenMP threads and 2 MPI tasks per node, with 2 nodes. The reference time is here 907 s. Once again, the behavior of the speed-up scale is quite linear when increasing the number of nodes, with a limited degradation. Comparing the reference time for task b (assembly of \(\mathbf{L}\)) and task d (inversion), we observe that this case study is another example where the inversion time is much smaller than the assembly one, as already pointed out in Section 2 and in discussing the benchmark case study. In addition, the numerical solution of problems such as those in case studies 1 and 2 exploits the symmetry of the machines, thus limiting the solution domain to a sector. Moreover, the periodic symmetric conditions require considering \(n\) replicas of the DoF

Figure 5: Case study 2: (**a**) a 40\({}^{\circ}\) sector of ITER magnet system; (**b**) distribution of ohmic power density at a given time instant during the considered transient event. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**OpenMP** & **10 Nodes** & **20 Nodes** & **40 Nodes** \\
**Threads per Node** & **2 MPI per Node** & **2 MPI per Node** & **1 MPI per Node** \\ \hline \(1\) (reference) & 1 (reference) & 1.99 & 1.99 \\ \(5\) & 4.96 & 9.85 & 9.88 \\ \(10\) & 9.86 & 19.7 & 19.7 \\ \(15\) & 14.8 & 29.5 & 23.2 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Case study 1: speed-up values for task (c) with OpenMP-MPI on MARCONI Cluster. during the assembly phase, thus increasing the corresponding time, without affecting the inversion time. ## 5 Conclusions

A hybrid parallel computation approach implementing the joint use of MPI and OpenMP paradigms is here implemented and applied to challenging numerical magneto-quasi-static (MQS) problems. The approach has been used to parallelize the assembly of the inductance matrix: it has been shown that this task may be cost demanding as well as involving the task of matrix inversion, when high accuracy is required in the solution of MQS problems (for instance, when using 2 or more integration Gauss points). The pure MPI and the hybrid OpenMP-MPI approaches have been theoretically compared in terms of their computational performance in assembling such a matrix. The hybrid OpenMP-MPI approach saves resources (since it requires a lower number of nodes for a fixed computational time) and provides better performance (it requires lower times for fixed number of nodes). The analyzed case studies demonstrate speed-up values up to about \(50\times\).