diff --git a/.gitignore b/.gitignore index 2b9560b3..350e2cab 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ examples/**/main examples/**/*.c examples/**/*.cu .out.hvm +dots.js # nix-direnv /.direnv/ diff --git a/README.md b/README.md index 4821d05e..36796910 100644 --- a/README.md +++ b/README.md @@ -72,3 +72,34 @@ don't worry, it isn't meant to. [Bend](https://github.com/HigherOrderCO/Bend) is the human-readable language and should be used both by end users and by languages aiming to target the HVM. If you're looking to learn more about the core syntax and tech, though, please check the [PAPER](./paper/HVM2.pdf). + +Interaction Net graph dumping and visualization +----------------------------------------------- + +With the rust interpreter (`hvm run`), every evaluation step can be dumped with +the `--dump` command line option. You can dump in sequential mode (only one +redex is evaluated in each step) or, with the `--parallel` option, +in parallel mode (all redexes are evaluated in each step). + +The dump will be written to the file `dots.js` in the current directory. + +You can view the graph dump with `index.html` as follows: + +Copy the file `dots.js` to the HVM directory. Then start a http server in the +HVM directory: + +```sh +cd HVM +python3 -m http.server +``` + +Now you can visit `http://127.0.0.1:8000` and step through the graph with +the wasd keys on your keyboard. + +How parallel is my Bend/HVM program? +------------------------------------ + +With the `--parallel` option, HVM also calculates the average number of regexes +in each step, thus giving a measurement of how parallel a given bend program is. + +You can use the `--parallel` option without the `--dump` option as well. \ No newline at end of file