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     * [IntelliJ Code Formatter](hat-development.md)
20 * Implementation Details
21     * [Walkthrough Of Accelerator.compute()](hat-accelerator-compute.md)
22     * [How we minimize buffer transfers](hat-minimizing-buffer-transfers.md)
23 * [Running HAT with Docker on NVIDIA GPUs](hat-07-docker-build-nvidia.md)
24 ---
25 
26 We have a few 'tools' in [hat/tools/src/main/java/hat/tools](https://github.com/openjdk/babylon/blob/code-reflection/hat/tools)
27 which might be useful to others
28 
29 Two in particular
30 
31 #### FuncOpViewer
32 This is a swing app which takes a text file containing text form of a CodeModel (as dumped by the OopWriter)
33 
34 
35 We can generate text for kernels using
36 ```
37 HAT=SHOW_KERNEL_MODEL java @hat/run ffi-opencl mandel
38 ```
39 
40 From the standard out copy the text satrting with `func @loc....1` to the closing `}` and paste it into a file (say mandel.cr)
41 
42 Then
43 
44 ```
45 java -cp build/hat-tools-1.0.jar hat.tools.textmodel.ui.FuncOpViewer mandle.cr
46 ```
47 
48 ### CodeModelFormatter
49 
50 Is a terminal based tool (useful if you are accessing a machine via ssh - and can't launch ui)
51 
52 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.
53 
54 ```
55 java -cp build/hat-tools-1.0.jar hat.tools.textmodel.terminal.CodeModelFormatter code.cr
56 ```
57