1 
 2 ### FuncOpViewer and CodeModelFormatter
 3 
 4 ----
 5 * [Contents](hat-00.md)
 6 * Build Babylon and HAT
 7     * [Quick Install](hat-01-quick-install.md)
 8     * [Building Babylon with jtreg](hat-01-02-building-babylon.md)
 9     * [Building HAT with jtreg](hat-01-03-building-hat.md)
10         * [Enabling the NVIDIA CUDA Backend](hat-01-05-building-hat-for-cuda.md)
11 * [Testing Framework](hat-02-testing-framework.md)
12 * [Running Examples](hat-03-examples.md)
13 * [HAT Programming Model](hat-03-programming-model.md)
14 * Interface Mapping
15     * [Interface Mapping Overview](hat-04-01-interface-mapping.md)
16     * [Cascade Interface Mapping](hat-04-02-cascade-interface-mapping.md)
17 * Development
18     * [Project Layout](hat-01-01-project-layout.md)
19 * Implementation Details
20     * [Walkthrough Of Accelerator.compute()](hat-accelerator-compute.md)
21     * [How we minimize buffer transfers](hat-minimizing-buffer-transfers.md)
22 * [Running HAT with Docker on NVIDIA GPUs](hat-07-docker-build-nvidia.md)
23 ---
24 
25 We have a few 'tools' in [hat/tools/src/main/java/hat/tools](https://github.com/openjdk/babylon/blob/code-reflection/hat/tools)
26 which might be useful to others
27 
28 Two in particular
29 
30 #### FuncOpViewer
31 This is a swing app which takes a text file containing text form of a CodeModel (as dumped by the OopWriter)
32 
33 
34 We can generate text for kernels using
35 ```
36 HAT=SHOW_KERNEL_MODEL java @hat/run ffi-opencl mandel
37 ```
38 
39 From the standard out copy the text satrting with `func @loc....1` to the closing `}` and paste it into a file (say mandel.cr)
40 
41 Then
42 
43 ```
44 java -cp build/hat-tools-1.0.jar hat.tools.textmodel.ui.FuncOpViewer mandle.cr
45 ```
46 
47 ### CodeModelFormatter
48 
49 Is a terminal based tool (useful if you are accessing a machine via ssh - and can't launch ui)
50 
51 With it you can dump to the terminal a colorized version of the code model, slightly prettied up with java source for each line inserted as a comment.
52 
53 ```
54 java -cp build/hat-tools-1.0.jar hat.tools.textmodel.terminal.CodeModelFormatter code.cr
55 ```
56