combining static and dynamic analysis for top-down

26
Combining Static and Dynamic Analysis for Top-down Communication Trace Compression Jidong Zhai Tsinghua University 6th Annual MVAPICH User Group (MUG) Meeting

Upload: others

Post on 16-Oct-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Combining Static and Dynamic Analysis for Top-down

Combining Static and Dynamic Analysisfor Top-down Communication Trace Compression

Jidong ZhaiTsinghua University

6th Annual MVAPICH User Group (MUG) Meeting

Page 2: Combining Static and Dynamic Analysis for Top-down

Communication Traces

• Communication Traces highly useful:

l Communication performance analysis

• Bottleneck/Bug detection• Platform selection• Communication optimization

l Design future HPC systems

ID MPI_TYPE SIZE SRC DEST TIME1. MPI_Send 20B 10 16 10us2. MPI_Recv 10B 12 10 12us3. MPI_Send 20B 10 12 10us4. MPI_Recv 10B 11 10 11us5. MPI_Send 20B 10 11 12us6. MPI_Recv 10B 14 10 15us7. MPI_Send 20B 10 14 11us8. MPI_Recv 10B 16 10 13us……

Segment of MPI communication trace

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 2

Page 3: Combining Static and Dynamic Analysis for Top-down

Analyzing Communication Patterns

Communication patterns extracted from MPI communication traces.

[1] Ruini Xue, Xuezheng Liu, Ming Wu, Zhenyu Guo, Wenguang Chen, Weimin Zheng, Zheng Zhang, Geoffrey M. Voelker: MPIWiz: subgroup reproducible replay of mpi applications. PPOPP 2009: 251-260.

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 3

Page 4: Combining Static and Dynamic Analysis for Top-down

Predicting Future HPC Systems

Communication Traces

ComputationTraces

Trace-driven Simulator

Network Parameters etc.

Predicted Performance

[1] A. Snavely, L. Carrington, N. Wolter, J. Labarta, R. Badia, and A. Purkayastha. A framework for application performance modeling and prediction. In SC ’02, pages 1–17, 2002.

+Leading-edge application

Leading-edge system

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 4

Page 5: Combining Static and Dynamic Analysis for Top-down

Tracing Communication: Challenges• Problem: Traces àHuge

l Caused by growing• Problem size• job scale (# of processes)

l Example:• ASCI SMG2000, 64*64*32 Problem size,

22,538 Processes à 5 TB Traces[1]

• Huge traces bringl Pressure on storage systeml Interference with user application execution

[1] B. J. N. Wylie, M. Geimer, and F. Wolf, “Performance measurement and analysis of large-scale parallel applications on leadership computing systems,” Sci. Program., vol. 16, no. 2-3, pp. 167–181, Apr. 2008.

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 5

Page 6: Combining Static and Dynamic Analysis for Top-down

Solution: Trace Compression• Significant redundancy

l Within a process: iterative timesteps (loops)

l Across processes: similar behavior (SPMD)

• Existing tools: Bottom-up approach• ScalaTrace

[1], ScalaTrace-2

[2]

• Examine traces at runtime to discover repeated

patterns

• Two-phase: intra-process + inter-process

[1] M. Noeth, F. Mueller, M. Schulz, and B. de Supinski, “Scalable compression and replay of

communication traces in massively parallel environments,” in IPDPS’07, 2007.

[2] X. Wu and F. Mueller, “Elastic and scalable tracing and accurate replay of non-deterministic events,”

in ICS’13, 2013.

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 6

Page 7: Combining Static and Dynamic Analysis for Top-down

Bottom-up 1: Intra-Process Compression• Identify repeated pattern within one process

P0 P1 P2 P3 PN-1 PN

……

Communication traces for each process.

P0 P1 P2 P3 PN-1 PN

……100* 200* 100* 200* 100* 200*

Communication traces after intra-process compression

b c b c b c …a N*(b, c)a

Repeated pattern

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 7

Page 8: Combining Static and Dynamic Analysis for Top-down

• Compare traces in horizontal dimension to identify repeated patterns

……

P0

100*

P1

200*

Communication traces after intra-process compression

P2

100*

PN-1

100*

P3

200*

PN

200*

N/2*P0 N/2*P1

Communication traces after inter-process compression

Bottom-up 2: Inter-Process Compression

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 8

Page 9: Combining Static and Dynamic Analysis for Top-down

• Intra-Process: l Expensive with complex communication patternsl Nested loop structures[1]

[1] Q. Xu, J. Subhlok, and N. Hammen, “Efficient discovery of loop nests in execution traces,” in MASCOTS’10, 2010, pp. 193–202.

1 for (i=0; i<10; i++)2 for (j=0; j<=i; j++) {3 if (j%2 == 0)4 MPI_Isend(…);5 else6 MPI_Irecv(…);7 }8 MPI_Waitall(…);9 MPI_Reduce(…);10 }

1 MPI_Isend(…)2 MPI_Waitall(…)3 MPI_Reduce(…)4 MPI_Isend(…)5 MPI_Irecv(…)6 MPI_Waitall(…)7 MPI_Reduce(…)8 MPI_Isend(…)9 MPI_Irecv(…) 10 MPI_Isend(…)11 MPI_Waitall(…)12 MPI_Reduce(…)13 ……

MPI Program snippet

Communication trace segment

Limitations of Bottom-Up Compression

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 9

Page 10: Combining Static and Dynamic Analysis for Top-down

Limitations of Bottom-Up Compression• Inter-Process:

l Even more expensive, not scalablel Complexity for two processes àO(n2)

4*MPI_Send3*MPI_Recv5*MPI_Bcast3*MPI_Recv……

3*MPI_Isend4*MPI_Irecv5*MPI_Wait3*MPI_Barrier……

4*MPI_Send3*MPI_Recv5*MPI_Bcast3*MPI_Recv……3*MPI_Isend4*MPI_Irecv5*MPI_Wait3*MPI_Barrier……

comm. traces of process P0 comm. traces of process P1Compressed traces of P0 and P1

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 10

Page 11: Combining Static and Dynamic Analysis for Top-down

Our Approach: CYPRESS

• Top-down techniquel Combines static and dynamic analysisl Static analysis phase

• Extract program communication structure tree– Loops, branches etc.

l Dynamic analysis phase• Use this tree as a template• “Fill in” runtime information

– Loop count

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 11

Page 12: Combining Static and Dynamic Analysis for Top-down

Overview of CYPRESS

An MPI Program

Compressed communication tracesProgram communication structure tree (CST)

An MPI Binary

Program CST

Static Analysis Module

Intra-Procedural Analysis

Inter-Procedural Analysis

A Compiler Plug-in

Dynamic Analysis ModuleA HPC system

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 12

Page 13: Combining Static and Dynamic Analysis for Top-down

CYPRESS: Advantages• Much faster

l Top-down “Big picture”• Redundancy expected• Cut the guessing

l More efficient• Knows “where to stop”

• Scalablel Significant improvement to Inter-

process compressionl A better worst-case complexityl More affordable for large-scale

analysis ?

0:Root

1:Loop 8:Br

2:Br 4:Br 9:MPI_Reduce

3:MPI_Send 5:MPI_Recv

6:Loop

7:MPI_Bcast

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 13

Page 14: Combining Static and Dynamic Analysis for Top-down

CYPRESS: Static Analysis

An MPI Program

Compressed communication tracesProgram communication structure tree (CST)

An MPI Program

Program CST

Static Analysis Module

Intra-Procedural Analysis

Inter-Procedural Analysis

A Compiler Plug-in

Dynamic Analysis ModuleA HPC system

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 14

Page 15: Combining Static and Dynamic Analysis for Top-down

Communication Structure Tree (CST)l Ordered tree

• Program communication structure• Non-leaf nodes:

– Loop– Branch

• Leaf nodes:– MPI communication calls

» MPI_Send, MPI_Recv

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 15

Page 16: Combining Static and Dynamic Analysis for Top-down

Build Communication Structure Tree

1 int main(){2 for (i=0; i<k; i++){3 if (myid % 2 == 0)4 MPI_Send(buf, size, MPI_INT,5 myid+1, 0, MPI_COMM_WORLD);6 else7 MPI_Recv(buf, size, MPI_INT,8 myid-1, 0, MPI_COMM_WORLD, &status);9 bar();10 }11 foo();12 if (myid % 2 == 0)13 MPI_Reduce(sbuf, rbuf, 1, MPI_INT, 14 MPI_SUM, root, comm);15 }16 int bar(){17 for(k=0; k<n; k++)18 MPI_Bcast(buf, size, MPI_INT, root, 18 19 MPI_COMM_WORLD);20 }21 int foo(){22 for(j=0; j<m; j++)23 sum += j;24 }

0:Root

1:Loop 7:foo() 8:Br

2:Br 4:Br 6:bar() 9:MPI_Reduce

3:MPI_Send 5:MPI_Recv

0:Root

1:Loop 8:Br

2:Br 4:Br 9:MPI_Reduce

3:MPI_Send 5:MPI_Recv

6:Loop

7:MPI_Bcast

Global CST

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression

Local CST

16

Page 17: Combining Static and Dynamic Analysis for Top-down

CYPRESS: Dynamic Analysis

An MPI Program

Compressed communication tracesProgram communication structure tree (CST)

An MPI Program

Program CST

Static Analysis Module

Intra-Procedural Analysis

Inter-Procedural Analysis

A Compiler Plug-in

Dynamic Analysis ModuleA HPC system

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 17

Page 18: Combining Static and Dynamic Analysis for Top-down

Intra-Process Compression

• “Fill in” dynamic information into CSTl Record loop count and branch taken statusl Per-node linked list for MPI event details

0:Root

1:Loop 8:Br

2:Br 4:Br 9:MPI_Reduce

3:MPI_Send 5:MPI_Recv

6:Loop

7:MPI_Bcast

<K>ß

<0,K,1>ß

<K>ß

à <…>

à <…>

à <…>

Fill in dynamic information into the CST.

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression

para. para.

18

Page 19: Combining Static and Dynamic Analysis for Top-down

• Compare corresponding nodes of the trees

0:Root

1:Loop 8:Br

2:Br 4:Br 9:MPI_Reduce

3:MPI_Send 5:MPI_Recv

6:Loop

7:MPI_Bcast

0:Root

1:Loop 8:Br

2:Br 4:Br 9:MPI_Reduce

3:MPI_Send 5:MPI_Recv

6:Loop

7:MPI_Bcast

<K>ß

<0,K,1>ß

<K>ß <null>ß

<null>ß

<K>ß

compare nodes

Inter-Process Compression

A compressed trace tree for P0 A compressed trace tree for P1

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression

… … … …

19

Page 20: Combining Static and Dynamic Analysis for Top-down

Experiments• Benchmarks

l 8 NPB programs: BT, CG, DT, EP, FT, LU, MG, SPl Real Application: LESlie3d

• Platforml Explorer-100 HPC cluster

• 2*Intel Xeon X5670/48GB Memory• Infiniband network, MVAPICH-2

• Alternative systemsl Gzip (offline compression)

l ScalaTrace (online, bottom-up)l ScalaTrace-2 (online, bottom-up)

• Metricsl Compression effectiveness (trace size reduction)l Compression overhead

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 20

Page 21: Combining Static and Dynamic Analysis for Top-down

1

100

100 00

100 0000

64 121 256 400

BT

1

100

100 00

100 0000

64 128 256 512

CG

1

10

100

100 0

100 00

48 64 128 256

DT

1

10

100

100 0

100 00

64 128 256 512

EP

1

10

100

100 0

100 00

64 128 256 512

FT

1

100

100 00

100 0000

64 128 256 512

LU

1

100

100 00

100 0000

64 128 256 512

MG

1

100

100 00

100 0000

64 121 256 400

SP

Compressed Trace Size

Compressed communication trace size in log scale (KB).MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 21

Page 22: Combining Static and Dynamic Analysis for Top-down

ScalaTrace: 51.05%ScalaTrace-2: 9.1%CYPRESS: 1.58% ↓5X over ScalaTrace-2

0%

2%

4%

6%

8%

10%

64 121 256 400

Tim

e o

ve

rhe

ad

(%

)

N um of Processes

BT

0%

5%

10%

15%

20%

64 128 256 512

Tim

e o

ve

rhe

ad

(%

)

N um of Processes

CG

0%

20%

40%

60%

80%

64 128 256 512

Tim

e o

ve

rhe

ad

(%

)

N um of Processes

LU

1%

10%

100 %

100 0%

64 128 256 512

Tim

e o

ve

rhe

ad

(%

)

N um of Processes

MG

0%

10%

20%

30%

40%

64 121 256 400

Tim

e o

ve

rhe

ad

(%

)

N um of Processes

SP

0%

2%

4%

6%

8%

10%

64 128 256 512

Tim

e o

ve

rhe

ad

(%

)

N um of Processes

FT

Intra-Process Compression Overhead

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 22

Page 23: Combining Static and Dynamic Analysis for Top-down

Inter-Process Compression Overhead

Average inter-process compression overhead: ScalaTrace: 170.69%ScalaTrace-2: 30.3%CYPRESS: 3.29% ↓9X over ScalaTrace-2

Inter-process trace compression overhead in log-scale (second)

0. 1

1

10

100

100 0

64 121 256 400 64 128 256 512 64 128 256 512 64 128 256 512 64 121 256 400Inte

r-pr

oces

s ove

rhea

d (S

ec.)

BT CG LU MG SP

Sc alaT race Sc alaT race 2 C ypre ss

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 23

Page 24: Combining Static and Dynamic Analysis for Top-down

Overall Compression Overhead

• Overhead breakdownDynamic Phase Static Phase

Intra-Process Inter-ProcessScalaTrace 51.05% 170.69% N.A.

ScalaTrace-2 9.1% 30.3% N.A.CYPRESS 1.58% 3.29% 8.27%

Programs BT CG DT EP FT LU MG SPCompilation

Overhead (Sec.)0.25 0.11 0.05 0.09 0.05 0.16 0.09 0.11

Extra compilation time incurred by Cypress for each program (second)

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 24

Page 25: Combining Static and Dynamic Analysis for Top-down

Conclusion

• CYPRESS: Top-Down trace compressionl Leverage static information to facilitate more effective

and efficient trace compressionl Reduce compression overhead

• Intra-process by 5X, inter-process by 9Xl Strong lossless compression performance

• Take-away Message: static information usefull Provides reliable insightl Relatively cheap, with scale-independent cost

• Analyze memory access patterns:l Spindle: Informed Memory Access Monitoring. USENIX ATC 2018.

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 25

Page 26: Combining Static and Dynamic Analysis for Top-down

Thanks!

MUG'18-Combining Static and 26 Analysis for Top-down Communication Trace Compression 26

Contributors: Jianfei Hu, Liwei Chen, Jidong Zhai, XiongchaoTang, Xiaosong Ma, Wenguang Chen