Due date: Tuesday, October 5, 2004.
Ex. 1 Download the following files.
master.cc
master.h
slave.cc
slave.h
common.cc
common.h
main.cc
seq_prime.cc
Makefile
Compile the program with the command make. The name of the
executable will be prime. This is the implementation of the program
discussed in class find if the number is prime with interruption if
any of the slaves finds a factor of the number.
a. Rewrite the program such that it inputs an array from the user with the method seen in the previous homework, then asks the user for a target and find out if the target is in the array or not.
b. In the communication process, the slaves should exchange send the master the index at which the target has been found. The master should find out which process has sent them the message and output the index of the target in the global array based on the process id and on the local index.
Ex. 2 Run the program on the Beowulf cluster on several examples of different sizes and compare it with a sequential version of the algorithm on the cluster. Compute the speedup, efficiency, and cost of this algorithm. The input for the algorithms should be the same in the sequential and parallel case, so I recommend using the redirection.