Upload
kristin-stevens
View
216
Download
0
Embed Size (px)
Citation preview
Homework 3:
OpenMP and
Performance Evaluation
1) Parallelize the following piece of code in OpenMP (pencil and paper):
READ *,n
w = 1/n
sum = 0
DO i=1,n
x = w * (i-0.5)
sum = sum + 4/(1+x*x)
ENDDO
1) Parallelize the following piece of code in OpenMP (pencil and paper):
READ *,n
w = 1/n
sum = 0
!$OMP PARALLEL DO (private(x), shared(w),reduction(+:sum))
DO i=1,n
x = w * (i-0.5)
sum = sum + 4/(1+x*x)
ENDDO
!$OMP END PARALLEL DO
2) Performance Evaluation - Mean Values
• The following table shows the results of 3 different benchmarks on 3 different systems:
• System Code 1 Code 2 Code 3A 1 1 40 B 2 2 30C 4 4 4
• By using different mean values show that:
• a) System A is best
• b) System B is best
• c) System C is best
2) Performance Evaluation - Mean Values
• The following table shows the results of 3 different benchmarks on 3 different systems:
• System Code 1 Code 2 Code 3 arith harm geom A 1 1 40 14.0 1.5 3.4 B 2 2 30 11.3 2.9 4.9C 4 4 4 4.0 4.0 4.0
• By using different mean values show that:
• a) System A is best - arithmetic mean.
• b) System B is best - geometric mean.
• c) System C is best - harmonic mean.
3) Performance Evaluation - Regression
• The following table shows the results of a communication benchmark for different message length:
• Prepare and analyse the data and discuss:– a) Is linear regression appropriate to analyse
these results?
– b) Calculate slope and intersection for a linear regression (and R2 - if you like).
Length Time [s]10 1.95E-05 40 2.15E-05 50 1.91E-05 70 9.24E-05 80 2.51E-05 100 2.27E-05 200 2.79E-05 400 3.23E-05 600 3.67E-05 1000 4.03E-05 2000 5.99E-05 5000 1.08E-04 10000 2.37E-04
3) Performance Evaluation - Regression
• The following table shows the results of a communication benchmark for different message length:
• Prepare and analyse the data and discuss:– a) Is linear regression appropriate to analyse
these results?
• Yes - based on graph (next slide)– b) Calculate slope and intersection for a
linear regression (and R2 - if you like).
• Intersection: 2.04 E-5
• Slope: 2.08 E-8
• R2: 0.9906
Length Time [s]10 1.95E-05 40 2.15E-05 50 1.91E-05 70 9.24E-05 80 2.51E-05 100 2.27E-05 200 2.79E-05 400 3.23E-05 600 3.67E-05 1000 4.03E-05 2000 5.99E-05 5000 1.08E-04 10000 2.37E-04
3) Performance Evaluation - Regression
All points: y = 1.98E-08x + 2.73E-05
R2 = 8.90E-01
No Outlier: y = 2.08E-08x + 2.03E-05
R2 = 9.91E-01
0.0E+00
5.0E-05
1.0E-04
1.5E-04
2.0E-04
2.5E-04
0 1000
2000 3000
4000 5000
6000 7000
8000 9000
10000
Outlier