A Pattern-based Transformation Approach to Parallelise Software - - PowerPoint PPT Presentation

a pattern based transformation approach to parallelise
SMART_READER_LITE
LIVE PREVIEW

A Pattern-based Transformation Approach to Parallelise Software - - PowerPoint PPT Presentation

A Pattern-based Transformation Approach to Parallelise Software Systems using a System Dependency Graph Johanna E. Krause 27 January 2016 Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 1 / 37 Outline 1.


slide-1
SLIDE 1

A Pattern-based Transformation Approach to Parallelise Software Systems using a System Dependency Graph

Johanna E. Krause 27 January 2016

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 1 / 37

slide-2
SLIDE 2

Outline

  • 1. Motivation
  • 2. Goals
  • 3. Approach

Mining of Candidate and Parallelisation Patterns Formalising Candidate Patterns Transformation

  • 4. Live Demonstration
  • 5. Evaluation
  • 6. Conclusion and Future Work

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 2 / 37

slide-3
SLIDE 3

Motivation for (Semi-)Automatic Parallelisation

Motivation

◮ Parallel programs are mostly more performant

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 3 / 37

slide-4
SLIDE 4

Motivation for (Semi-)Automatic Parallelisation

Motivation

◮ Parallel programs are mostly more performant ◮ Many legacy systems would benefit from parallelisation

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 3 / 37

slide-5
SLIDE 5

Motivation for (Semi-)Automatic Parallelisation

Motivation

◮ Parallel programs are mostly more performant ◮ Many legacy systems would benefit from parallelisation ◮ Manual adjustments are time and cost consuming

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 3 / 37

slide-6
SLIDE 6

Goals

Overall Approach

Goals

Christian Wulf ― 18.02.2015

Legend: S1: SDG Construction S2: Gathering S3: SDG Enrichment S4: Ranking S5: Pattern Detection S6: Transformation S7: Code Generation System dependency graph (SDG) Parallelism plan

S4 S6 S5

Semi-automatic transformation

Runtime information Static information

Parallelization pattern Candidate pattern Sequential program Parallel program

S7 S3

Figure 1 :

Pattern-based detection and utilization of potential parallelism in software systems [Wulf14] Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 4 / 37

slide-7
SLIDE 7

Goals

Goals

◮ Goal 1: Mining of Candidate and Parallelisation Patterns

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 5 / 37

slide-8
SLIDE 8

Goals

Goals

◮ Goal 1: Mining of Candidate and Parallelisation Patterns ◮ Goal 2: Formalising Candidate Patterns

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 5 / 37

slide-9
SLIDE 9

Goals

Goals

◮ Goal 1: Mining of Candidate and Parallelisation Patterns ◮ Goal 2: Formalising Candidate Patterns

◮ G2.1: Formalising as System Dependency Graph (SDG) Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 5 / 37

slide-10
SLIDE 10

Goals

Goals

◮ Goal 1: Mining of Candidate and Parallelisation Patterns ◮ Goal 2: Formalising Candidate Patterns

◮ G2.1: Formalising as System Dependency Graph (SDG) ◮ G2.2: Formalising as Cypher Match Query (CMQ) Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 5 / 37

slide-11
SLIDE 11

Goals

Goals

◮ Goal 1: Mining of Candidate and Parallelisation Patterns ◮ Goal 2: Formalising Candidate Patterns

◮ G2.1: Formalising as System Dependency Graph (SDG) ◮ G2.2: Formalising as Cypher Match Query (CMQ)

◮ Goal 3: Transforming Candidate Patterns to Parallelisation

Patterns

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 5 / 37

slide-12
SLIDE 12

Goals

Goals

◮ Goal 1: Mining of Candidate and Parallelisation Patterns ◮ Goal 2: Formalising Candidate Patterns

◮ G2.1: Formalising as System Dependency Graph (SDG) ◮ G2.2: Formalising as Cypher Match Query (CMQ)

◮ Goal 3: Transforming Candidate Patterns to Parallelisation

Patterns

◮ G3.1: Formalising as SDG Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 5 / 37

slide-13
SLIDE 13

Goals

Goals

◮ Goal 1: Mining of Candidate and Parallelisation Patterns ◮ Goal 2: Formalising Candidate Patterns

◮ G2.1: Formalising as System Dependency Graph (SDG) ◮ G2.2: Formalising as Cypher Match Query (CMQ)

◮ Goal 3: Transforming Candidate Patterns to Parallelisation

Patterns

◮ G3.1: Formalising as SDG ◮ G3.2: Formalising as Cypher Update Query (CUQ) Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 5 / 37

slide-14
SLIDE 14

Goals

Goals

◮ Goal 1: Mining of Candidate and Parallelisation Patterns ◮ Goal 2: Formalising Candidate Patterns

◮ G2.1: Formalising as System Dependency Graph (SDG) ◮ G2.2: Formalising as Cypher Match Query (CMQ)

◮ Goal 3: Transforming Candidate Patterns to Parallelisation

Patterns

◮ G3.1: Formalising as SDG ◮ G3.2: Formalising as Cypher Update Query (CUQ)

◮ Goal 4: Evaluating the Speed-Up of the Transformed

Application

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 5 / 37

slide-15
SLIDE 15

Approach for the Thesis

Approach

Neo4J

Database

JAVA JAVA

MATCH (node1)

  • [:related_to]->

(node2) WHERE ... RETURN node1, node2

Cypher Match Query

MATCH node... WHERE ... CREATE/DELETE ... RETURN node...

Cypher Update Query

Candidate Pattern Parallelisation Pattern

Pattern Mining

choose prototype formalise pattern formalise transformation create SDG generate execute Sequential Program Parallelised Program Resulting candidates: 1) 2) ... parallelise execute 1. 2. 3. 0. Evaluation 4.

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 6 / 37

slide-16
SLIDE 16

Solving Goal 1: Pattern Mining

Approach ⊲ Mining of Candidate and Parallelisation Patterns

Independent Successive Method Calls

❞❛t❛s❡r✈❡r✳❝♦♥♥❡❝t ✭✮❀ ❡✈❡♥ts❡r✈❡r✳❝♦♥♥❡❝t ✭✮❀ ❢♦r ✭ ■♠♣♦rt❛♥t❖❜❥❡❝t ♦ ✿ ❧✐st✮ ④ r❡s✉❧t ❂ ❝❛❧❝✉❧❛t❡❙♦♠❡t❤✐♥❣❋♦r◗✉✐t❡❆❲❤✐❧❡ ✭♦✮❀ ✇r✐t❡❘❡s✉❧t■♥❉❛t❛❜❛s❡ ✭r❡s✉❧t ✮❀ ⑥ ✐♥t s✉♠ ❂ ✵❀ ❢♦r ✭✐♥t ✐ ❂ ✵❀ ✐ ❁ ❛rr❛②✳❧❡♥❣t❤❀ ✐✰✰✮ ④ s✉♠ ❂ s✉♠ ✰ ❛rr❛②❬✐❪❀ ⑥

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 7 / 37

slide-17
SLIDE 17

Solving Goal 1: Pattern Mining

Approach ⊲ Mining of Candidate and Parallelisation Patterns

Independent Successive Method Calls

❞❛t❛s❡r✈❡r✳❝♦♥♥❡❝t ✭✮❀ ❡✈❡♥ts❡r✈❡r✳❝♦♥♥❡❝t ✭✮❀

Independent For-Each Loop

❢♦r ✭ ■♠♣♦rt❛♥t❖❜❥❡❝t ♦ ✿ ❧✐st✮ ④ r❡s✉❧t ❂ ❝❛❧❝✉❧❛t❡❙♦♠❡t❤✐♥❣❋♦r◗✉✐t❡❆❲❤✐❧❡ ✭♦✮❀ ✇r✐t❡❘❡s✉❧t■♥❉❛t❛❜❛s❡ ✭r❡s✉❧t ✮❀ ⑥ ✐♥t s✉♠ ❂ ✵❀ ❢♦r ✭✐♥t ✐ ❂ ✵❀ ✐ ❁ ❛rr❛②✳❧❡♥❣t❤❀ ✐✰✰✮ ④ s✉♠ ❂ s✉♠ ✰ ❛rr❛②❬✐❪❀ ⑥

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 7 / 37

slide-18
SLIDE 18

Solving Goal 1: Pattern Mining

Approach ⊲ Mining of Candidate and Parallelisation Patterns

Independent Successive Method Calls

❞❛t❛s❡r✈❡r✳❝♦♥♥❡❝t ✭✮❀ ❡✈❡♥ts❡r✈❡r✳❝♦♥♥❡❝t ✭✮❀

Independent For-Each Loop

❢♦r ✭ ■♠♣♦rt❛♥t❖❜❥❡❝t ♦ ✿ ❧✐st✮ ④ r❡s✉❧t ❂ ❝❛❧❝✉❧❛t❡❙♦♠❡t❤✐♥❣❋♦r◗✉✐t❡❆❲❤✐❧❡ ✭♦✮❀ ✇r✐t❡❘❡s✉❧t■♥❉❛t❛❜❛s❡ ✭r❡s✉❧t ✮❀ ⑥

Array Reduction

✐♥t s✉♠ ❂ ✵❀ ❢♦r ✭✐♥t ✐ ❂ ✵❀ ✐ ❁ ❛rr❛②✳❧❡♥❣t❤❀ ✐✰✰✮ ④ s✉♠ ❂ s✉♠ ✰ ❛rr❛②❬✐❪❀ ⑥

[Molitorisz12, Mattson04]

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 7 / 37

slide-19
SLIDE 19

Solving Goal 1: Pattern Mining

Approach ⊲ Mining of Candidate and Parallelisation Patterns

Independent Successive Method Calls

❞❛t❛s❡r✈❡r✳❝♦♥♥❡❝t ✭✮❀ ❡✈❡♥ts❡r✈❡r✳❝♦♥♥❡❝t ✭✮❀

Independent For-Each Loop

❢♦r ✭ ■♠♣♦rt❛♥t❖❜❥❡❝t ♦ ✿ ❧✐st✮ ④ r❡s✉❧t ❂ ❝❛❧❝✉❧❛t❡❙♦♠❡t❤✐♥❣❋♦r◗✉✐t❡❆❲❤✐❧❡ ✭♦✮❀ ✇r✐t❡❘❡s✉❧t■♥❉❛t❛❜❛s❡ ✭r❡s✉❧t ✮❀ ⑥

Array Reduction

✐♥t s✉♠ ❂ ✵❀ ❢♦r ✭✐♥t ✐ ❂ ✵❀ ✐ ❁ ❛rr❛②✳❧❡♥❣t❤❀ ✐✰✰✮ ④ s✉♠ ❂ s✉♠ ✰ ❛rr❛②❬✐❪❀ ⑥

[Molitorisz12, Mattson04]

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 7 / 37

slide-20
SLIDE 20

Solving Goal 2: Pattern Matching

SDG of Candidate Pattern

Approach ⊲ Formalising Candidate Patterns

?? MethodCall ?? MethodCall/ Assignment

avDur > 200ms avDur > 200ms

... ... ... ?? Method ?? Method

calls calls

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 8 / 37

slide-21
SLIDE 21

Solving Goal 2: Pattern Matching

Initial CMQ

Approach ⊲ Formalising Candidate Patterns

MATCH (m1: MethodCall ) −[:CONTROL_FLOW*1..5] − > (m2: MethodCall ) RETURN c o l l e c t ( DISTINCT id (m1) )

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 9 / 37

slide-22
SLIDE 22

Solving Goal 2: Pattern Matching

Restriction: Minimum Average Duration

Approach ⊲ Formalising Candidate Patterns

MATCH (m1: MethodCall ) −[:CONTROL_FLOW*1..5] − > (m2: MethodCall ) WHERE m1. avgDurInMs > 200 AND m2. avgDurInMs > 200 RETURN c o l l e c t ( DISTINCT id (m1) )

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 10 / 37

slide-23
SLIDE 23

Solving Goal 2: Pattern Matching

Restriction: Minimum Average Duration

Approach ⊲ Formalising Candidate Patterns

MATCH (m1: MethodCall ) −[:CONTROL_FLOW*1..5] − > (m2: MethodCall ) WHERE m1. avgDurInMs > 200 AND m2. avgDurInMs > 200 RETURN c o l l e c t ( DISTINCT id (m1) )

runtime information configurable

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 10 / 37

slide-24
SLIDE 24

Solving Goal 2: Pattern Matching

Restriction: No Branches

Approach ⊲ Formalising Candidate Patterns

MATCH (m1: MethodCall ) −[cfs :CONTROL_FLOW*1..5] − > (m2: MethodCall ) WHERE m1. avgDurInMs > 200 AND m2. avgDurInMs > 200 AND none( cf IN cfs WHERE has ( cf . case ) ) RETURN c o l l e c t ( DISTINCT id (m1) )

❜♦♦❧❡❛♥ ✐s❆✈❛✐❧❛❜❧❡ ❂ ✐sPr♦❞✉❝t❆✈❛✐❧❛❜❧❡ ✭✮❀ ✐❢✭✐s❆✈❛✐❧❛❜❧❡ ✮④ ♣r♦❝❡ss❖r❞❡r ✭✮❀ ⑥

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 11 / 37

slide-25
SLIDE 25

Solving Goal 2: Pattern Matching

Restriction: No Branches

Approach ⊲ Formalising Candidate Patterns

MATCH (m1: MethodCall ) −[cfs :CONTROL_FLOW*1..5] − > (m2: MethodCall ) WHERE m1. avgDurInMs > 200 AND m2. avgDurInMs > 200 AND none( cf IN cfs WHERE has ( cf . case ) ) RETURN c o l l e c t ( DISTINCT id (m1) )

❜♦♦❧❡❛♥ ✐s❆✈❛✐❧❛❜❧❡ ❂ ✐sPr♦❞✉❝t❆✈❛✐❧❛❜❧❡ ✭✮❀ ✐❢✭✐s❆✈❛✐❧❛❜❧❡ ✮④ ♣r♦❝❡ss❖r❞❡r ✭✮❀ ⑥

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 11 / 37

slide-26
SLIDE 26

Solving Goal 2: Pattern Matching

Restriction: No Direct Dependency between the Method Calls

Approach ⊲ Formalising Candidate Patterns

MATCH (m1: MethodCall ) −[ cfs :CONTROL_FLOW*1..5] − > (m2: MethodCall ) WHERE m1. avgDurInMs > 200 AND m2. avgDurInMs > 200 AND none ( cf IN cfs WHERE has ( cf . case ) ) AND NOT (m1) −[:DATA_FLOW*1..5] − > (m2) RETURN c o l l e c t ( DISTINCT id (m1) )

✐♥t st♦❝❦ ❂ ♠❛t❡r✐❛❧■♥❙t♦❝❦ ✭✮❀ ❜♦♦❧❡❛♥ ❡♥♦✉❣❤ ❂ ✐s❊♥♦✉❣❤■♥❙t♦❝❦ ✭st♦❝❦ ✮❀ ♠❛❦❡❖r❞❡rs✭❡♥♦✉❣❤ ✮❀

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 12 / 37

slide-27
SLIDE 27

Solving Goal 2: Pattern Matching

Restriction: No Direct Dependency between the Method Calls

Approach ⊲ Formalising Candidate Patterns

MATCH (m1: MethodCall ) −[ cfs :CONTROL_FLOW*1..5] − > (m2: MethodCall ) WHERE m1. avgDurInMs > 200 AND m2. avgDurInMs > 200 AND none ( cf IN cfs WHERE has ( cf . case ) ) AND NOT (m1) −[:DATA_FLOW*1..5] − > (m2) RETURN c o l l e c t ( DISTINCT id (m1) )

✐♥t st♦❝❦ ❂ ♠❛t❡r✐❛❧■♥❙t♦❝❦ ✭✮❀ ❜♦♦❧❡❛♥ ❡♥♦✉❣❤ ❂ ✐s❊♥♦✉❣❤■♥❙t♦❝❦ ✭st♦❝❦ ✮❀ ♠❛❦❡❖r❞❡rs✭❡♥♦✉❣❤ ✮❀

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 12 / 37

slide-28
SLIDE 28

Solving Goal 2: Pattern Matching

Restriction: No Modification of Concurrently Accessed Fields

Approach ⊲ Formalising Candidate Patterns

MATCH (d1:Method) <−[:CALLS]− (m1: MethodCall ) −[ cfs :CONTROL_FLOW*1..5] − > (m2: MethodCall ) −[:CALLS]−> (d2:Method) WHERE m1. avgDurInMs > 200 AND m2. avgDurInMs > 200 AND none ( cf IN cfs WHERE exi sts ( cf . case ) ) AND NOT (m1) −[:DATA_FLOW*1..5] − > (m2) AND NOT (m1) −[:DATA_FLOW]−> ( : Field ) <−[:DATA_FLOW]− (m2) AND d1 . isParallelisable=true AND d2 . isParallelisable=true RETURN c o l l e c t ( DISTINCT id (m1) )

r❡❛❞❋✐❡❧❞✭✮❀ ✇r✐t❡❋✐❡❧❞✭✮❀

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 13 / 37

slide-29
SLIDE 29

Solving Goal 2: Pattern Matching

Restriction: No Modification of Concurrently Accessed Fields

Approach ⊲ Formalising Candidate Patterns

MATCH (d1:Method) <−[:CALLS]− (m1: MethodCall ) −[ cfs :CONTROL_FLOW*1..5] − > (m2: MethodCall ) −[:CALLS]−> (d2:Method) WHERE m1. avgDurInMs > 200 AND m2. avgDurInMs > 200 AND none ( cf IN cfs WHERE exi sts ( cf . case ) ) AND NOT (m1) −[:DATA_FLOW*1..5] − > (m2) AND NOT (m1) −[:DATA_FLOW]−> ( : Field ) <−[:DATA_FLOW]− (m2) AND d1 . isParallelisable=true AND d2 . isParallelisable=true RETURN c o l l e c t ( DISTINCT id (m1) )

r❡❛❞❋✐❡❧❞✭✮❀ ✇r✐t❡❋✐❡❧❞✭✮❀

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 13 / 37

slide-30
SLIDE 30

Solving Goal 2: Pattern Matching

Restriction: No Dependency From 1. Statement to Intermediate Ones

Approach ⊲ Formalising Candidate Patterns MATCH ( d1 : Method ) <−[:CALLS]− (m1: MethodCall ) −[cfs :CONTROL_FLOW*1..5] − > (m2: MethodCall ) −[:CALLS]−> ( d2 : Method ) WHERE m1. avgDurationInMs > 200 AND m2. avgDurationInMs > 200 WITH m1, m2, d1 , d2 , cfs MATCH path = (m1) −[:CONTROL_FLOW*1..5] − > (m2) WITH m1, m2, d1 , d2 , cfs , f i l t e r ( intermediateNode IN nodes( path ) WHERE intermediateNode <> m1 AND intermediateNode <> m2) AS intermediateNodes WHERE NOT (m1) −[:DATA_FLOW*1..5] − > (m2) AND none ( cf IN cfs WHERE exis ts ( cf . case ) ) AND NOT (m1) −[:DATA_FLOW]−> ( : Field ) <−[:DATA_FLOW]− (m2) AND d1 . i s P a r a l l e l i s a b l e =true AND d2 . i s P a r a l l e l i s a b l e =true

AND a l l (node IN intermediateNodes WHERE NOT (m1) −[:DATA_FLOW]−> (node) AND (NOT node: MethodCall OR a l l ( pathcall IN ( ( node) −[:CALLS]−> ( ) ) WHERE a l l ( call IN rels ( pathcall ) WHERE endNode( call ) . isParallelisable=true OR endNode( call ) : Constructor ) ) ) )

RETURN c o l l e c t ( DISTINCT id (m1) ) Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 14 / 37

slide-31
SLIDE 31

Solving Goal 2: Pattern Matching

Extension: No Modification of Concurrently Accessed Fields

Approach ⊲ Formalising Candidate Patterns

. . . AND NOT d1 . overridden=true AND NOT d2 . overridden=true AND ( d1 . i s P a r a l l e l i s a b l e =true OR NOT ( d1 ) −[:AGGREGATED_FIELD_WRITE |AGGREGATED_CALLS* ]−> ( : Field ) − − ( d2 ) ) AND ( d2 . i s P a r a l l e l i s a b l e =true OR NOT ( d2 ) −[:AGGREGATED_FIELD_WRITE |AGGREGATED_CALLS* ]−> ( : Field ) − − ( d1 ) ) . . .

◮ less restrictive: allow modification of fields except concurrently

accessed ones

◮ Attention: handle overridden methods separately!

⇒ see details in thesis

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 15 / 37

slide-32
SLIDE 32

Solving Goal 3: Transformation

Target Source Code

Approach ⊲ Transformation

Master Worker Pattern:

◮ Usage of nested Callables and Futures

◮ Enables return value ◮ Enables exception handling

◮ Organisation with Java’s ExecutorsService (thread pool)

no Java 8 support (because of Soot)

Source: https://github.com/Sable/soot/issues/394

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 16 / 37

slide-33
SLIDE 33

Solving Goal 3: Transformation

Example of SDGs – Before and After

Approach ⊲ Transformation Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 17 / 37

slide-34
SLIDE 34

Solving Goal 3: Transformation

Mission

Approach ⊲ Transformation

◮ Add new nodes according to Soot representation ◮ Add new control flows and hierarchy ◮ Remove unused control flows ◮ New variable/class names (variable scope) ◮ Exception handling

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 18 / 37

slide-35
SLIDE 35

Solving Goal 3: Transformation

Mission

Approach ⊲ Transformation

◮ Add new nodes according to Soot representation ◮ Add new control flows and hierarchy ◮ Remove unused control flows ◮ New variable/class names (variable scope) ◮ Exception handling

Simplification/Optimisation: no attention to data flows, instead new Soot run

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 18 / 37

slide-36
SLIDE 36

Solving Goal 3: Transformation

Transformation Implementation

Approach ⊲ Transformation

◮ Implementation in Java ◮ Cypher queries (from String) ◮ Neo4J Java API

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 19 / 37

slide-37
SLIDE 37

Solving Goal 3: Transformation

Transformation Implementation

Approach ⊲ Transformation

◮ Implementation in Java ◮ Cypher queries (from String) ◮ Neo4J Java API

Advantages:

◮ Reusability of the queries ◮ Dynamic build of queries ◮ Temporary storing of nodes

⇒ Comfortable handling of relationships

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 19 / 37

slide-38
SLIDE 38

Live Demonstration

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 20 / 37

slide-39
SLIDE 39

Solving Goal 4: Evaluating the Speed Up

Evaluation

Evaluation of the speed up not yet possible:

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 21 / 37

slide-40
SLIDE 40

Solving Goal 4: Evaluating the Speed Up

Evaluation

Evaluation of the speed up not yet possible:

◮ Generation of Java source code from the Neo4J SDG is very

complex

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 21 / 37

slide-41
SLIDE 41

Solving Goal 4: Evaluating the Speed Up

Evaluation

Evaluation of the speed up not yet possible:

◮ Generation of Java source code from the Neo4J SDG is very

complex

◮ Try-catch blocks ◮ Throw exceptions ◮ Loop Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 21 / 37

slide-42
SLIDE 42

Solving Goal 4: Evaluating the Speed Up

Evaluation

Evaluation of the speed up not yet possible:

◮ Generation of Java source code from the Neo4J SDG is very

complex

◮ Try-catch blocks ◮ Throw exceptions ◮ Loop

⇒ Approach differently evaluated

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 21 / 37

slide-43
SLIDE 43

Evaluation

Evaluation

◮ Feasibility of the approach ◮ Quantitative occurrence of the candidate patterns ◮ Extendibility of the approach

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 22 / 37

slide-44
SLIDE 44

Evaluation

Feasibility of the Approach

Evaluation

Yes, we can! We successfully transformed three prototypes :)

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 23 / 37

slide-45
SLIDE 45

Evaluation

Quantitative Occurrence of the Candidate Patterns

Evaluation

Checkstyle and Findbugs ♯ Checkstyle Findbugs Overall nodes in SDG 83619 140875 All classes in SDG 942 1357 All Methods in SDG (without constructors) 8759 11983 Classes in app 762 1160 Methods in app (without constructors) 6772 9392 Overridden methods in app 754 505

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 24 / 37

slide-46
SLIDE 46

Evaluation

Quantitative Occurence of the Candidate Patterns

Evaluation

Independent Successive Method Calls Pattern ♯ Checkstyle Findbugs Classes in app 762 1160 Methods in app (without constructors) 6772 9392 Read-only methods 963 1953 Method calls 20664 39699 Read-only-method calls 1208 4078 Successive method calls 12870 29595 Successive read-only method calls 26 352 Independent successive method calls 551 –

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 25 / 37

slide-47
SLIDE 47

Evaluation

Quantitative Occurence of the Candidate Patterns

Evaluation

Independent Successive Method Calls Pattern ♯ Checkstyle Findbugs Classes in app 762 1160 Methods in app (without constructors) 6772 9392 Read-only methods 963 1953 Method calls 20664 39699 Read-only-method calls 1208 4078 Successive method calls 12870 29595 Successive read-only method calls 26 352 Independent successive method calls 551 –

◮ without runtime information constraints ◮ branches excluded ◮ no allowance of ’isParallelisable=true’ for more flexibility

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 25 / 37

slide-48
SLIDE 48

Evaluation

Quantitative Occurrence of the Candidate Patterns

Evaluation

Independent For-Each Loop ♯ Checkstyle Findbugs Classes in app 762 1160 Methods in app (without constructors) 6772 9392 For-Each Loops 97 234* Read-only For-Each Loops 16 75* Independent For-Each Loops 39 103* * loop body size restricted to a maximum of 30 statements

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 26 / 37

slide-49
SLIDE 49

Evaluation

Quantitative Occurrence of the Candidate Patterns

Evaluation

Array Reduction Pattern ♯ Checkstyle Findbugs Classes in app 762 1160 Methods in app (without constructors) 6772 9392 Array length operation 717 636 Array access operation 614 982 Array assignments 2424 536 Array reduction

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 27 / 37

slide-50
SLIDE 50

Evaluation

Extendibility of the Approach

Evaluation

Pros

◮ Modular because of Java ◮ Reusability of queries ◮ Semi-automatism easily extendible ◮ Configurable, e.g. runtime constraints ◮ New candidate and parallelisation patterns can be designed with

the help of existing utility classes Cons

◮ When SDG changes, CMQs and transformation have to be

adjusted ⇒ Maintenance effort, e.g. for Java 8 support

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 28 / 37

slide-51
SLIDE 51

Conclusion and Future Work

Conclusion and Future Work

Conclusion:

◮ Successful implementation of 3 patterns ◮ Powerful, but complex approach

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 29 / 37

slide-52
SLIDE 52

Conclusion and Future Work

Conclusion and Future Work

Conclusion:

◮ Successful implementation of 3 patterns ◮ Powerful, but complex approach

Future Work:

◮ Generate Java code from SDG for performance evaluation ◮ Add runtime information ◮ Implement additional candidate and parallelisation patterns

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 29 / 37

slide-53
SLIDE 53

References

Conclusion and Future Work

[Mattson04] T. G. Mattson, B. A. Sanders, and B. L. Massingill. Patterns for Parallel

  • Programming. Second. Addison Wesley, 2004.

[Molitorisz12] K. Molitorisz, J. Schimmel, and F. Otto. Automatic Parallelization Using

  • AutoFutures. English. In: Multicore Software Engineering,

Performance, and Tools. 2012, pages 78–81. [Wulf14] C. Wulf. Pattern-based detection and utilization of potential parallelism in software systems. In: Software Engineering 2014, Fachtagung des GI-Fachbereichs Soft- waretechnik, 25. Februar - 28. Februar 2014, Kiel, Deutschland. 2014, pages 229–232.

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 30 / 37

slide-54
SLIDE 54

Approach for the Thesis

Conclusion and Future Work

Neo4J

Database

JAVA JAVA

MATCH (node1)

  • [:related_to]->

(node2) WHERE ... RETURN node1, node2

Cypher Match Query

MATCH node... WHERE ... CREATE/DELETE ... RETURN node...

Cypher Update Query

Candidate Pattern Parallelisation Pattern

Pattern Mining

choose prototype formalise pattern formalise transformation create SDG generate execute Sequential Program Parallelised Program Resulting candidates: 1) 2) ... parallelise execute 1. 2. 3. 0. Evaluation 4.

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 31 / 37

slide-55
SLIDE 55

Solving Goal 2: Pattern Matching

Introducing the attributes isOverridden

Conclusion and Future Work

MATCH (m: Method ) <−[:CONTAINS_METHOD]− ( classOrInterface ) <−[:EXTENDS|IMPLEMENTS*1..] − ( subclass ) −[:CONTAINS_ME WHERE m. displayname = method . displayname SET m. overridden=true

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 32 / 37

slide-56
SLIDE 56

Solving Goal 2: Pattern Matching

Introducing the attributes isReadOnly

Conclusion and Future Work

In theory:

MATCH (m: Method ) WHERE NOT ( exis ts (m. overridden ) OR m. overridden <> true ) AND NOT (m) −[:AGGREGATED_FIELD_WRITE|AGGREGATED_CALLS*]−> WITH m SET m. isReadOnly=true

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 33 / 37

slide-57
SLIDE 57

Solving Goal 2: Pattern Matching

Introducing the attributes isReadOnly

Conclusion and Future Work

In our ’capped’ SDG:

  • 1. Cypher-Query:

MATCH (m: Method ) WHERE

  • m. o r i g i n =

’APP’ AND (NOT exis ts (m. overridden ) OR m. overridden <> true ) AND NOT (m) −[:AGGREGATED_FIELD_WRITE]−> ( : Field ) AND (NOT (m) −[:AGGREGATED_CALLS]−> ( : Method ) ) WITH m SET m. isReadOnly=true

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 34 / 37

slide-58
SLIDE 58

Solving Goal 2: Pattern Matching

Introducing the attributes isReadOnly

Conclusion and Future Work

2.-x. Cypher query

MATCH (mRO: Method ) <−[:AGGREGATED_CALLS]− (m: Method ) WHERE

  • mRO. isReadOnly=true

AND NOT EXISTS(m. isReadOnly ) AND (NOT EXISTS(m. overridden ) OR m. overridden <> true ) AND NOT (m) −[:AGGREGATED_FIELD_WRITE]−> ( : Field ) AND ( a l l ( path IN ( (m) −[:AGGREGATED_CALLS]−> ( : Method ) ) WHERE a l l ( method IN nodes ( path ) WHERE m = method OR method . isReadOnly=true ) ) ) WITH m SET m. isReadOnly=true

Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 35 / 37

slide-59
SLIDE 59

Parallelised Example Code

Conclusion and Future Work ✳✳✳ ✐♥t ♥Pr♦❝❡ss♦rs ❂ P❛r❛❧❧❡❧✐s❛t✐♦♥❯t✐❧ ✳ ◆❯▼❇❊❘❴❖❋❴P❘❖❈❊❙❙❖❘❙ ❀ ❥❛✈❛✳✉t✐❧✳❝♦♥❝✉rr❡♥t✳ ❊①❡❝✉t♦r❙❡r✈✐❝❡ ♣♦♦❧ ❂ ❥❛✈❛✳✉t✐❧✳ ❝♦♥❝✉rr❡♥t✳❊①❡❝✉t♦rs ✳ ♥❡✇❋✐①❡❞❚❤r❡❛❞P♦♦❧ ✭♥Pr♦❝❡ss♦rs ✮❀ ❉❛t❛❙❈❈♦♥♥❡❝t❈❛❧❧❛❜❧❡ ❝❛❧❧❛❜❧❡✶ ❂ ♥❡✇ ❈♦♥♥❡❝t✐♦♥❙❡t✉♣ ✳ ❉❛t❛❙❈❈♦♥♥❡❝t❈❛❧❧❛❜❧❡ ✭❞❛t❛❙❈ ✮❀ ❥❛✈❛✳✉t✐❧✳❝♦♥❝✉rr❡♥t✳❋✉t✉r❡ ❁❄❃ ❢✉t✉r❡✶ ❂ ♣♦♦❧✳s✉❜♠✐t✭❝❛❧❧❛❜❧❡✶ ✮❀ ❊✈❡♥t❙❈❈♦♥♥❡❝t❈❛❧❧❛❜❧❡ ❝❛❧❧❛❜❧❡✷ ❂ ♥❡✇ ❈♦♥♥❡❝t✐♦♥❙❡t✉♣ ✳ ❊✈❡♥t❙❈❈♦♥♥❡❝t❈❛❧❧❛❜❧❡ ✭❡✈❡♥t❙❈ ✮❀ ❥❛✈❛✳✉t✐❧✳❝♦♥❝✉rr❡♥t✳❋✉t✉r❡ ❁❄❃ ❢✉t✉r❡✷ ❂ ♣♦♦❧✳s✉❜♠✐t✭❝❛❧❧❛❜❧❡✷ ✮❀ tr② ④ ❢✉t✉r❡✶✳❣❡t ✭✮❀ ❢✉t✉r❡✷✳❣❡t ✭✮❀ ⑥ ❝❛t❝❤ ✭ ■♥t❡rr✉♣t❡❞❊①❝❡♣t✐♦♥ ❡✮ ④ ⑥ ❝❛t❝❤ ✭❥❛✈❛✳✉t✐❧✳❝♦♥❝✉rr❡♥t✳ ❊①❡❝✉t✐♦♥❊①❝❡♣t✐♦♥ ❡✮ ④ ❚❤r♦✇❛❜❧❡ ❝❛✉s❡ ❂ ❡✳❣❡t❈❛✉s❡ ✭✮❀ ✐❢ ✭❝❛✉s❡ ✐♥st❛♥❝❡♦❢ ❊rr♦r✮ ④ t❤r♦✇ ✭❊rr♦r✮ ❝❛✉s❡❀ ⑥ ✐❢ ✭❝❛✉s❡ ✐♥st❛♥❝❡♦❢ ❘✉♥t✐♠❡❊①❝❡♣t✐♦♥ ✮ ④ t❤r♦✇ ✭ ❘✉♥t✐♠❡❊①❝❡♣t✐♦♥ ✮ ❝❛✉s❡❀ ⑥ ⑥ ♣♦♦❧✳s❤✉t❞♦✇♥ ✭✮❀ ✳✳✳ Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 36 / 37

slide-60
SLIDE 60

Parallelised Example Code

Conclusion and Future Work ♣r✐✈❛t❡ st❛t✐❝ ❝❧❛ss ❉❛t❛❙❈❈♦♥♥❡❝t❈❛❧❧❛❜❧❡ ✐♠♣❧❡♠❡♥ts ❈❛❧❧❛❜❧❡ ❁❱♦✐❞ ❃ ④ ♣r✐✈❛t❡ ■❉❛t❛❙❡r✈❡r❈♦♥♥❡❝t✐♦♥ ❞❛t❛❙❈❀ ♣✉❜❧✐❝ ❉❛t❛❙❈❈♦♥♥❡❝t❈❛❧❧❛❜❧❡ ✭ ■❉❛t❛❙❡r✈❡r❈♦♥♥❡❝t✐♦♥ ❞❛t❛❙❈✮ ④ s✉♣❡r ✭✮❀ t❤✐s✳❞❛t❛❙❈ ❂ ❞❛t❛❙❈❀ ⑥ ❅❖✈❡rr✐❞❡ ♣✉❜❧✐❝ ❱♦✐❞ ❝❛❧❧ ✭✮ t❤r♦✇s ❊①❝❡♣t✐♦♥ ④ ❞❛t❛❙❈✳❝♦♥♥❡❝t ✭✮❀ r❡t✉r♥ ♥✉❧❧❀ ⑥ ⑥ ♣r✐✈❛t❡ st❛t✐❝ ❝❧❛ss ❊✈❡♥t❙❈❈♦♥♥❡❝t❈❛❧❧❛❜❧❡ ✐♠♣❧❡♠❡♥ts ❈❛❧❧❛❜❧❡ ❁❱♦✐❞ ❃ ④ ♣r✐✈❛t❡ ■❊✈❡♥t❙❡r✈❡r❈♦♥♥❡❝t✐♦♥ ❡✈❡♥t❙❈❀ ♣✉❜❧✐❝ ❊✈❡♥t❙❈❈♦♥♥❡❝t❈❛❧❧❛❜❧❡ ✭ ■❊✈❡♥t❙❡r✈❡r❈♦♥♥❡❝t✐♦♥ ❡✈❡♥t❙❈✮ ④ s✉♣❡r ✭✮❀ t❤✐s✳❡✈❡♥t❙❈ ❂ ❡✈❡♥t❙❈❀ ⑥ ❅❖✈❡rr✐❞❡ ♣✉❜❧✐❝ ❱♦✐❞ ❝❛❧❧ ✭✮ ④ ❡✈❡♥t❙❈✳❝♦♥♥❡❝t ✭✮❀ r❡t✉r♥ ♥✉❧❧❀ ⑥ ⑥ Johanna E. Krause Parallelise Software Systems using an SDG 27 January 2016 37 / 37