## 3 Parallel Computing Based on a Hybrid OpenMP-MPI Approach
### Parallelization Strategy Based on Hybrid OpenMP-MPI Approach
```
// Initialization Split Source Point between MPI process // Parallel pure MPI computation for each MPI process do  for each rel mesh element point do #pragma omp parallel for #pragma ompreduction(+:V0 loc) for each iel0 source mesh element do  compute V0_loc endfor endfor // Synchronization point mpi barrier // All reduce of the local contribute on the global V0 mpi_allreduce(V0_loc,V0_global)
```  
**Algorithm 4** Evaluation of **V0**, hybrid OpenMP-MPI Approach  
```
// Initialization Split Source Point between MPI process // Parallel pure MPI computation for each MPI process do  for each rel mesh element point do #pragma omp parallel for #pragma ompreduction(+:V0 loc) for each iel0 source mesh element do  compute V0_loc endfor endfor // Synchronization point mpi barrier // All reduce of the local contribute on the global V0 mpi_allreduce(V0_loc,V0_global)
```  
**Algorithm 5** Assembly of **L** matrix, hybrid OpenMP-MPI approach  
```
Equally distribute element-element interactions among MPI processes // Initialization for each MPI process do  Allocate dummy memory MdMesh  Allocate dummy memory MdLE  Allocate dummy memory MdEE endfor for for each MPI process do  Broadcast the geometrical information endfor // Hybrid MPI openMP computation for each MPI process do  Declare MdEE as private for each thread #pragma omp parallel for each element iell do  for each element iel2 do  Compute local iell-iel2 interactions  Compute the local interactions on a private dummy mem. MdEE #pragma omp critical  Accumulate the local interactions on the shared mem. MdL endfor endfor endfor for each MPI process  Allocate local memory Mloc endfor //Final Communications Step for each MPI process do  Send and receive the local matrices MdL  Accumulate the contribute on Mloc endfor  deallocate(MdMesh, MdEE,MdL
```
// Initialization  Equally, distribute field points among MPI process  Broadcast the geometrical information // MPI OpenMP computation for each MPI process do for each cell mesh element do #pragma omp parallel for each ifp field point do  Compute Magnetic Field or Vector potential  Accumulate the values endfor endfor endfor //Final allreduce  mpi_allreduce(MagField,Vector potential)
```

**Algorithm 6** Evaluation of **Q** matrix, hybrid OpenMP-MPI Approach

## 4 Case Studies and Discussion

The hybrid OpenMP-MPI approach presented in this paper has been implemented in two parallel computing systems with different characteristics: a proprietary system (SUNCUDA Cluster) and a supercomputing facility (MARCONI Cluster) [28]. The details of such systems are given in Table 1. Note that the proposed hybrid paradigm is general and can be applied to computing systems with different features. ### A Benchmark Case Study

A preliminary case, that is studied as a benchmark, refers to the simple MQS problem described in Figure 3, with a pancake coil that is inducing currents into a nearby conducting plate. The numerical model of the MQS problem is characterized by a mesh with 13,500 elements, 15,376 points, and 25,650 DoFs. Although the size is not so large to require a parallel computation approach, we analyse this case study with the only scope of comparing the performance of OpenMP only and OpenMP-MPI approaches. The assembly of V0 and L (tasks (a) and (b) defined in Section 2) have been performed by using both OpenMP only and OpenMP-MPI approaches, and the results are provided in Table 2. Specifically, the speed-up obtained has been evaluated with respect to the use of 1 OpenMP thread and 1 MPI node, that is assumed as the reference. The computation times for the reference case are 8.93 s and 2693 s for tasks (a) and (b), respectively. Table 2 shows an almost linear increase in the speed-up values versus the number of threads, with a slight degradation obtained for task (b).