Adaptive Quadrature

Purpose:

The purpose of this assignment is to become familiar with MPI programming, to use MPI to solve a computational problem, and to understand some simple programming tradeoffs.

Guidelines:

This assignment is to be done on your own. You may ask each other questions about the assignment, but you may not share code other students in the class. You may use materials from the texts and outside readings. Looking at pseudocode solutions from textbooks is OK. However, it is cheating to look up the specific solution to this problem on the web or another resource. You may use any code given in the class or from the text as a starting point.

Assignment Part One:

Write a program to evaluate numerically an integral using adaptive quadrature as described in Section 4.2.2 of Wilkinson. Use the trapezoid method. This is exercise 4-16 from Wilkinson.

Your program should use the following command line interfaces:

      mpirun -np <numprocs> trapezoid <left boundary> <right boundary>

The parameters are required. If any parameters are missing, have the program terminate with a message giving the proper usage. For convenience, you may wish to statically initialize a function, such as:

     double f(double x) {
       return( x*x + x + 1);
     }
For extra credit, you may try to allow the user to input a (polynomial) function.

Test your program on the Prospero cluster using the function above, and/or also using your choosing, over a range of your choosing. Your program should terminate when:


( ABS( Newcalculate_value - Oldcalculated_value ) / Newcalculated_value ) < 0.001

Assignment Part Two:

Run your program using a range of processes from 1 up to 24. Create a report that shows a graph with the executing times for each number of processes. Also provide an explanation paragraph for the results that you obtain.

Grading:

Some parts of this assignment are left unspecified. Whereever you make assumptions or design decisions your should state these explicitly for full credit.

The adaptivetrap program that you write should compile and run on the Prospero cluster. If you choose to write in a language other than C, then you must provide the compile line or makefile for the program, and it must run on Prospero. For full credit your program must compile without errors or warnings, and must execute correctly with a variety of test cases. It should catch simple errors. It should have adequate comments and use good software engineering style and techniques.

Grades on the report will be based on how carefully you present your results, including English usage and technical description. The graph should be clear and easy to read and the explanation of your graph should follow from the graph. If you have anomalies in your results then you should explain those, as well.

What you turn in:

  1. Place your source file(s) in a subdirectory of your user account with the name "adaptivetrap". The timestamp of your source will be used as the submit time.
  2. Turn in your speedup analysis on paper on the day that the program is due.

Enjoy!