5/2/2021 Exam 01 Short Answer: CMPSC 450 Spring 2021
Exam 01 Short Answer
Due Feb 12 at 8:50am Points 12 Questions 4
Available Feb 12 at 8am – Feb 12 at 8:50am about 1 hour Time Limit None
Instructions
The purpose of this section is to evaluate your detailed understanding of fundamental concepts in the class.
You may use one sheet of handwritten notes for this quiz.
Window focus will be monitored for the duration of this exam. Any attempt to click outside of this browser tab will be logged and flagged as a possible Academic Integrity violation.
This quiz was locked Feb 12 at 8:50am.
Attempt History
Attempt Time Score
LATEST Attempt 1 31 minutes 2 out of 12
Score for this quiz: 2 out of 12 Submitted Feb 12 at 8:49am This attempt took 31 minutes.
Question 1
0 / 3 pts
Name and describe the relevance of 2 processor improvements found in a modern CPU such as the Intel Xeons used on the ACI cluster.
Your Answer:
1. Bigger cache size. 2. Lower latency.
https://psu.instructure.com/courses/2109084/quizzes/4153097?module_item_id=31849460
1/4
5/2/2021 Exam 01 Short Answer: CMPSC 450 Spring 2021
https://psu.instructure.co
2/4
Question 2
0 / 3 pts
The single core/serial execution time of a benchmark for problem size X is 100 seconds. Assume that there is a constant overhead (serial component) of 20 seconds in the benchmark, and that this overhead is independent of problem size. Further assume that the rest of the benchmark work is perfectly parallelizable (i.e., you obtain a speedup of p using p cores for the parallelizable routines).
What is the overall parallel speedup with p = 4 processors?
According to Amdahl’s law, what is the maximum obtainable parallel speedup for this benchmark?
Your Answer: 4*1/(1-(20/100))=5
Amdahl’s Law: S = 1 / ( (1-p) + (p/s) ) = 1 / ( (1-0.8) + (0.8/4) ) = 1 / ( 0.2 + 0.2 ) = 1 / 0.4 = 2.5
Why are the relevant?
Question 3
1 / 3 pts
Identify potential optimizations in the following code:
1: for (int j = 1; j < J - 1; j++)
2: for (int i = 1; i < I - 1; i++)
3: {
4: b[i * J + j] = 0.0;
/courses/2109084/quizzes/4153097?module_item_id=31849460
m
5/2/2021
https://psu.instructure.com/courses/2109084/quizzes/4153097?module_item_id=31849460 3/4
Exam 01 Short Answer: CMPSC 450 Spring 2021
Your Answer:
1. The power function could be avoid. 2.
Lines 1 and 2 can be flipped to avoid strided memory access. The pow statement in line 7 can be replaced with a simple multiply. Loop unroll Lines 5 and 6 into 9 statements.
5:
6:
7:
8: }
for (int k = -1; k <= 1; k++)
for (m = -1; m <= 1; m++)
b[i * J + j] += pow(a[(i+k) * J + (j+m)], 2.0);
Question 4
1 / 3 pts
Design a PRAM algorithm to parallelize the following serial algorithm.
Describe the PRAM algorithm.
What is the Work, W(N), and Execution Time, T(N) of the PRAM algorithm?
Your Answer: m = -inf;
m = -inf;
for (int i = 0; i < N; i++)
{
if (A[i] > m)
m = A[i]; }
5/2/2021 Exam 01 Short Answer: CMPSC 450 Spring 2021
Quiz Score: 2 out of 12
for( int i = 0; i