Code Visualization
Execution graph generated in one of HydraVM's four phases can be a useful utility in day-to-day development or in tuning and optimization, as it can give hints about parallel execution patterns or hot-spot code, which is a candidate for further manual optimization and code rewriting. We also generate a graphical representation of the execution graph. (This is an optional feature of HydraVM.)
The following commands show an example of using HydraVM's visualization feature. The second line uses the generated representation from HydraVM to generate graph using the GraphViz tool.
./<hydra vm directory>/rvm -X:hydra:dumb=true -X:hydra:class=Test Test > plotXX dot -Tps plotXX -o graphXX.ps
We can narrow the visualization output to the scope of one class or a package using the commands, '-X:hydra:class=...' and '-X:hydra:package=...', respectively.
The generated graph is composed of nodes that represent blocks and variables, and edges that show the access frequency or the type of operation on variables (read or write). Nodes starting with 'B' represent basic blocks, and it is followed by a number in which the higher order digits constitute the method identifier and the lower order digits constitute the block identifier. Nodes with prefix 'V' represent variables. The number following 'V' indicates whether the variable is global or local: global if the number is larger than 1000; local otherwise. Edges connecting the blocks are weighted with the number of times program flow has moved between the respective two blocks. Edges connecting the blocks to the variables represent memory access from the blocks to the variables: green edge represents a read and red edge represents a write.
The graph can be simplified by filtering out memory access (i.e., variable access) and favoring control flow by the following command.
./<hydra vm directory>/rvm -X:hydra:dumb=true -X:hydra:class=Test -X:hydra:novar=true Test > plotXX
Examples
We used HydraVM to generate execution graphs of the JOlden benchmark, which is a Java version of the Olden Benchmark. The following links display the execution graphs for a sample set of applications from this benchmark suite:
- TSP: probabilistic analysis of partitioning algorithms for the traveling salesman problem
- EM3D: electromagnetic waves through objects in three dimensions
- Health: Columbian health-care system
- MST: minimum spanning tree of a graph using Bentley's algorithm
- Perimeter: perimeters of regions in images represented by Quadtrees
- Power: decentralized optimal power pricing
- TreeAdd: recursive depth first traversal of a binary tree, and summing up the value of each element in the tree
This work is supported in part by AFOSR under grant FA9550-14-1-0187. Any opinions, findings, and conclusions or recommendations expressed in this site are those of the author(s) and do not necessarily reflect the views of AFOSR.