## Description

1 Problem Statement

Write a parallel program in C/C++ to compute the definite integral . Let n be a large integer and . Compute the definite integral using the approximation

s

2 Parallel Algorithm

The computation can be easily parallelized by assigning each processor the responsibility to compute distinct terms in the summation. You should use the following MPI functions:

• Use MPI Bcast function to broadcast n to all processors.

• Use MPI Reduce function to add the partial sums computed on each processor.

• Use MPI Wtime to time the run-time of the program (measure on processor 0).

3 Code framework

3.1 Input & Output Format

Your program should take n as the input using command line arguments and output the value of the approximation and the time taken to compute this value (comma-separated). For example, if the value of definite integral is s and the time taken is t, your output should be “s, t”. (Note: s should be printed up to 12 decimal points). All output is done through processor with rank 0.

3.2 Deliverables

1. Create a Makefile for your program, and make sure the name of your output executable is“int calc”. If you are not familiar with creating Makefiles, check resources below for help.

2. Write a “README.txt” briefly describing how your program works and the machine you used for generating the results.

3. For n = 106, plot a graph of run-time of the program vs. the number of processors for a few chosen values of p. This run-time should include all computations that contribute to the integral, including any local computations and global reductions. Include your graph and observation regarding the speedup in a PDF file with name “report.pdf”. Make sure to list names of all your teammates at the very beginning of your report.

4. Submit your a) “code.zip” in “Programming Assignment 1 Code” on Gradescope. Your zip file should include all the cpp files, Makefile and “README.txt” file; b) your report in “Programming Assignment 1 Report” on Gradescope.

4 Resources

1. What is a Makefile and how does it work?: https://opensource.com/article/18/8/what-howmakefile

2. PACE ICE cluster guide: https://docs.pace.gatech.edu/ice cluster/ice-guide/. Documentation for writing a PBS script: https://docs.pace.gatech.edu/software/PBS script guide/

## Reviews

There are no reviews yet.