COMP528 Assignment 2 Overview This assignment requires knowledge of MPI programming to parallelise and extend a given serial code, and to run the parallel code on the University HPC facility, Barkla. Marks are split between the coding and the report. The code as provided via ~mkbane/COMP528/assignments/assignment-2/pollen.c This code is a naïve model of pollen blowing in the wind and slowly falling to the ground. We initialise NUMPOLLEN pollen particles to random (x,y,z) and for each of MAXTIME timesteps we apply a given wind function and a force proportional to gravity and count how many pollen particles have hit the ground in timestep t, totalNumGround[t]. You are required to find the “best linear fit” of number of pollen on the ground at any time. One way to do this is to plot the data from your simulation and then draw a “best fit” straight line through all the points. To do this programmatically, you are required to add code that takes the calculated values of totalNumGround[t] as “y” and the corresponding values of time[t] as “x” and apply these formulae to find the values of “m” and “c” = {∑ − ∑ ∑} {∑ଶ − (∑)ଶ}൘ and c by = ∑ − ∑ You will need to include your computed values of “m” and “c” in your report (see below) along with a prediction of how many pollen particles with have fallen to the ground after 10,000 timesteps. You are provided with a set of equations to determine the best linear fit Y=mX+c. That is, for given input vectors, X and Y, you apply these equations to find m and c. Having written and tested a serial code you are required to write two parallel codes, one using task parallelism and the other using data parallelism, and to compare & explain their relative performances. You can find more regarding best linear fit online, e.g. at https://www.mathsisfun.com/data/least-squares-regression.html Your main aim of the coding side of this assignment, is to implement an efficient MPI code that gives the correct answers (see below). There are several options open as to how to do this, but you must describe and justify your choices in the report. The answers you are required to submit are (i) the output per timestep; (ii) the values of m, c Useful Steps to Complete the Assignment 1. You have a serial code. You can compile and run this without any optimisation (“-O0”) to determine the correct answers regarding pollen on the ground at each timestep. You can also time how long an executable named “./my.exe” takes to run by using the command: time ./my.exe 2. Note that when running the serial code in batch you may need to over-ride any “#SBATCH -t 2” in your SLURM batch scripts since it will take about 225 seconds to run. 3. If you are running an executable called “./test.exe” then you can ‘redirect’ the standard output to a file “test.dat” by using the command: ./test.exe > test.dat 4. You should include the “best linear fit” into the same code as the modelling of pollen particles falling to the ground: i.e. the completed assignment should only compile and run one code. HOW you incorporate the best linear fit is up to you. 5. You can use plotting software to check if your computed best fit aligns with the computed values 6. You have to use some MPI parallelisation to speed-up your code and there will be sufficient information covered in lectures to allow you to do write an efficient implementation. Once you have written your MPI code you should test it is correct by (i) compiling with zero optimisation and running on 1 MPI process and ensuring the same results as the serial code (step 1); running on N>1 MPI processes and ensuring correct results. You are then aiming for time on N>1 MPI processes to be faster than on 1 MPI process, at least for values of some values of N. You should use the batch system of Barkla and you need not use more than 1 node, so use of the “course” partition (queue) is highly recommend for quick turnaround. 7. Your report should comment on the scaling of your solution, as well as on the accuracy of results obtained. Requirements of Assignment Coding You are required to implement your result on Barkla, to write a clear, concise and correct code in “C” and to use the Intel compiler and Intel MPI wrappers via the module commands: module load compilers/intel/2019u5 mpi/intel-mpi/2019u5/bin All compilations should be done explicitly with the “-O0” optimisation flag. The assignment is to explore and discuss parallelism, so we do not want optimisation and you must therefore turn off compiler optimisations via the -O0 flag. You should use the MPI wallclock timer, MPI_Wtime() function, to determine the total run time of the code. Additionally, you should add timers around any specific regions of interest that you wish to discuss in your report. All timings should use good practise as discussed in lectures and labs. There are various options available on how to implement your codes. You should take reasonable care to implement good parallel programming practises. Report You should submit a report of up to 4 pages (+ up to 2 pages of appendix (e.g. data)). The report is an important element of the assignment where you can show your understanding of parallel programming using MPI. Your report should discuss the performances of your implementation, explaining why you think they are good or poor, and explaining any lack of ideal scaling or other poor performance. Specifically you should include: o Your approach to parallelising the code: what have you done and why? o How you have compiled and run the code, and what numbers of MPI processes you have used, and why. (You should include the relevant SLURM files in the zipfile you upload to SAM) o The correct best linear fit for the input data defined above (i.e. what is “m” and “c”?) and prediction of the number of pollen particles on the ground after 10,000 timesteps. o You should have a section that discusses the performance & accuracy of your MPI implementation. Marking Scheme & Submission Correct prediction of how many pollen particles with have fallen to the ground after 10,000 timesteps Report 10% Correct MPI code; (correct parallelism, good coding practices) Code 20% Speed of solution Code 20% Discussion of parallelism implementations; (good explanations of why you decided to write the code as you did) Report 20% Performance: timing processes and discussion of relative performances & accuracy; (good timing practises; informed discussion of accuracy & time performances, speed-up factors etc) Code &Report 30% Your submission must include: A report to be submitted to the COMP528 course module hosted on CANVAS (see “COMP528 CA#2”) Zipfile of C code, your SLURM batch scripts and the SLURM output file/s which you discuss in your report to be uploaded to SAM submission system (see “COMP528-2: MPI”) https://sam.csc.liv.ac.uk/COMP/Submissions.pl Submissions will be submitted to automatic plagiarism/collusion detection systems, and those exceeding a threshold will be reported to the Academic Integrity Officer for investigation regarding adhesion to the university’s policy https://www.liverpool.ac.uk/media/livacuk/tqsd/code-of-practice-on-assessment/appendix_L_cop_assess.pdf DEADLINE The deadline is 17:00 GMT, Friday 27 November 2020. Usual university rules, penalties and exceptions for lateness/sickness & exceptional circumstances apply https://www.liverpool.ac.uk/aqsd/academic-codes-of-practice/code-of-practice-on-assessment/ [ENDS]
欢迎咨询51作业君