ocaml5-tutorial
ocaml5-tutorial copied to clipboard
Edit ReadMe, Second Pass
Error, after running `hyperfine ‘dune exec src/fib.exe 40’
Warning: The first benchmarking run for this command was significantly slower than the rest (49.7 ms).
This could be caused by (filesystem) caches that were not filled until after the first run.
You should consider using the '--warmup' option to fill those caches before the actual benchmark.
Alternatively, use the '--prepare' option to clear the caches before each timing run.
No indication with what to run –warmup, etc. Tried dune
hyperfine
opam
ocaml
… nothing. Nothing in my searches or Slack Overflow.
Learned it was a hyperfine
command, so I tried hyperfine --warmup ‘dune exec …’ and got an error. It needed a number for the number of times to run (?), so I tried
hyperfine --warmup 2 ‘dune exec …’ … and I got more errors:
Benchmark 1: dune exec ssrc/fib_domainslib.exe 2 42
Error: Command terminated with non-zero exit code: 1. Use the '-i'/'--ignore-failure'
option if you want to ignore this. Alternatively, use the '--show-output'
option to debug what went wrong.
“Observe that there is super-linear speedup going from the sequential version to the two-core version! Why?”
This question isn’t answered.
In:
% hyperfine 'dune exec src/spectralnorm_par.exe 2 4096' 'dune exec src/spectralnorm_par.exe 4 4096'
Benchmark 1: dune exec src/spectralnorm_par.exe 2 4096
Time (mean ± σ): 1.169 s ± 0.053 s [User: 2.201 s, System: 0.030 s]
Range (min … max): 1.109 s … 1.294 s 10 runs
Benchmark 2: dune exec src/spectralnorm_par.exe 4 4096
Time (mean ± σ): 702.3 ms ± 20.7 ms [User: 2599.1 ms, System: 39.5 ms]
Range (min … max): 674.0 ms … 741.4 ms 10 runs
The second Benchmark didn’t appear for me. Why?
This tutorial uses ocaml
for the exercises, but the ocaml.org "Up and Running" uses utop
, which is apparently easier. Are you using ocaml
because it's not necessary to install anything else? Show we make note of UTop as well? .... or at least explain why we use the command ocaml
?
Are you sure the command used to run this had both benchmarks on the same line?
Ha! I'm not sure (I have no memory!). I'll go through it again and see.
I finally addressed those few suggestions/clarifications @Sudha247 left. I really need to go back through this step-by-step to see what I meant about the 2nd benchmark not showing up. Is this still the place to do this or will the OCaml 5 tutorials now be on OCaml.org?