Parallel Programming - Midterm Exam 2007 | CS 475, Exams of Computer Science

Material Type: Exam; Professor: Rajopadhye; Class: Parallel Programming; Subject: Computer Science; University: Colorado State University; Term: Fall 2007;

Typology: Exams

Pre 2010

Uploaded on 03/11/2009

koofers-user-om8
koofers-user-om8 🇺🇸

9 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 475 Fall 2007 Midterm
Nov 25 2007, 10:00 am
Name
Please read these instructions completely before proceeding. Do
not turn this page until you are asked to. This is a closed book
exam. You are allowed to bring in one page of notes. There are
five questions of equal weight. Please answer all the problems.
Prob. No. Max score Your Score
1 10
2 10
3 10
4 10
5 10
Total 50
pf3
pf4
pf5

Partial preview of the text

Download Parallel Programming - Midterm Exam 2007 | CS 475 and more Exams Computer Science in PDF only on Docsity!

CS 475 Fall 2007 Midterm

Nov 25 2007, 10:00 am

Name

Please read these instructions completely before proceeding. Do not turn this page until you are asked to. This is a closed book exam. You are allowed to bring in one page of notes. There are five questions of equal weight. Please answer all the problems.

Prob. No. Max score Your Score 1 10 2 10 3 10 4 10 5 10 Total 50

For each of the following code fragments, use OpenMP pragmas to make the loop parallel, or explain why it is not suitable for parallel execution. If it is not parallelizable, suggest how the program could be rewritten in order to be executed in parallel.

Problem 1: [10 pts]

s = 0; for (i=0; i<n; i++) s += a[i] * b[i];

for (i=0; i<n; i++) for (j=0; j<m; j++) { X[j] = bar(X[j], X[j-1]); /* bar has no side-efffects */ }

for (i=0; i<n; i++) for (j=0; j<m; j++) { X[i] = bar(X[i], X[i-1]); /* bar has no side-efffects */ }