CSCI 3366 Spring 2004 Homework Three Continuing our discussion of divide and conquer algorithms, we will write a C-MPI program which will perform a simple parallel sort. The master process will generate an array of a given size (command line) of random numbers to be sorted. Depending on the number of processors available, the array will be divided among the processors so that each has an equal share to sort. You may use an ordinary bubble sort (since we wish to make the processors work hard in order to gain some benefit from parallelism). The processors will sort their chunk of the array, and pass the sorted array back to the master process, who will display the sorted results. This all sounds pretty familiar doesn't it? The only catch in this code is that you must use collective communication tools discussed in class to accomplish the task. Take timings of your code using the simple send and receive commands, and compare with the times you obtain by using the collective communication tools and see if any improvement in time is achieved. Do several comparisons. Make sure you set the permissions on your source so I can read your programs. Homework due Tuesday, February 7, 2004 int Bubble(int *a, int n) { int notstop, i; notstop = 1; while (notstop == 1) { notstop = 0; for (i=0; i a[i+1]) { int t; t = a[i]; a[i] = a[i+1]; a[i+1] = t; notstop = 1; } } n--; } }