程序代写案例-UESTION 1

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
CAB401T1.212 cont/…
1
QUESTION 1
I want to write a parallel program to run on a HPC Cluster that exploits instruction, vector, thread
and p
rocess 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)
CAB401T1.212 cont/…
2
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
CAB401T1.212 cont/…
3
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)
CAB401T1.212 cont/…
4
QUESTION 4
When parallelizing, is it both necessary and sufficient to preserve all data and control
dependencies? Explain.
(3 marks)
CAB401T1.212 cont/…
5
QUESTION 5
Consider the following code:
for (int i=1; ifor (int j=1; j{
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)
CAB401T1.212 cont/…
6
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 for (int j=1; j sum += A[i,i] + B[i,j] + C[j,5];
(3 marks)
CAB401T1.212 cont/…
7
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)
CAB401T1.212 cont/…
8
QUESTION 8
How might I safely transform the following loops so as to improve the granularity of the
parallelism?
(3 marks)
CAB401T1.212 cont/…
9
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)
CAB401T1.212
10
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)
END OF PAPER

欢迎咨询51作业君
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: Fudaojun0228