The file arraySum.c contains a sequential program to sum the values in an array. The files 10k.txt, 100k.txt, 1m.txt, and 10m.txt (in the directory /home/cs/374/exercises/07) can be used to test this program, either by using their absolute pathnames, or by creating symbolic links to them. Please access the files directly from there -- don't copy them, to avoid wasting space. Compile arraySum.c, and execute it using each of these data files, recording the sums you get for each.
This week's assignment is to write two parallel versions of this program -- a distributed-memory version in MPI and a shared-memory version in OpenMP. Both versions should solve the problem using a combination of the Master-Worker, Parallel For Loop, and Reduction patterns.
Once each process has its piece of the array, each process should sum its piece; then your program should use the Reduction pattern to sum these local sums.
In addition to the result, your program should compute and display: the total time taken by the program; the time spent in I/O; the time to scatter the values; and the time to sum the array. Use MPI's timing mechanism for this.
Once each thread has its piece, The threads should then sum the values in their pieces, using the Parallel Loop and Reduction patterns.. (If the array is in shared memory, no Scatter is needed.) At the end, the master thread should compute and display: the total time, the time spent in I/O, and the time spent summing the array. Use OpenMP's timing mechanism for this.
In each version, the actual work of summing the array should all be done by writing a parallel version of the sumArray() function that uses the parallel patterns we have discussed.
Test your programs in the ulab using small arrays. When your programs seem to be working properly, scp them to the cluster and test them on the data files there, recording your execution times. On Dahl, the data files are in the directory /home/cs/374/exercises/07. Access the files directly from there -- please don't copy them, to avoid wasting space.
This is a one week project.
CS > 374 > Exercises > 07 > Homework Project