resource analysis of distributed and concurrent programs
play

Resource Analysis of Distributed and Concurrent Programs Elvira - PowerPoint PPT Presentation

Resource Analysis of Distributed and Concurrent Programs Elvira Albert Complutense University of Madrid (Spain) DICE-FOPARA 2017 April 22-23, 2017, Uppsala, Sweden Elvira Albert, UCM Resource Analysis 1/37 what is resource analysis? The


  1. Resource Analysis of Sequential Code Program (Cost Model) Static Analysis Cost Relations CRs Solver Upper Bound Elvira Albert, UCM Resource Analysis 9/37

  2. Resource Analysis of Sequential Code while (l != null) l = l.next; Program (Cost Model) Static Analysis Static Analysis while ( l ) = k 1 { l =0 } Cost Relations k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = CRs Solver Upper Bound Elvira Albert, UCM Resource Analysis 9/37

  3. Resource Analysis of Sequential Code Program (Cost Model) Static Analysis Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  4. Resource Analysis of Sequential Code Program (Cost Model) Recursive Representation Size Analysis Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  5. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← l = null . Recursive while ( l , l ′ ) ← l � = null , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . Size Analysis Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  6. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . Size Analysis Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  7. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . Size Analysis Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  8. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . Size Analysis Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  9. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← l = null . Recursive while ( l , l ′ ) ← l � = null , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . size 1 ← { l =0 } Size Analysis size 2 ← { l > 0 , l > l ′′ } Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  10. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . size 1 ← { l =0 } Size Analysis size 2 ← { l > 0 , l > l ′′ } Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  11. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . size 1 ← { l =0 } Size Analysis size 2 ← { l > 0 , l > l ′′ } Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  12. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . size 1 ← { l =0 } Size Analysis size 2 ← { l > 0 , l > l ′′ } Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  13. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . size 1 ← { l =0 } Size Analysis size 2 ← { l > 0 , l > l ′′ } Cost Relations Elvira Albert, UCM Resource Analysis 10/37

  14. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . size 1 ← { l =0 } Size Analysis size 2 ← { l > 0 , l > l ′′ } while ( l ) = k 1 { l =0 } Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } Elvira Albert, UCM Resource Analysis 10/37

  15. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . size 1 ← { l =0 } Size Analysis size 2 ← { l > 0 , l > l ′′ } while ( l ) = k 1 { l =0 } Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } Elvira Albert, UCM Resource Analysis 10/37

  16. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . size 1 ← { l =0 } Size Analysis size 2 ← { l > 0 , l > l ′′ } while ( l ) = k 1 { l =0 } Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } Elvira Albert, UCM Resource Analysis 10/37

  17. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . size 1 ← { l =0 } Size Analysis size 2 ← { l > 0 , l > l ′′ } while ( l ) = 1 { l =0 } Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } Elvira Albert, UCM Resource Analysis 10/37

  18. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l , l ) ← while ( l , l ) ← l = null . l = null . Recursive while ( l , l ′ ) ← while ( l , l ′ ) ← l � = null , l � = null , l ′′ = l . next , l ′′ = l . next , Representation while ( l ′′ , l ′ ) . while ( l ′′ , l ′ ) . size 1 ← { l =0 } Size Analysis size 2 ← { l > 0 , l > l ′′ } while ( l ) = 1 { l =0 } Cost Relations while ( l ) = 2 + while ( l ′′ ) { l > 0 , l > l ′′ } Elvira Albert, UCM Resource Analysis 10/37

  19. Resource Analysis of Sequential Code Program (Cost Model) Cost Relations CRs Solver Upper Bound Elvira Albert, UCM Resource Analysis 11/37

  20. Resource Analysis of Sequential Code Program (Cost Model) Cost Relations � CRs Solver Upper Bound Elvira Albert, UCM Resource Analysis 11/37

  21. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l ) = k 1 { l =0 } Cost Relations � � while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } CRs Solver Upper Bound Elvira Albert, UCM Resource Analysis 11/37

  22. Resource Analysis of Sequential Code Program while (l != null) l = l.next; (Cost Model) while ( l ) = k 1 { l =0 } Cost Relations � � while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } CRs Solver Upper Bound k 1 + k 2 ∗ l Elvira Albert, UCM Resource Analysis 11/37

  23. Resource Analysis of Sequential Code Cost Relations CRs Solver Upper Bound Elvira Albert, UCM Resource Analysis 12/37

  24. Resource Analysis of Sequential Code { l =0 } while ( l ) = k 1 Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } Ranking function Maximization Upper Bound Elvira Albert, UCM Resource Analysis 12/37

  25. Resource Analysis of Sequential Code { l =0 } { l =0 } while ( l ) = k 1 while ( l ) = k 1 Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } RF ( l ) = l Ranking function (linear expression on l ) Maximization Upper Bound Elvira Albert, UCM Resource Analysis 12/37

  26. Resource Analysis of Sequential Code { l =0 } { l =0 } { l =0 } while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } RF ( l ) = l Ranking function (linear expression on l ) Maximization remains the same Maximization k 1 and k 2 are constants Upper Bound Elvira Albert, UCM Resource Analysis 12/37

  27. Resource Analysis of Sequential Code { l =0 } { l =0 } { l =0 } { l =0 } while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } RF ( l ) = l Ranking function (linear expression on l ) Maximization remains the same Maximization remains the same Maximization k 1 and k 2 are constants k 1 and k 2 are constants while + ( l ) = cost + bc + RF ( l ) ∗ cost + loop Upper Bound while + ( l ) = k 1 + l ∗ k 2 Elvira Albert, UCM Resource Analysis 12/37

  28. Resource Analysis of Sequential Code { l =0 } { l =0 } { l =0 } { l =0 } { l =0 } while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } RF ( l ) = l Ranking function (linear expression on l ) Maximization remains the same Maximization remains the same Maximization remains the same Maximization k 1 and k 2 are constants k 1 and k 2 are constants k 1 and k 2 are constants while + ( l ) = cost + while + ( l ) = cost + bc + RF ( l ) ∗ cost + bc + RF ( l ) ∗ cost + loop loop Upper Bound while + ( l ) = k 1 + l ∗ k 2 while + ( l ) = k 1 + l ∗ k 2 Elvira Albert, UCM Resource Analysis 12/37

  29. Resource Analysis of Sequential Code { l =0 } { l =0 } { l =0 } { l =0 } { l =0 } { l =0 } while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } RF ( l ) = l RF ( l ) = l Ranking function (linear expression on l ) (linear expression on l ) Maximization remains the same Maximization remains the same Maximization remains the same Maximization remains the same Maximization k 1 and k 2 are constants k 1 and k 2 are constants k 1 and k 2 are constants k 1 and k 2 are constants while + ( l ) = cost + while + ( l ) = cost + while + ( l ) = cost + bc + RF ( l ) ∗ cost + bc + RF ( l ) ∗ cost + bc + RF ( l ) ∗ cost + loop loop loop Upper Bound while + ( l ) = k 1 + l ∗ k 2 while + ( l ) = k 1 + l ∗ k 2 while + ( l ) = k 1 + l ∗ k 2 Elvira Albert, UCM Resource Analysis 12/37

  30. Resource Analysis of Sequential Code { l =0 } { l =0 } { l =0 } { l =0 } { l =0 } { l =0 } { l =0 } while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 while ( l ) = k 1 Cost Relations while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } while ( l ) = k 2 + while ( l ′′ ) { l > 0 , l > l ′′ } RF ( l ) = l RF ( l ) = l RF ( l ) = l Ranking function (linear expression on l ) (linear expression on l ) (linear expression on l ) Maximization remains the same Maximization remains the same Maximization remains the same Maximization remains the same Maximization remains the same Maximization k 1 and k 2 are constants k 1 and k 2 are constants k 1 and k 2 are constants k 1 and k 2 are constants k 1 and k 2 are constants while + ( l ) = cost + while + ( l ) = cost + while + ( l ) = cost + while + ( l ) = cost + bc + RF ( l ) ∗ cost + bc + RF ( l ) ∗ cost + bc + RF ( l ) ∗ cost + bc + RF ( l ) ∗ cost + loop loop loop loop Upper Bound while + ( l ) = k 1 + l ∗ k 2 while + ( l ) = k 1 + l ∗ k 2 while + ( l ) = k 1 + l ∗ k 2 while + ( l ) = k 1 + l ∗ k 2 Elvira Albert, UCM Resource Analysis 12/37

  31. Summary Sequential The process involves a series of transformations and analyses: Transformation into recursive form Size analysis Generation of cost relations Ranking functions and maximization We cover polynomial, exponential, logarithmic complexities From now on: given task m , we assume cost U m Main references: ESOP’07 , SAS’08 Handling fields: SAS’10 , FM’11 Elvira Albert, UCM Resource Analysis 13/37

  32. Part 2: Concurrent Programs Concurrent Programs Elvira Albert, UCM Resource Analysis 14/37

  33. Adding Concurrency Different tasks interleave p execution in the same processor Elvira Albert, UCM Resource Analysis 15/37

  34. Adding Concurrency Different tasks interleave p execution in the same processor m Asynchronous task invocations m( ¯ x ) Elvira Albert, UCM Resource Analysis 15/37

  35. Adding Concurrency Different tasks interleave p execution in the same processor m Asynchronous task invocations m( ¯ x ) release Non-preemptive concurrency by explicitly releasing the processor release release Elvira Albert, UCM Resource Analysis 15/37

  36. Adding Concurrency y x f Different tasks interleave p execution in the same processor m Asynchronous task invocations m( ¯ x ) release Non-preemptive concurrency by explicitly releasing the processor release release Shared memory among the different tasks Elvira Albert, UCM Resource Analysis 15/37

  37. Resource Analysis with interleavings (I) y x f while ( f > 0) { . . . p f = f − 1; r e l e a s e ; } f=3 f=2 f=1 release 1 st approach : assume that f=* shared memory changes after release every release Elvira Albert, UCM Resource Analysis 16/37

  38. Resource Analysis with interleavings (I) y x f while ( f > 0) { . . . p f = f − 1; r e l e a s e ; } f=3 f=2 f=1 release 1 st approach : assume that f=* shared memory changes after release every release f=? Loss of information, poor results → loops based on shared variables cannot be bound. Elvira Albert, UCM Resource Analysis 16/37

  39. Resource Analysis with interleavings (II) p() 1 while ( f > 0) { y x m() f . . . 2 6 x = 3 f = f − 1; 3 7 y = 7; p m r e l e a s e ; 4 5 } f=3 f=2 f=1 release 2 nd approach : use a x=3 y=7 May-Happen-in-Parallel analysis release to infer instructions pairs that can interleave: . . . (4 , 6) , (4 , 7) . . . Elvira Albert, UCM Resource Analysis 17/37

  40. Resource Analysis with interleavings (II) p() 1 while ( f > 0) { y x m() f . . . 2 6 x = 3 f = f − 1; 3 7 y = 7; p m r e l e a s e ; 4 5 } f=3 f=2 f=1 release 2 nd approach : use a x=3 y=7 May-Happen-in-Parallel analysis release f=1 to infer instructions pairs that can interleave: . . . (4 , 6) , (4 , 7) . . . Shared memory can only change if an update can interleave with release → improve results Elvira Albert, UCM Resource Analysis 17/37

  41. Resource Analysis with interleavings (III) p() m() y x f 1 while ( f > 0) { 6 while ( x > 0) { . . . x = x − 1; 2 7 f = f − 1; f = 100; p m 3 8 r e l e a s e ; r e l e a s e ; 4 9 5 } 10 } f=3 f=2 f=1 release 3 rd approach : interleavings that modify shared memory are safe if they can only happen a finite number of times Elvira Albert, UCM Resource Analysis 18/37

  42. Resource Analysis with interleavings (III) p() m() y x f 1 while ( f > 0) { 6 while ( x > 0) { . . . x = x − 1; 2 7 f = f − 1; f = 100; p m 3 8 r e l e a s e ; r e l e a s e ; 4 9 5 } 10 } f=3 f=2 f=1 release x=1 f=100 3 rd approach : interleavings that release modify shared memory are safe if they can only happen a finite number of times Elvira Albert, UCM Resource Analysis 18/37

  43. Resource Analysis with interleavings (III) p() m() y x f 1 while ( f > 0) { 6 while ( x > 0) { . . . x = x − 1; 2 7 f = f − 1; f = 100; p m 3 8 r e l e a s e ; r e l e a s e ; 4 9 5 } 10 } f=3 f=2 f=1 release x=1 f=100 3 rd approach : interleavings that release f=100 f=99 . modify shared memory are safe if . . f=1 release they can only happen a finite number of times Elvira Albert, UCM Resource Analysis 18/37

  44. Resource Analysis with interleavings (III) p() m() y x f 1 while ( f > 0) { 6 while ( x > 0) { . . . x = x − 1; 2 7 f = f − 1; f = 100; p m 3 8 r e l e a s e ; r e l e a s e ; 4 9 5 } 10 } f=3 f=2 f=1 release x=1 f=100 3 rd approach : interleavings that release f=100 f=99 . modify shared memory are safe if . . f=1 release they can only happen a finite x=0 f=100 number of times release Elvira Albert, UCM Resource Analysis 18/37

  45. Resource Analysis with interleavings (III) p() m() y x f 1 while ( f > 0) { 6 while ( x > 0) { . . . x = x − 1; 2 7 f = f − 1; f = 100; p m 3 8 r e l e a s e ; r e l e a s e ; 4 9 5 } 10 } f=3 f=2 f=1 release x=1 f=100 3 rd approach : interleavings that release f=100 f=99 . modify shared memory are safe if . . f=1 release they can only happen a finite x=0 f=100 number of times release f=100 f=99 . . . f=1 release Elvira Albert, UCM Resource Analysis 18/37

  46. Resource Analysis with interleavings (III) p() m() y x f 1 while ( f > 0) { 6 while ( x > 0) { . . . x = x − 1; 2 7 f = f − 1; f = 100; p m 3 8 r e l e a s e ; r e l e a s e ; 4 9 5 } 10 } f=3 f=2 f=1 release x=1 f=100 3 rd approach : interleavings that release f=100 f=99 . modify shared memory are safe if . . f=1 release they can only happen a finite x=0 f=100 number of times release f=100 f=99 . . Rely-guarantee reasoning: . f=1 release max ( f ) × ( max ( x ) + 1) Elvira Albert, UCM Resource Analysis 18/37

  47. Summary Concurrent Programs Basic resource analysis for sound results APLAS’11 May-happen-in-parallel analysis FORTE’12, LPAR’13, SAS’15 Rely-guarantee reasoning ATVA’13, JAR’17 From now on: given a concurrent task m , we assume cost U m Elvira Albert, UCM Resource Analysis 19/37

  48. Part 3: Distributed Systems Distributed Systems Elvira Albert, UCM Resource Analysis 20/37

  49. Adding distribution x X = newLoc to create a distributed location Elvira Albert, UCM Resource Analysis 21/37

  50. Adding distribution x X = newLoc to create a p q distributed location A location has a queue of pending tasks and one active task Elvira Albert, UCM Resource Analysis 21/37

  51. Adding distribution x X = newLoc to create a p q distributed location A location has a queue of pending y tasks and one active task p r Multiple locations can be created dynamically y=newLoc; z=newLoc z u t Elvira Albert, UCM Resource Analysis 21/37

  52. Adding distribution x x X = newLoc to create a p p q m q distributed location A location has a queue of pending y tasks and one active task p r Multiple locations can be created dynamically y=newLoc; z=newLoc Asynchronous tasks can be added z among locations: x.m(w) (in z ) u t Elvira Albert, UCM Resource Analysis 21/37

  53. Resource analysis with cost centers Using cost analysis so far: x C = U p + U q + U m + U r + U p + · · · + U t + U u p q m y p r z u t Elvira Albert, UCM Resource Analysis 22/37

  54. Resource analysis with cost centers Using cost analysis so far: x C = U p + U q + U m + U r + U p + · · · + U t + U u p q m We aim at having the cost at the level of distributed components C x = U p + U q + U m C y = U r + U p . . . y p r z u t Elvira Albert, UCM Resource Analysis 22/37

  55. Resource analysis with cost centers Using cost analysis so far: x C = U p + U q + U m + U r + U p + · · · + U t + U u p q m We aim at having the cost at the level of distributed components C x = U p + U q + U m C y = U r + U p . . . y Idea: use cost centers to separate the cost c ( x ) , c ( y ) , c ( z ) p r z u t Elvira Albert, UCM Resource Analysis 22/37

  56. Resource analysis with cost centers Using cost analysis so far: x C = U p + U q + U m + U r + U p + · · · + U t + U u p q m We aim at having the cost at the level of distributed components C x = U p + U q + U m C y = U r + U p . . . y Idea: use cost centers to separate the cost c ( x ) , c ( y ) , c ( z ) p r When we analyze an instruction i , its cost C i is added to the cost center of the x z component: c ( x ) · C i u t Elvira Albert, UCM Resource Analysis 22/37

  57. Resource analysis with cost centers Using cost analysis so far: x C = U p + U q + U m + U r + U p + · · · + U t + U u p q m We aim at having the cost at the level of distributed components C x = U p + U q + U m C y = U r + U p . . . y Idea: use cost centers to separate the cost c ( x ) , c ( y ) , c ( z ) p r When we analyze an instruction i , its cost C i is added to the cost center of the x z component: c ( x ) · C i u Global cost expression: t c ( x ) · ( U p + U q + U m )+ c ( y ) · ( U r + U p )+ c ( z ) · ( U t + U u ) Elvira Albert, UCM Resource Analysis 22/37

  58. Resource analysis with cost centers Using cost analysis so far: x C = U p + U q + U m + U r + U p + · · · + U t + U u p q m We aim at having the cost at the level of distributed components C x = U p + U q + U m C y = U r + U p . . . y Idea: use cost centers to separate the cost c ( x ) , c ( y ) , c ( z ) p r When we analyze an instruction i , its cost C i is added to the cost center of the x z component: c ( x ) · C i u Global cost expression: t ✭ c ( x ) · ( U p + U q + U m )+ ✭✭✭✭✭ c ( y ) · ( U r + U p )+ ✭✭✭✭✭ ✭ c ( z ) · ( U t + U u ) Elvira Albert, UCM Resource Analysis 22/37

  59. Resource analysis with cost centers Using cost analysis so far: x C = U p + U q + U m + U r + U p + · · · + U t + U u p q m We aim at having the cost at the level of distributed components C x = U p + U q + U m C y = U r + U p . . . y Idea: use cost centers to separate the cost c ( x ) , c ( y ) , c ( z ) p r When we analyze an instruction i , its cost C i is added to the cost center of the x z component: c ( x ) · C i u Global cost expression: t ✭ ✭✭✭✭✭✭✭ c ( x ) · ( U p + U q + U m ) + c ( y ) · ( U r + U p ) + ✭✭✭✭✭ ✭ c ( z ) · ( U t + U u ) Elvira Albert, UCM Resource Analysis 22/37

  60. Resource analysis with cost centers Using cost analysis so far: x C = U p + U q + U m + U r + U p + · · · + U t + U u p q m We aim at having the cost at the level of distributed components C x = U p + U q + U m C y = U r + U p . . . y Idea: use cost centers to separate the cost c ( x ) , c ( y ) , c ( z ) p r When we analyze an instruction i , its cost C i is added to the cost center of the x z component: c ( x ) · C i u Global cost expression: t ✭ ✭✭✭✭✭✭✭ ✭ c ( x ) · ( U p + U q + U m ) + ✭✭✭✭✭ c ( y ) · ( U r + U p ) + c ( z ) · ( U t + U u ) Elvira Albert, UCM Resource Analysis 22/37

  61. Cost centers of different types Cost centers are a general concept that allows us to distinguish within the UB different aspects: x p q m y p r z t u Elvira Albert, UCM Resource Analysis 23/37

  62. Cost centers of different types Cost centers are a general concept that allows us to distinguish within the UB different aspects: x Component cost centers: c ( x ), c ( y ).. p q m y p r z t u Elvira Albert, UCM Resource Analysis 23/37

  63. Cost centers of different types Cost centers are a general concept that allows us to distinguish within the UB different aspects: x Component cost centers: c ( x ), c ( y ).. p q m Program point cost centers: cost center c(pp) per pp:acquire(e) y for (x=0;x<n;x++) pp:acquire(e) c ( pp ) ∗ n ∗ max ( e ) + c ( pp 2) ∗ ... p r z t u Elvira Albert, UCM Resource Analysis 23/37

  64. Cost centers of different types Cost centers are a general concept that allows us to distinguish within the UB different aspects: x Component cost centers: c ( x ), c ( y ).. p q m Program point cost centers: cost center c(pp) per pp:acquire(e) y for (x=0;x<n;x++) pp:acquire(e) c ( pp ) ∗ n ∗ max ( e ) + c ( pp 2) ∗ ... p r Task level centers: cost center c(m) per method z c ( m ) ∗ C m + c ( p ) ∗ ... t u Elvira Albert, UCM Resource Analysis 23/37

  65. Cost centers of different types Cost centers are a general concept that allows us to distinguish within the UB different aspects: x Component cost centers: c ( x ), c ( y ).. p q m Program point cost centers: cost center c(pp) per pp:acquire(e) y for (x=0;x<n;x++) pp:acquire(e) c ( pp ) ∗ n ∗ max ( e ) + c ( pp 2) ∗ ... p r Task level centers: cost center c(m) per method z c ( m ) ∗ C m + c ( p ) ∗ ... t u Multi-component cost centers: cost centers of the form c ( z , x ), i.e., when we find an instruction x.m(w) in z we do c ( z , x ) ∗ size ( w ) Elvira Albert, UCM Resource Analysis 23/37

  66. Part 3: Distributed Systems Parallel Cost Elvira Albert, UCM Resource Analysis 24/37

Recommend


More recommend