CSC718 – Homework 2 OpenMPI Programming Assignments (Solution)

$ 35.00
Category:

Description

The homework assignment will be graded based on the following criteria:
• Accuracy: 1) the solution meets specific requirements in the problem description; 2) the solution produces correct results; 2) the procedures adopted in the solution are technically sound.
• Efficiency: efficiency will be one of the criteria when grading programing assignment. The solution should produce the desired results efficiently.
• Effort/neatness: the solution includes excellent effort, and all relate work is shown neatly and organized well.
Homework assignment feedback will be available through the DropBox folder on D2L.
For all the programming assignments, you can choose any operating systems you want. I will usually provide C/C++ samples for the programming assignments. If you prefer to use other languages, e.g., Java, they are accepted too. A README.txt is required to submit any programming assignments. In the README.txt, you need to provide the following information:
1) How to compile your program?
2) How to run your program?
3) What is the average running time of your program?
4) What are the expected output results when I run your program?
5) Any descriptions which may help me to compile, run, and verify your answers. (FYI: I check every programming assignment turned in!)
Zip all you source code, project files, supporting files, and README.txt and submit the all-in-one zip file together to the D2L Dropbox. If you have any questions about the homework, please let me know.

(20 points) Programming Assignment 1: A prime number is a positive integer evenly divisible by exactly two positive integers: itself and 1. The first five prime numbers are 2, 3, 5, 7, and 11. Sometimes two consecutive odd numbers are both prime. For example, the odd integers following 3, 5, 11 are all prime numbers. Write a sequential program to determine for all integers less than 1,000,000, the number of times that two consecutive odd integers are both prime numbers.

(30 points) Programming Assignment 2: A prime number is a positive integer evenly divisible by exactly two positive integers: itself and 1. The first five prime numbers are 2, 3, 5, 7, and 11. Sometimes two consecutive odd numbers are both prime. For example, the odd integers following 3, 5, 11 are all prime numbers. Write a parallel program using openMPI to determine for all integers less than 1,000,000, the number of times that two consecutive odd integers are both prime numbers.

(30 points) Programming Assignment 3: The gap between consecutive prime numbers 2 and 3 is only 1, while the gap between consecutive primes 7 and 11 is 4. Write a parallel program using openMPI to determine, for all integers less than 1,000,000, the largest gap between a pair of consecutive prime numbers.

(20 points) Programming Assignment 4: The value of the definite integral
1 4
0 1 +2
is π . We can use numerical integration to compute π by approximating the area under the curve. A simple way to do this is called the rectangle rule (Figure 4.7). We divide the interval [0, 1] into k subintervals of equal size. We find the height of the curve at the midpoint of each of these subintervals. With these heights we can construct k rectangles. The area of the rectangles approximates the area under the curve. As k increases, the accuracy of the estimate also increases.

A C program that uses the rectangle rule to approximate π appears in Figure 4.8. Write a parallel MPI program to computer π using the rectangle rule with 1,000,000 intervals. (Use the virtual cluster provided in the class to develop and test the program.)

Figure 4.8 A C program to compute the value of π using the rectangle rule.
For each programming assignment, you need to write the code, and run it on Rushmore Cluster to get the running time for the following number of processors: 1, 2, 3, 4. Put this into a table to see the performance difference by parallel computing.
Benchmark running on Rushmore with different number of processors.
Problem Np=1 Np=2 Np=3 Np=4
Program1.c
Program2.c
Program3.c
Program4.c

Reviews

There are no reviews yet.

Be the first to review “CSC718 – Homework 2 OpenMPI Programming Assignments (Solution)”

Your email address will not be published. Required fields are marked *