Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COM00174M 

MSc and MEng Degree Examinations 2021–2

DEPARTMENT OF COMPUTER SCIENCE

High-Performance Parallel and Distributed Systems

The Problem

Maxwell’s equations are a set of coupled partial differential equations (PDEs), that together with the Lorentz force law, form the foundation of classical electromagnetism. The equations describe how electric and magnetic fields are generated by charges, currents and changes in the fields. The four equations are:

V .  = 

V .  = 0

 = _V × 

 = ×  _ 

(Gauss’s law)

(Gausss law for magnetism)

(Faraday’s law of induction)

(Ampère’s law)

In these equations,  is the electric field,  is the magnetic field, e and u are the permittivity and permeability of free space, o is the charge density and  is the current density. Luckily, it is not necessary that you understand these equations for this assessment. This assessment will focus on a method for solving these equations using finite differencing that was proposed by Kane Yee in 1966 [1].

 

 

 

 

 

 

z

 

 

E

x

Figure 1: A two-dimensional Yee grid

Yee’s approach to solving Maxwell’s equations relies first on using central-difference approxima- tions to the space and time partial derivatives, and then on using leapfrog integration to solve these equations. First, the space is discretised (in our case, in two-dimensions) into a grid of cells (a so-called Yee grid”), as seen in Figure 1, where the electric fields are calculated on the edges of each grid square, and the magnetic fields are calculated in the middle of each grid square1. Then, Faraday’s law and Ampère’s law are rewritten into the following system of scalar

equations (with current density () omitted for simplicity):

2 z         2 x         2 y

2t       2y       2x

 =  × 

 = _  × 

These equations can then be written into a series of finite difference equations that can be solved computationally using a leapfrog method. In the leapfrog method, we update the magnetic field on a half time step, and then update the electric field on each time step (i.e. each half time step, the magnetic field and the electric field updates leap frog” each other).

Bz(n)+  (i +  , j +  ) _ Bz(n) _  (i +  , j +  )       Ex(n) (i +  , j + 1) _ Ex(n) (i +  , j)

At                                                     Ay                   Ey(n) (i + 1, j +  ) _ Ey(n) (i, j +  )

_

Ex(n)+1 (i +  , j) _ Ex(n) (i +  , j)       Bz(n)+  (i +  , j +  ) _ Bz(n)+  (i +  , j _  )

At                                             Ay × u × e

Ey(n)+1 (i, j +  ) _ Ey(n) (i, j +  )          Bz(n)+  (i +  , j +  ) _ Bz(n)+  (i _  , j +  )

=    _

This approach to solving Maxwell’s equations is formalised in the maxwell C application that can be downloaded from the VLE. The application implements the above equations on a

rectilinear grid, and provides functionality to start the application for various simple problems. Download the source code and build the application using:

$  make

You can then run the application with:

$   ./maxwell

At the end of execution, a VTK file will be written that can be loaded into a visualisation application such as VisIt (https://visit-dav.github.io/visit-website/). The output file will contain information about the geometry of the problem, and the values of the electric and magnetic fields at the grid points (i.e. the intersections of the grid). The final simulation state will be based upon the default configuration options, but you can customise the parameters by changing the runtime arguments passed to the application.

$   ./maxwell  --help

The maxwell application consists of 5 C les and 4 associated header les.

args.c contains functionality to handle the command line options, and can override some simulation parameters based on these options.

data.c contains the definitions for the shared storage and simulation parameters that are     used in the application, and also functions to allocate addressable, contiguous 2D and 3D arrays.

setup.c  has functionality to set up a simulation based on the input problem that is chosen,

and assigns and allocates the required variables and storage.

vtk.c  handles the le input and output for the application.

maxwell.c contains the main method, and the methods required to progress the simulation.

References

[1]  Kane Yee, Numerical Solution of Initial Boundary Value Problems Involving Maxwell’s

Equations in Isotropic Mediain: IEEE Transactions on Antennas and Propagation; 1966

Assignment

The maxwell application is currently a simple single-threaded implementation of the Yee method described above.  Your task is to produce three parallelisations of the maxwell application and write a report detailing the parallelisation process, the scaling performance of your three parallelisations, and a comparative study of these parallelisations.

You are expected to produce parallelisations using the following three programming models:

•  OpenMP

•  The Message Passing Interface (MPI)

•  CUDA

Your parallelisations should produce the same result (within some small tolerance due to floating point arithmetic) as the original single-threaded application for equivalent starting parameters. You are expected to fully evaluate your applications using the HPC hardware that is available within the University (e.g. CUDA-capable workstations within the Department, the Viking cluster, etc.), and that is appropriate for each particular programming model.

Submission

Your submission should be a .zip file that will contain your three application “ports” and a report that documents:

•  Parallelisation Approach [30 marks]

The approach taken to parallelise the application for each programming model.

•  Validation [15 marks]

The validation process used to verify the correctness of your applications.

  Experimental Setup [15 marks]

A summary of the systems used for performance evaluation and an account of the process of collecting results.

•  Performance Evaluation [20 marks]

Appropriate data demonstrating the performance and scaling behaviour of your applications.

  Comparative Analysis [20 marks]

A comparative analysis of your three applications.

Your report must not exceed 8 sides of A4, with a minimum 11pt font, minimum 120% line spacing (what Word calls Multiple 1.08”), and minimum 2cm margins on all sides. This does not include any covering page, table of contents, reference list or appendices.  Excess pages will not be marked.

References must be listed at the end of the document and do not count towards page limits. Appendices may be used for supplementary data only.