COMP528-JAN21 University of Liverpool
COMP528-JAN21 – Continuous Assessment 2
Coordinator: Fabio Papacchini
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. This assignment accounts for 11% of the total mark for
COMP528.
The code is provided via /users/papacchf/COMP528-JAN21/CA/CA2/marketing research.c
The code is a näıve implementation of the following scenario. A big multi-national company
wants to improve customer satisfaction. The company has come up with 16 possible policy
improvements, and it wants to understand which combination of those would achieve the best
result. For this reason, the company has collected feedback from 50000 customers, where each
customer has assigned a value between -100 and 100 to each one of the possible policies. Using
those feedback, the company wants to compute the average and the standard deviation of each
combination, and make its decision based on the top 10 results.
For simplicity, let us consider an example with 2 policies (p1 and p2) and 4 customers
(c1, c2, c3 and c4). This can be written in a table/spreadsheet like the following.
c1 c2 c3 c4
p1 10 -14 56 33
p2 -86 25 -56 23
There are 4 possible combinations of the policies (no policy, only p1, only p2, both). For
each combination, the values assigned to each customer is the average over their feedback (that
is, the sum of their feedback for the selected policies divided by the total number of selected
policies). For example, if both policies are selected, then the value for c1 is
10 − 87
2
= −38.
Once this is computed for all customers, then you need to compute the average and the standard
deviation of the resulting values.
After this is done for each possible combination, you are required to output the top 10
combinations, according to the average, and report their averages and standard deviations.
Your main aim of the coding side of this assignment, is to implement an efficient
MPI code that gives the correct answers. There are several options open as to how
to do this, but you must describe and justify your choices in the report.
1 Useful Steps to Complete the Assignment
1. You have a serial code. You can compile and run this without any optimisation (“-O0”)
to observe its behaviour. You can also time how long an executable named “./my.exe”
takes to run by using the command: time ./my.exe
Fabio Papacchini: Fabio. .uk 1
COMP528-JAN21 University of Liverpool
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 between 3 and 4 minutes 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 might want to re-implement the computation of the statistics, or the computation of
the top 10 to improve performance. How you modify them it is up to you.
5. You can use plotting to represent the results.
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.
2 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 imple-
mentation, explaining why you think they are good or poor, and explaining any lack of ideal
scaling or other poor performance. Specifically you should include:
� Your approach to parallelising the code: what have you done and why?
Fabio Papacchini: Fabio. .uk 2
COMP528-JAN21 University of Liverpool
� 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
Canvas)
� You should have a section that discusses the performance & accuracy of your MPI imple-
mentation.
3 Marking Scheme & Submission
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 30%
Performance: timing processes and discussion of relative perfor-
mances & 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 “Pro-
gramming Assignment 1 – MPI”); and
� a Zipfile of C code, your SLURM batch scripts and the SLURM output file/s which you
discuss in your report to be uploaded to Canvas (see “Programming Assignment 1 – MPI”)
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
4 Deadline
The deadline is at 5pm GMT on Wednesday 11/03/2021.
For deadlines from March onward, 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/.
Fabio Papacchini: Fabio. .uk 3
https://www.liverpool.ac.uk/media/livacuk/tqsd/code-of-practice-on-assessment/appendix_L_cop_assess.pdf
https://www.liverpool.ac.uk/media/livacuk/tqsd/code-of-practice-on-assessment/appendix_L_cop_assess.pdf
https://www.liverpool.ac.uk/aqsd/academic-codes-of-practice/code-of-practice-on-assessment/
https://www.liverpool.ac.uk/aqsd/academic-codes-of-practice/code-of-practice-on-assessment/
Useful Steps to Complete the Assignment
Requirements of Assignment
Marking Scheme & Submission
Deadline