hw2 - name, or family name). Pick any reasonable hash...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 2 Write and run an OpenMP program to compute the following recurrence: for (int i = 0; i<n; i++) { t = t + a[i]; } print(t); Write two versions of the program: 1. Write a version using the OpenMP reduction clause 2. Write a version without using reduction clause. Instead use an array with one element per thread (or some other way of having a private variable for each thread) to hold the partial sums, and a sequential loop to sum up the partial sums Time the two versions using arrays of size 10000, 100000 and 1000000. Do several timings. Turn in program listings, output, and times for the six runs. Note: because there are a limited number of machines (qstruct01 - qustruct04 and algol01 - algol20) I suggest you pick a machine to use by hashing your surname (last
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: name, or family name). Pick any reasonable hash function, or use the following: 1. add the letters of your last name up, using a = 1, b = 2, . .., z = 26. 2. H = (above sum) % 21 for the algol machine name, H = (above sum) % 5 for the qstruct machine name. 3. If possible, test and run your program on another machine you have access to, then a. login to the machine determined above. b. do a who command to see if anyone else is logged into that machine c. if not, run your program, if there is, wait a few minutes and/or pick another machine and check it. 4. At some point in the not-to-distant future I will assign machine to students, and you will be spared at least some of this foolishness....
View Full Document

This note was uploaded on 02/19/2012 for the course ECE 563 taught by Professor Staff during the Spring '08 term at Purdue University-West Lafayette.

Ask a homework question - tutors are online