CAB401T1.212 cont/…
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
CAB401T1.212 cont/…
QUESTION 1
I want to write a parallel program to run on a HPC Cluster that exploits instruction, vector, thread
and process parallelism. Explain for each of these levels, what the programmer needs to do (if
anything) and the libraries that you would recommend using.
(3 marks)
QUESTION 2
I have a computer with 4 physical cores, each of which is hyper-threaded. I run an embarrassingly
parallel program that creates 100 threads and I achieve a near linear speedup. Add appropriate
labels to the following speedup graph depicting this result.
(3 marks)
Speedup Graph
QUESTION 3
Often the process of parallelization involves exploiting inherent parallelism. But sometimes, that
is not possible or yields insufficient speedup. What is the alternative? Which of those two
approaches is more likely to be supported by some form of automatic parallelizing software tool?
(3 marks)
QUESTION 4
When parallelizing, is it both necessary and sufficient to preserve all data and control
dependencies? Explain.
(3 marks)
QUESTION 5
Consider the following code:
for (int i=1; i
stmt1: A[i] = B[0,0];
stmt2: B[i,j] = A[i] + B[i-1,j];
}
a) Use the following table to list all data dependences:
Data Dependence
Type
Source Destination by Carried
which loop?
Statement Expression Statement Expression
(3 marks)
b) Based on these data dependencies, which of the loops are safe to parallelize?
Loop Safe to Parallelize? (yes/no)
i loop
j loop
(1 mark)
QUESTION 6
Analyse the cache data locality for the following code. Explain for each expression the degree to
which temporal or spatial locality is being exploited (assuming row major layout).
for (int i=1; i
(3 marks)
QUESTION 7
My parallel program contains a bug because I'm using a random number library that is not thread
safe. Explain what that means. What is the simplest way to fix this bug without change the random
number library? What is the potential downside to this fix?
(3 marks)
QUESTION 8
How might I safely transform the following loops so as to improve the granularity of the
parallelism?
(3 marks)
QUESTION 9
I have a very large CSV format purchase history file that contains the following information:
customer id date product name product type quantity price per item
12 8/11/2021 corn flakes food 1 3.99
289 8/11/2021 massage service 2 39.50
34 9/11/2021 apple food 34 0.99
We want to compute the total price of goods of each product type. In the above example, the
result would be food: $37.65 and service: $70.00
You are using Hadoop to process the data. Give an overview of how that would work.
Write pseudo code for the Map and Reduce functions for this example.
(Make clear what the key/value input and output types are for each operation).
(3 marks)
QUESTION 10
Which of following neural network layers require matrix multiply as the underlying operation?
a) Dense fully connected layer
b) Convolution layer
c) MaxPool layer
d) ReLu layer
e) Input layer
(2 marks)
2026-02-06