关于java:AE3422-Computing

71次阅读

共计 5646 个字符,预计需要花费 15 分钟才能阅读完成。

AE3-422 High-performance Computing
Coursework Assignment
Deadline: 20th March 2019 – 17:00
Instructions
Please take note of the following when completing this assignment:
Read all the tasks carefully and plan ahead before you start designing and implementing your code.
You may use any of the tools and libraries available on the provided Linux environment.
Your submitted code must compile and run correctly on the provided Linux environment.
Make regular backups of your code onto a separate computer system; no allowance will be made for
data loss resulting from human or computer error.
1 Introduction
The objective of this coursework is to write a parallel numerical code for finding the solution to the generalised Burgers’
Equation in 2D using the finite difference method.
The strong form for Burgers’Equation is given by:
t + ((a + bu) ·)u = c?2u, (1)
where u = (u, v) and a = (ax, ay), b and c are constants. This is subject to initial and boundary conditions,
u(x, y, 0) = f(x, y), on (2)
u(x, y, t) = g(x, y), on (3)
Equation 1 can be expanded as
t + (ax + bu)
x + (ay + bv)y = c
(4)
Burgers’equation is obtained as a result of combining non-linear wave motion with linear diffusion and is the simplest
model for analysing the combined effect of non-linear advection and diffusion. This equation has been found to
describe various phenomena such as turbulence and approximate theory of flow through a shock wave travelling in a
viscous fluid.
1
2 Finite Difference Method Discretisation
In order to solve Equation 1, space and time need to be discretized. For this assignment we will use an explicit (forward)
time-integration scheme when discretising the time derivative.
Explicit integration scheme:
(5)
In this assignment the domain is defined as:
= {(x, y) : L/2 ≤ x ≤ L/2, L/2 ≤ y ≤ L/2} (6)
The initial conditions at t = 0 are:
(8)
and the boundary conditions are:
g(x, y, t) = 0, on, t > 0 (9)
3 Test cases
Your code should be tested using the following four test cases:
An unsteady diffusion problem (a = 0, b = 0, c = 1);
A linear advection problem in x (ax = 1, ay = 0, b = 0, c = 0);
A linear advection problem in y (ax = 0, ay = 1, b = 0, c = 0);
A generalised Burgers problem (ax = 1.0, ay = 0.5, b = 1.0, c = 0.02).
Use a domain size with L = 10 for all test cases.
Continues on next page …
2
Tasks
The objective of this coursework is to write a high-performance parallel C++ code which will solve the generalised
Burgers’equation described above. A template code is provided to get you started and help you structure your code.
Download this code and edit it to complete the following tasks.

  1. Extend the template code provided to solve the generalised Burgers’equation, initially in serial:
    (a) Implement the Model class, declared in Model.h, to parse and store all the parameters as required.
    Parameters provided by the user should be read from the command-line, and validated where appropriate. [5%]
    (b) Write a new class called Burgers which has public member functions which: [20%]
    Set the initial velocity field at time t = 0;
    Time integrate the velocity field from t = 0 to t = T (the final time);
    Write the velocity field to a file.
    Calculate the energy of the velocity field, given by
    (c) Complete the main function provided to use the classes and verify using the first three test cases. [5%]
  2. Create a Makefile to build and run your C++ code. [5%]
    (a) Create a target compile which compiles your code.
    (b) Create targets diff, advx, advy and burg which execute your compiled code for the four Test Cases.
    (c) Update your makefile to add a clean target which removes files generated during compilation.
    (d) Define appropriate default and all target rules in your makefile.
  3. Parallelise your C++ program with MPI using two processes. [15%]
    (a) Partition the domain into two halves to solve Equation 1 in parallel.
    (b) Verify your parallel code using the first three test cases.
    (c) Update your makefile and add the targets diffp, advxp, advyp and burgp to run the code in parallel
    on two processes using the parameters for each of the test cases.
  4. Parallelise your C++ program with MPI using a larger number of processes P = Px × Py, where Px ≥ 1 and
    Py ≥ 1 are provided by the user on the command-line. Partition the domain such that the x- and y-directions are
    split into Px and Py parts, respectively. Verify your code. [30%]
  5. Write a brief report (maximum 3 pages) which includes [15%]
    (a) Quantitative evidence of verification of your C++ code, in serial and parallel.
    (b) A plot of your solution to the fourth test case, on a grid of size 10 × 10 with 2001 grid points in each
    direction with a final time of T = 1 and 4000 time steps.
    (c) An analysis of the performance of your code and any optimisations you performed during its development.
  6. Demonstrate use of good programming practices [5%]
    (a) Generate a log of your use of Git version control using the command:
    git log –name-status > repository.log
    (b) Document your source code appropriately.
    3
    Submission and Assessment
    When submitting your assignment, make sure you include the following:
    All the files needed to compile and run your C++ code:
    – Source files for a single C++ program which performs all the tasks. i.e. All .cpp and .h files necessary
    to compile and run the code.
    – The Makefile used for both compiling and running the code, including all the targets as specified in the
    tasks.
    Your three-page report (in PDF format only).
    The git log (repository.log) generated in Task 6.
    These files should be submitted in a single tar.gz archive file to Blackboard Learn. To generate your tar.gz
    archive, put all files to be submitted in a directory (e.g. ae3-422-assessment) and run the following command
    from the directory above it:
    tar -cvzf submission.tar.gz ae3-422-assessment
    You may make unlimited submissions and the last submission before the deadline will be assessed.
    END OF ASSIGNMENT
    Competition! (entirely optional)
    Maximising the efficiency and execution speed of a code is critical for High-performance Computing applications.
    Many aspects of a code’s design affect performance, such as the ordering of operations, memory layout
    and loop ordering. As an additional challenge, you can opt-in to your code being included in the AE3-422 performance
    challenge! We will run your code both in serial and in parallel on a large parallel computer system
    and measure its performance.
    Note: Submissions must successfully solve the fourth validation case and you need to have successfully completed
    Task 4 in order to be included in the parallel competition.
    Choosing to enter the competition is entirely optional and participation (or lack of) will have no bearing
    on your mark for this module.
    Entries for the competition will be assessed and ranked after your assignments are marked and feedback has
    been returned.
    WX:codehelp
正文完
 0