Data-Flow Analysis for MPI Programs
Pavel Vohmjanin
Definitions
Data- flow analysis is a body of techniques that derive information about the flow of data along program execution paths
Compilers, principles, techniques, & tools
Data- flow analysis is a technique for gathering information about the possible set of values calculated at various points in a computer program
Wikipedia
Program example
00 begin program 01 02 x = 1 03 z = 2 04 y = 0 05 06 if(x == 2) then 07 08 z=x+1 09 y=z 10 else 11 z=5 12 endif 13 14 f = 4 15 end program
begin x=1 z=2 y=0 x eq 2
x=1 z=2 y=0 f - undefined
z=x+1 z=5 y=z
f=4
Data-flow abstraction • statements
– example: x = x + 1
• program point before - IN • program point after - OUT • basic blocks
Data-flow Analysis constrains • Transfer functions
– semantic statements – IN -> transfer function -> OUT (forward) – OUT -> transfer function -> IN (backward)
• Flow control
– if, while, etc.
Types of data flow analysys • forward flow analysis
– reaching definitions
• backward flow analysis
– live variables
Usage of data flow analysis
• code understanding • optimization • finding security bugs
MPI programs
MPI (Message Passing Interface) is a languageindependent communications protocol used to program parallel computers. Both point-to-point and collective communication is supported. • send message • receive message
begin x=0
SPMD program example
00 begin program 01 x = 0 02 z = 2 03 b = 7 04 if(rank == 0) then 05 x=x+1 06 b=x*3 07 send(x) 08 else 09 recieve(y) 10 z=b*y 11 endif 12 f = reduce(SUM,z) 13 end program
z=2 b=7 rank eq 0 x=x+1 z=5 b=x*3 receive(y) send(x)
f=4
Offered solutions
• global variables – Odysee AD tool – not both sides at the same • copy the control graph for each node – makes grap not scalable
Practically efficient solution
MPI-CFG - MPI Control Flow Graph • use typical CFG • extend CFG by support of MPI • create communication edges between send and recieve
Control Flow Graph
CFG = {V, E} • V - nodes in a graph • E - set of nodes with (n1, n2) Є E, n - statements • each node n has pred(n) and succ(n) • IN(n) and OUT(n) in data-flow analysis
MPI - CFG
CFG = {V, E, C} • V - nodes in a graph • E - set of nodes with (n1, n2) Є E, n - statements • each node n has pred(n) and succ(n) • IN(n) and OUT(n) in data-flow analysis • C - set of communication edges • define commOUT and commIN
commOUT
OUT(p1) OUT(p2) OUT(pn)
IN(n) n: send(x) OUT(n) commOUT(n)
commIN
OUT(p1) OUT(p2) OUT(pn)
IN(n) n: recieve(y) OUT(n) commIN(n)
commOUT(q1)
commOUT(q1)
commOUT(qm)
Conclusion
MPI Data Analysis model that canbe used for • reaching costants • slicing • trust analysis
Questions?