One fundamental goal behind Computational Electromagnetics (CEM) is to reliably simulate the behavior of electromagnetic devices before they are actually built. For this purpose, many powerful numerical analysis techniques have been developed in the field of CEM in the last decades. Some of the most commonly used methods today are Finite Difference Time Domain (FDTD), Finite Elements (FEM), Method of Moments (MOM) or Boundary Element Method (BEM), Geometrical Theory of Diffraction (GTD), Physical Optics (PO), Physical Theory of Diffraction (PTD), and Shooting and Bouncing Rays (SBR). Its wide range of practical applications makes of CEM one of the most important engineering fields today.
In collaboration with the Group of Antennas and Radar of the University of Vigo, the Appentra Team has addressed the automatic parallelization of a real-world electromagnetic simulation program based on the method of moments (MoM). The method of moments (MOM) is a technique used to solve electromagnetic boundary or volume integral equations in the frequency domain. Because the electromagnetic sources are the quantities of interest, the MOM is very useful in solving radiation and scattering problems. The following images are the results of simulations of nanoantennas manufactured with aluminum.
Automatic parallelization of computational electromagnetics MOM code
In previous articles we presented some simple success cases of Parallware. Hereafter, we will explain how to accelerate the MOM code on multicore computers using the OpenMP-enabled automatic parallelization capabilities of Parallware. The sequential MoM code consists of more that 2000 source lines of code written in the C language, apart from the Matlab code that drives the execution of the C code. The MOM code uses sparse computations to compute the MOM matrix, which is the hotspot and thus the target from the point of view of automatic parallelization. In order to use Parallware, we have isolated the MOM matrix computation in a separate C file called “MoM.c”. The transcription of the terminal session is as follows:
Overall, Parallware reports that parallelism has been found and a loop has been successfully parallelized. The command-line options of Parallware specify the target compiler directives (“-t OpenMP” for multicore computers), the name of the output file (“-o salida.c”), the name of the input file (“MoM.c”), and the report level that shows what loops have been parallelized (“–report-level 2”). Note that Parallware needs to additional command-line options to handle the size of the sparse MoM matrix (options “-G”).
MOM codes are typically compute-bound and achieve good speedups. In our experiments, we have run the MoM code sequentially and in parallel using 8 threads on a quad-core multicore processor with hiperthreading. For a problem size of 7000 unknowns, the sequential code lasts 228 seconds and the parallel code lasts 50 seconds, which provides a good speedup 4.56.
MOM codes are also typically memory-bound, by which the maximum problem size to be solved is limited by the amount of memory available in the computer. By default, Parallware minimizes parallelization overhead at the cost of using more memory. Thus, for codes that are compute-bound and memory-bound, Parallware provides a command-line option “-m” that minimizes the amount of memory used by the OpenMP-enabled parallel code:
In this case, Parallware also reports the existence of a parallel loop. The sequential execution time is 228 seconds and the parallel execution time is 49 seconds, which provides an even higher speedup 4.65 for our MOM code. From the point of view of memory requirements, the memory-optimized parallel version consumes 858,9 MB, almost the same as the 858,4 MB of the original sequential MOM code.
Overall, this article presents a success case of Parallware in the field of computational electromagnetics (CEM) using the widely-used Method of Moments (MOM). MOM codes are typically compute-bound as well as memory-bound, which can be handled appropriately in Parallware. In the future, Parallware will be tested with other simulation codes from CEM and from other fields of computational science and engineering. Such new success cases will also be presented in Appentra’s technical blog.
About the Group of Antennas and Radar of the University of Vigo