24
1 Performance Evaluation When using parallel system the goal of design process is not to optimise a single metric such as a speed. A good design must optimise a problem-specific function of execution time, memory requirements, implementation cost, maintenance cost, resource utilization, etc. The result depends on: used algorithm, computer architecture, execution environment, programming language, etc. The analysis which can be used for application evaluation can be carried out analytically or by experiments When using experimental evaluation we need to measure the run time of sequential and parallel programs Is it possible to evaluate parallel program by executing only parallel version of the program on parallel computer ? 1

Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

1

Performance Evaluation

When using parallel system the goal of design process is not to optimise a single metric such as a speed. A good design must optimise a problem-specific function of execution time, memory requirements, implementation cost, maintenance cost, resource utilization, etc.

The result depends on: used algorithm, computer architecture, execution environment, programming language, etc.

The analysis which can be used for application evaluation can be carried out analytically or by experiments

When using experimental evaluation we need to measure the run time of sequential and parallel programs

Is it possible to evaluate parallel program by executing only parallel version of the program on parallel computer ?

1

Page 2: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

2 2

Prawo Amdhala

Kiedy wykonujemy program równoległy możemy wyróżnić dwie części: część sekwencyjną (Pseq), która musi się wykonywać tylko na jednym procesorze oraz część równoległą (1-Pseq), która jest wykonywana niezależnie na wielu procesorach.

Załóżmy, że jeśli wykonujemy ten program na jednym procesorze czas jego wykonania wynosi t1 (czas wykonania sekwencyjnego). Niech p oznacza liczbę procesorów użytych podczas równoległego wykonania programu, wtedy jego czas wykonania równoległego wyraża się wzorem:

Stąd przyspieszenie wyraża się wzorem

T t P P t ppar seq seq 1 11* ( ) /

St

t P P t p Pseq seq seq

1

1 11

1

* ( ) * /

Page 3: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

3 3

„Prawo” Gustafsona

Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża się wzorem Pseq + Ppar = 1, gdzie Pseq oznacza sekwencyjną część programu, a Ppar równoległą.

Czas wykonania sekwencyjnego (z użyciem jednego procesora) wynosi Pseq + p*Ppar

Stąd otrzymujemy następująca formułę na przyspieszenie

SP p P

P PP p P p PG

seq par

seq par

seq par par

** *

Page 4: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

4 4

Amdahl’s Law – hardware approach

Amdahl’s Law states that the performance improvement to be gained from using some faster mode of execution is limited by the fraction of the time the faster mode can be used.

Amdahl’s Law defines the speedup that can be gained by using a particular feature.

Page 5: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

5 5

What is speedup?

Suppose that we can make an enhancement to a machine that will improve performance when it is used. Speedup is the ratio:

• Alternatively

• Speedup tells us how much faster a task will run using the machine with the enhancement as opposed to the original one

Page 6: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

6 6

What Amdahl’s Law says ?

Amdahl’s Law gives us a quick way to find the speedup from some enhancement, which depends on two factors:

The fraction of the computation time in the original machine that can be converted to take advantage of the enhancement – For example, if 20 seconds of the execution time of a program that takes 60

seconds in total can use an enhancement, the fraction is 20/60. This value, which we will call Fraction enhanced, is always less than or equal to 1.

The improvement gained by the enhanced execution mode; that is, how much faster the task would run if the enhanced mode were used for the entire program – This value is the time of the original mode over the time of the enhanced

mode: If the enhanced mode takes 2 seconds for some portion of the program that can completely use the mode, while the original mode took 5 seconds for the same portion, the improvement is 5/2. We will call this value, which is always greater than 1, speedup (enhanced).

Page 7: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

7 7

How we calculate a speedup ?

The execution time using the original machine with the enhanced mode will be the time spent using the unenhanced portion of the machine plus the time spent using the

enhancement:

The overall speedup is the ratio of the execution times:

Page 8: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

8 8

An Example

Suppose that we are considering an enhancement to the processor of a server system used for Web serving. The new CPU is 10 times faster on computation in the Web serving application than the original processor.

Assuming that the original CPU is busy with computation 40% of the time and is waiting for I/O 60% of the time, what is the overall speedup gained by incorporating the enhancement?

Page 9: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

9 9

An Example

Implementations of floating-point (FP) square root vary significantly in performance, especially among processors designed for graphics.

Suppose FP square root (FPSQR) is responsible for 20% of the execution time of a critical graphics benchmark. One proposal is to enhance the FPSQR hardware and speedup this operation by a factor of 10. The other alternative is just to try to make all FP instructions in the graphics processor run faster by a factor of 1.6.

FP instructions are responsible for a total of 50% of the execution time for the application. The design team believes that they can make all FP instructions run 1.6 times faster with the same effort as required for the fast square root.

Page 10: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

10

Execution efficiency

One of the most important characteristics of a parallel application execution:

Useful for resource allocation, application scheduling, load balancing, execution time prediction etc.

Information about the runtime on a single processor required

10

ppT

T

p

pSppE

)(

)1()()(

Page 11: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

11 11

Skalowalność Systemów Równoległych

Rozważmy problem dodawania n liczb z wykorzystaniem architektury Hypercube

W pierwszym kroku każdy z procesorów dodaje lokalnie n/p liczb, w kolejnych krokach połowa z wyliczonych sum częściowych jest przesyłana do sąsiednich procesorów i następnie wykonywana jest operacja dodawania. Procedura się kończy gdy jeden wyróżniony procesor wyliczy sumę końcową (p oznacza liczbę procesorów)

Załóżmy, że czasy dodania dwóch liczb oraz komunikacji pomiędzy sąsiednimi procesorami są równe i wynoszą jedną umowną jednostkę czasu.

Stąd dodanie n/p liczb na każdym z procesorów wynosi n/p - 1

Podobnie „p” sum częściowych jest dodawanych w log2p krokach (jedno dodawanie i jedno przesłanie)

Page 12: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

12 12

Skalowalność Systemów Równoległych

Stąd łączny czas przetwarzania równoległego może być aproksymowany przez:

Ponieważ czas wykonania sekwencyjnego można aproksymować przez n wzory na przyspieszenie i efektywność są następujące:

Powyższe równania mogą być użyte do wyliczenia przyspieszenia i efektywności dla każdej pary n i p.

Sn p

n p p

*

log2E

n

n p p

2 log

T np pp 2log

Page 13: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

13 13

Skalowalność Systemów Równoległych

n = 320

n = 64

n = 192

n = 512 zależność liniowa

p

S

Przyśpieszenie w funkcji liczby procesorów

Page 14: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

14 14

Skalowalność Systemów Równoległych

Efektywność jako funkcja n i p

n p = 1 p = 4 p = 8 p = 16 p = 32

64 1.0 0.80 0.57 0.33 0.17

192 1.0 0.92 0.80 0.60 0.38

320 1.0 0.95 0.87 0.71 0.50

512 1.0 0.97 0.91 0.80 0.62

Dla danego problemu o stałym rozmiarze, przyspieszenie nie rośnie liniowo wraz ze zwiększającą się liczba procesorów

Dla stałej liczby procesorów rośnie przyspieszenie i efektywność gdy zwiększamy rozmiaru problemu.

Page 15: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

15 15

Skalowalność Systemów Równoległych

System równoległy jest skalowalny jeśli utrzymuje stałą efektywność przy jednoczesnym zwiększanie się liczby procesorów oraz rozmiaru problemu.

Skalowalność systemu równoległego jest miarą jego zdolności do zwiększenia przyśpieszenia proporcjonalnie do liczby procesorów.

Skalowalność odzwierciedla zdolność systemu równoległego do efektywnego wykorzystania zwiększającej się liczby procesorów.

Page 16: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

16

Scalability

16

Scalable programs remain efficient for large number of processors

Page 17: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

17

Scalability

The scalability of a parallel application shows the relation between application execution time and the number of application utilized resources (nodes)

Scalability is referred to as strong when an application input problem size stays constant independently from the number of compute nodes which are utilized to solve the problem

Scalability is referred to as weak when the input problem size of the application is fixed for each utilized computer nodes

17

Page 18: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

18

Scalability

• Strong scalability is related to Amdahl Law

• Weak scalability is related to Gustafson Law

18

n

pp

nT

TnSpeedup

)1(

1

)(

)1()(

*)1(1)(

)1()( pn

nT

TnSpeedup

Page 19: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

19

Granularity

A study of granularity is important if one is going to choose the most efficient architecture of parallel hardware for the algorithm at hand

The granularity of a parallel computer is defined as a ratio of the time required for a basic communication operation to the time required for a basic computation operation.

Basing on that definition the parallel computers can be classified by three relative values: coarse-grain, medium-grain and fine-grain.

For parallel algorithms granularity is defined as a number of instructions that can be performed concurrently before some form of synchronisation needs to take place.

From the other hand the granularity of the parallel algorithm can be defined as a relative measure of the ratio of the amount of computation to the amount of communication within a parallel algorithm implementation

COMM

COMP

T

TG

Page 20: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

20

Performance Evaluation Using Granularity

The parallel run time is composed as average of three different components: computation time, communication time and idle time, so it can be expressed by the following expression:

Let’s define the overhead function as follows:

where W represents the problem size, Tp time of parallel program execution and p a number of processors.

T W p p T Wo p( , ) *

Tp

T T Tcomp

i

i

p

comm

i

i

p

idle

i

i

p

1

0

1

0

1

0

1

( )

Page 21: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

21

Performance Evaluation Using Granularity

The problem size is defined as a number of basic computation operation required to solve the problem using the best serial algorithm. Let’s assume that one basic computation operation takes one unit of time. It causes that the problem size is equal to the time of performing the best serial algorithm on a serial computer.

Then after rewriting above equitation the parallel run time is expressed by:

The resulting expressions for efficiency takes the form:

TW T W p

pp

o ( , )

ET W p

W

o

1

1( , )

Page 22: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

22

Performance Evaluation Using Granularity

When assuming that the main overhead during parallel program execution is communication time we can rewrite equation for efficiency in the following way:

The total communication time is equal to sum of communication time of all performed communication steps.

ET

W

TOTAL COMM

1

1_

T p TTOTAL COMM COMM_ *

Page 23: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

23

Performance Evaluation Using Granularity

The problem size W is equal to the time performing the best serial algorithm is:

By substituting problem size and total communication time by above equations we get:

It means that using granularity it is possible to evaluate parallel program using such metrics like efficiency and speedup by executing only parallel version of program on parallel computer.

W p TCOMP *

ET

T G

G

GCOMM

COMP

1

1

1

11 1

Page 24: Industrial Software Engineeringkwiatkow/prog_row_roz/wyk4.pdf · 3 3 „Prawo” Gustafsona Załóżmy, że czas wykonania programu równoległego z uzyciem p procesorów wyraża

24

Used speedup and efficiency are relative - it means that Tseq is the execution

time of parallel algorithm executing on one of the processors of parallel

computer

Isogranularity instead of granularity were used

The results were normalised, using the idea of virtual processor

1

1)(S

SpVP

p

i i )( pVP

SpeedupSvt

IDLECOMM

COMP

TT

TG