CS 4960-01 Homework 4

Due: Monday, September 29th, 2008 10:45am

For this homework, start with the reduce/scan framework in reducescan.zip. Hand in a new archive (.zip, .tar, or .tgz) with additional subdirectories for programs that use the framework, and with changes to the framework for parts 2 and 3 below.

Part 1

Use the reduce or scan framework to implement the following programs. (Except for the last one, the parallel version will not actually be faster, because the computation is too cheap relative to the communication cost.)

Part 2

In several programs that might use the scan framework, such as the dist_sum example included with the framework or the last program for part 1 above, the input data needs to be converted in some way to obtain an intermediate value that is used by both accum and scanGen. In the case of last program from part 1, the intermediate data has the same type as the input data, so the input array could be re-used. More generally, the intermediate data has a different type and may need more or different storage.

Extend the scan framework so that a program using the framework supplies an prepare_temps function that take an integer for the size of the local input data array. Then:

Mark your changes to the scan framework code clearly with comments.

Part 3

Adjust the reduce and scan framework implementations so that they work with any number of servers, including numbers that aren't a power of 2. No use of the framework should have to change.

Hint: Each server could round up to N, the nearest power of two, and pretend that N servers are running – except that no information is ever sent to the non-existent servers, and the non-existent servers always produce ``zero'' tallies.


Last update: Monday, December 1st, 2008
mflatt@cs.utah.edu