Homework 3
cs599 Parallel Programming and Algorithms
5 points
Due Friday, Feb 27 at 11:59:59pm
1. Write an MPI program to perform numerical integration on Easom’s function -
f(x, y) = -cos(x)*sin(y)*exp( -((x - PI)*(x - PI) + (y - PI)*(y - PI)) )
Assume that the starting and ending points for both x and y are provided as command line arguments. Your program must make use of the MPI_Reduce function.
2. Write an MPI program that will compute the sum of an array of random integers. Assume that this array will be created in process rank 0. Additionally, assume that the size of the array will be provided as a command line argument. After reading in the size of the array, broadcast the amount of work to do to all other processes. Next, send the data to work on to each of these processes using an MPI_Scatter function call. Finally compute the resulting sum using MPI_Reduce.
3. Assume that you wish to test the performance of several numerical optimization methods on a particular function
f(x) = cos(x)+(pow(fabs(7.0-x), 2.0/15.0))+2*(pow(fabs(5.0-x), 4.0/35.0))
Write an MPI program that will broadcast the starting and ending locations for x that will be used to analyze this function. You may assume that one program will be used. This program will use a Monte-Carlo method to analyze the function (i.e generate a whole bunch of points within the range given at the command line and evaluate them to find the minimum). Be sure to print the resulting minimum and to print the runtime using MPI_Wtime.
4. Write an MPI program that will compute the standard deviation of a set of randomly generated numbers. Assume that processes will generate these numbers independently and send their results (sums and sums of squares) to process rank 0 for computation of the standard deviation.
5. Write a Hybrid MPI/OpenMP code to complete problems 1-4. Run each program on the stampede supercomputer using a significant amount of compute time. For example, you could use about 30s of compute time per problem. How do the results compare to each other? Are the hybrid versions faster?