Presentation on theme: "Jaewook Shin, Priyadarshini Malusare and Paul D. Hovland Mathematics and Computer Science Division Argonne National Laboratory Design and Implementation."— Presentation transcript:
Jaewook Shin, Priyadarshini Malusare and Paul D. Hovland Mathematics and Computer Science Division Argonne National Laboratory Design and Implementation of a Context-Sensitive, Flow-Sensitive Activity Analysis Algorithm for Automatic Differentiation The 5th International Conference on Automatic Differentiation, Bonn, Germany, August 15, 2008
3 Activity Analysis AD is applied to a function with a set of input variables and a set of output variables. Sometimes, we are interested in the derivatives –of a subset of the output variables dependent –with respect to a subset of the input variables independent An intermediate variable is –varied if it is transitively dependent on any independent variable –useful if any dependent variable is transitively dependent on it –active if it is both varied and useful. Partial derivatives need to be computed only for active variables. Activity analysis is nonseparable.
7 Previous work: Context-Sensitive, Flow-Insensitive Activity Analysis (VDGAA) Graph reachability problem Variable Dependence Graph (VDG) Two separate (color) propagations: –Forward (coloring red) for “varied” variables –Backward (coloring yellow) for “useful” variables Context sensitivity is supported by a stack of contexts. Run time –Very fast in practice Small overestimations of active variables due to –the way programs are usually written –the property of activity analysis
15 Context-Sensitive, Flow-Sensitive Activity Analysis (DUGAA) Graph reachability problem Two separate (color) propagations: –Forward for “varied” variables –Backward for “useful” variables Context sensitivity is supported by a stack of contexts. Definition-Use Graph (DUG) Flow sensitivity is supported by the use of reaching definitions for nodes. Algorithm: UD-DU Chains Build a def-use graph Forward propagation Backward propagation
19 Implementation OpenAnalysis VDGAA DUGAA OpenAD: AD Transformation Open64 Unparser Open64 Front end Input (Fortran) Output (Fortran)
20 Benchmarks DescriptionSource#lines MITgcmMIT General Circulation ModelMIT27376 LULower-upper symmetric Gauss-SeidelNASPB5951 CGConjugate gradientNASPB2480 newtonNewton’s method + Rosenbrock functionANL2189 adiabaticAdiabatic flow model in chemical engineeringCMU1009 msaMinimal surface area problemMINPACK-2461 swirlSwirling flow problemMINPACK-2355 c2Ordinary differential equation solverANL64
21 Slowdowns in analysis run time: DUGAA vs. VDGAA
22 Analysis run time
23 Analysis run-time breakdown on MITgcm
24 Reduction in active variables
25 Conclusion A new context-sensitive, flow-sensitive (CSFS) activity analysis algorithm: Def- Use Graph Activity Analysis (DUGAA) Comparison of two activity analyses: DUGAA (CSFS) vs. VDGAA (CSFI) Slower than VDGAA for all 8 benchmarks –by a factor > 27 –but takes less than one minute for a code larger than 27k lines Makes fewer overestimations than VDGAA for two of the eight benchmarks. May save human effort in managing AD code. Future work –Comparison among CIFS, CSFI, and CSFS activity analyses –Dealing with pointers and recursion
26 PARAM Edges Edges between formal parameters Summarize the connectivity among formal parameters Transitive closure is applied to the dependence matrix of local variables Checking for connectivity through global variables: A PARAM edge is generated from formal variable node F1 to formal variable node F2 by traversing the entire graph only when –F1 has a value flow path to a global variable node AND –F2 has a value flow path from a global variable node.
27 Context-Insensitive, Flow-Sensitive Activity Analysis (ICFGAA) Interprocedural Control Flow Graph (ICFG) Iterative data-flow analysis (DFA) Two separate DFAs: –Forward for “varied” variables –Backward for “useful” variables Long run time –Large number of iterations –Nonseparability of activity analysis: data-flow analysis values depend on other data-flow values Large overestimation –Due to context-insensitivity –Value propagation through unrealizable control paths