5/2/2021 Exam 02 Multiple Choice: CMPSC 450 Spring 2021
Exam 02 Multiple Choice
Due Mar 15 at 8:50pm Points 8 Questions 8
Available Mar 15 at 8am – Mar 15 at 8:50pm about 13 hours Time Limit None
This quiz was locked Mar 15 at 8:50pm.
Attempt History
Attempt Time Score
LATEST Attempt 1 15 minutes 7 out of 8
Score for this quiz: 7 out of 8 Submitted Mar 15 at 8:14am This attempt took 15 minutes.
Question 1
1 / 1 pts
In the five step process for applying threading to a problem, what information must be passed to each thread during the execute phase? Select all that apply.
What the total number of threads are.
What portion of the total work that thread is responsible for completing. What subroutine to execute.
Nothing, the threads automatically know what to do.
Correct! Correct!
Question 2
1 / 1 pts
https://psu.instructure.com/courses/2109084/quizzes/4153095
1/5
5/2/2021 Exam 02 Multiple Choice: CMPSC 450 Spring 2021
Correct!
Question 3
1 / 1 pts
True or false. std::threads can be used for recursive threading calls.
True False
Correct!
Correct!
What construct in c++ can be used similar to the critical sections in OpenMP?
simd intrinsics std::thread mutex locks recursion
Question 4
1 / 1 pts
Which of the following is the correct OpenMP compiler directive for C/C++?
#define OMP #pragma omp int OMP
https://psu.instructure.com/courses/2109084/quizzes/4153095
2/5
5/2/2021 Exam 02 Multiple Choice: CMPSC 450 Spring 2021
Question 5
1 / 1 pts
In OpenMP, a barrier is:
The point where all threads wait until the slower threads reach this point before all threads continue execution.
The region concurrently executed by all threads.
The average number of instructions between branches.
A declaration that forces all threads to execute it one at a time.
Correct!
Correct!
#ifdef OMP
Question 6
1 / 1 pts
Which OpenMP pragma should we use for the following for loop?
c = 0;
for (int ii = 0; ii < N; ii++)
c += a[ii] * b[ii];
#pragma omp
#pragma parallel for shared(a, b, c)
#pragma omp parallel for shared(a, b, c) reduction(+: c)
https://psu.instructure.com/courses/2109084/quizzes/4153095
3/5
5/2/2021 Exam 02 Multiple Choice: CMPSC 450 Spring 2021
Question 7
1 / 1 pts
Given a forest with 1024 nodes. What is the maximum number of steps required to find all root nodes using the parallel pointer jumping algorithm?
1
4
10 1024
Correct!
orrect Answer ou Answered
The first phase of the parallel prefix sums (summation) performs the summation of the vector using the parallel binary tree summation technique. What critical detail is necessary in order to be able to perform the second phase of the algorithm (distributing the results)?
Start with the lowest thread ID.
Store the interim results at each node for use later.
No critical detail, the original binary tree summation that provides a singular summation result can be used.
#pragma omp parallel for shared(a, b, c) schedule static
Question 8
0 / 1 pts
https://psu.instructure.com/courses/2109084/quizzes/4153095
4/5
5/2/2021 Exam 02 Multiple Choice: CMPSC 450 Spring 2021
Quiz Score: 7 out of 8
There is no second phase in parallel prefix sums.
https://psu.instructure.com/courses/2109084/quizzes/4153095
5/5