Performance Evaluation When using arallel system the goal of design rocess is not to otimise a single metric such as a seed. A good design must otimise a roblem-secific function of execution time, memory requirements, imlementation cost, maintenance cost, resource utilization, etc. The result deends on: used algorithm, comuter architecture, execution environment, rogramming language, etc. The analysis which can be used for alication evaluation can be carried out analytically or by exeriments When using exerimental evaluation we need to measure the run time of sequential and arallel rograms Is it ossible to evaluate arallel rogram by executing only arallel version of the rogram on arallel comuter? Prawo Amdhala Kiedy wykonujemy rogram równoległy możemy wyróżnić dwie części: część sekwencyjną (Pseq), która musi się wykonywać tylko na jednym rocesorze oraz część równoległą (-Pseq), która jest wykonywana niezależnie na wielu rocesorach. Załóżmy, że jeśli wykonujemy ten rogram na jednym rocesorze czas jego wykonania wynosi t (czas wykonania sekwencyjnego). Niech oznacza liczbę rocesorów użytych odczas równoległego wykonania rogramu, wtedy jego czas wykonania równoległego wyraża się wzorem: T t * P ( P ) t / ar seq seq Stąd rzysieszenie wyraża się wzorem t S t * P ( P ) * t / P seq seq seq 2 2 Prawo Gustafsona Załóżmy, że czas wykonania rogramu równoległego z uzyciem rocesorów wyraża się wzorem Pseq + Par =, gdzie Pseq oznacza sekwencyjną część rogramu, a Par równoległą. Czas wykonania sekwencyjnego (z użyciem jednego rocesora) wynosi Pseq + *Par Stąd otrzymujemy nastęująca formułę na rzysieszenie S G Pseq * P P P seq ar ar P * P * P seq ar ar 3 3 Page
Amdahl s Law hardware aroach Amdahl s Law states that the erformance imrovement 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 seedu that can be gained by using a articular feature. 4 4 What is seedu? Suose that we can make an enhancement to a machine that will imrove erformance when it is used. Seedu is the ratio: Alternatively Seedu tells us how much faster a task will run using the machine with the enhancement as oosed to the original one 5 5 What Amdahl s Law says? Amdahl s Law gives us a quick way to find the seedu from some enhancement, which deends on two factors: The fraction of the comutation time in the original machine that can be converted to take advantage of the enhancement For examle, if 20 seconds of the execution time of a rogram 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. The imrovement gained by the enhanced execution mode; that is, how much faster the task would run if the enhanced mode were used for the entire rogram 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 ortion of the rogram that can comletely use the mode, while the original mode took 5 seconds for the same ortion, the imrovement is 5/2. We will call this value, which is always greater than, seedu (enhanced). 6 6 Page 2 2
How we calculate a seedu? The execution time using the original machine with the enhanced mode will be the time sent using the unenhanced ortion of the machine lus the time sent using the enhancement: The overall seedu is the ratio of the execution times: 7 7 An Examle Suose that we are considering an enhancement to the rocessor of a server system used for Web serving. The new CPU is 0 times faster on comutation in the Web serving alication than the original rocessor. Assuming that the original CPU is busy with comutation 40% of the time and is waiting for I/O 60% of the time, what is the overall seedu gained by incororating the enhancement? 8 8 An Examle Imlementations of floating-oint (FP) square root vary significantly in erformance, esecially among rocessors designed for grahics. Suose FP square root (FPSQR) is resonsible for 20% of the execution time of a critical grahics benchmark. One roosal is to enhance the FPSQR hardware and seedu this oeration by a factor of 0. The other alternative is just to try to make all FP instructions in the grahics rocessor run faster by a factor of.6. FP instructions are resonsible for a total of 50% of the execution time for the alication. The design team believes that they can make all FP instructions run.6 times faster with the same effort as required for the fast square root. 9 9 Page 3 3
Execution efficiency One of the most imortant characteristics of a arallel alication execution: S( ) T() E( ) T( ) Useful for resource allocation, alication scheduling, load balancing, execution time rediction etc. Information about the runtime on a single rocessor required 0 0 Rozważmy roblem dodawania n liczb z wykorzystaniem architektury Hyercube W ierwszym kroku każdy z rocesorów dodaje lokalnie n/ liczb, w kolejnych krokach ołowa z wyliczonych sum częściowych jest rzesyłana do sąsiednich rocesorów i nastęnie wykonywana jest oeracja dodawania. Procedura się kończy gdy jeden wyróżniony rocesor wyliczy sumę końcową ( oznacza liczbę rocesorów) Załóżmy, że czasy dodania dwóch liczb oraz komunikacji omiędzy sąsiednimi rocesorami są równe i wynoszą jedną umowną jednostkę czasu. Stąd dodanie n/ liczb na każdym z rocesorów wynosi n/ - Podobnie sum częściowych jest dodawanych w log 2 krokach (jedno dodawanie i jedno rzesłanie) Stąd łączny czas rzetwarzania równoległego może być aroksymowany rzez: Ponieważ czas wykonania sekwencyjnego można aroksymować rzez n wzory na rzysieszenie i efektywność są nastęujące: n S * n 2 log T n 2log n E n 2 log Powyższe równania mogą być użyte do wyliczenia rzysieszenia i efektywności dla każdej ary n i. 2 2 Page 4 4
5 S zależność liniowa n = 52 n = 320 n = 92 n = 64 Przyśieszenie w funkcji liczby rocesorów 3 3 Efektywność jako funkcja n i n = = 4 = 8 = 6 = 32 64.0 0.80 0.57 0.33 0.7 92.0 0.92 0.80 0.60 0.38 320.0 0.95 0.87 0.7 0.50 52.0 0.97 0.9 0.80 0.62 Dla danego roblemu o stałym rozmiarze, rzysieszenie nie rośnie liniowo wraz ze zwiększającą się liczba rocesorów Dla stałej liczby rocesorów rośnie rzysieszenie i efektywność gdy zwiększamy rozmiaru roblemu. 4 4 System równoległy jest skalowalny jeśli utrzymuje stałą efektywność rzy jednoczesnym zwiększanie się liczby rocesorów oraz rozmiaru roblemu. Skalowalność systemu równoległego jest miarą jego zdolności do zwiększenia rzyśieszenia roorcjonalnie do liczby rocesorów. Skalowalność odzwierciedla zdolność systemu równoległego do efektywnego wykorzystania zwiększającej się liczby rocesorów. 5 5 Page 5
Scalability Scalable rograms remain efficient for large number of rocessors 6 6 Scalability The scalability of a arallel alication shows the relation between alication execution time and the number of alication utilized resources (nodes) Scalability is referred to as strong when an alication inut roblem size stays constant indeendently from the number of comute nodes which are utilized to solve the roblem Scalability is referred to as weak when the inut roblem size of the alication is fixed for each utilized comuter nodes 7 7 Scalability Strong scalability is related to Amdahl Law T() Seedu ( n) T( n) ( ) n 8 Weak scalability is related to Gustafson Law T() Seedu ( n) ( n ) * T( n) 8 Page 6 6
Granularity 9 A study of granularity is imortant if one is going to choose the most efficient architecture of arallel hardware for the algorithm at hand The granularity of a arallel comuter is defined as a ratio of the time required for a basic communication oeration to the time required for a basic comutation oeration. Basing on that definition the arallel comuters can be classified by three relative values: coarse-grain, medium-grain and fine-grain. For arallel algorithms granularity is defined as a number of instructions that can be erformed concurrently before some form of synchronisation needs to take lace. From the other hand the granularity of the arallel algorithm can be defined as a relative measure of the ratio of the amount of comutation to the amount of communication within a arallel algorithm imlementation TCOMP G TCOMM Performance Evaluation Using Granularity 20 The arallel run time is comosed as average of three different comonents: comutation time, communication time and idle time, so it can be exressed by the following exression: Let s define the overhead function as follows: T ( W, ) * T W o i i i T ( Tcom Tcomm Tidle ) i0 i0 i0 where W reresents the roblem size, T time of arallel rogram execution and a number of rocessors. Performance Evaluation Using Granularity 2 The roblem size is defined as a number of basic comutation oeration required to solve the roblem using the best serial algorithm. Let s assume that one basic comutation oeration takes one unit of time. It causes that the roblem size is equal to the time of erforming the best serial algorithm on a serial comuter. Then after rewriting above equitation the arallel run time is exressed by: T W To ( W, ) The resulting exressions for efficiency takes the form: E To ( W, ) W Page 7 7
Performance Evaluation Using Granularity When assuming that the main overhead during arallel rogram execution is communication time we can rewrite equation for efficiency in the following way: E T TOTAL _ COMM The total communication time is equal to sum of communication time of all erformed communication stes. W T T TOTAL _ COMM * COMM 22 Performance Evaluation Using Granularity The roblem size W is equal to the time erforming the best serial algorithm is: W * T COMP By substituting roblem size and total communication time by above equations we get: G E TCOMM G TCOMP G It means that using granularity it is ossible to evaluate arallel rogram using such metrics like efficiency and seedu by executing only arallel version of rogram on arallel comuter. 23 Used seedu and efficiency are relative - it means that Tseq is the execution time of arallel algorithm executing on one of the rocessors of arallel comuter Isogranularity instead of granularity were used G T The results were normalised, using the idea of virtual rocessor i Si Seedu VP( ) S vt S VP( ) TCOMP T COMM IDLE 24 Page 8 8