Skip to content
Snippets Groups Projects
Verified Commit 68e5be0f authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

move all plot-related stuff to results repo

parent 947b5ee0
No related branches found
No related tags found
1 merge request!218move all plot-related stuff to results repo
Pipeline #9566 passed
# Table of contents
- [Requirements](#requirements)
- [Run](#run)
- [Plot](#plot)
## Requirements
> [!note] NOTE
>
> these should only be required for plotting results
- install [GPLT](https://gitlab.isae-supaero.fr/a.stevan/gplt) (for plotting)
- install [Virtualenv](https://github.com/pypa/virtualenv) (for managing Python virtual environments)
- activate the `benchmarks` module
```bash
use benchmarks
......@@ -168,44 +161,5 @@ const RESULTS_DIR = "/path/to/komodo-benchmark-results/"
> }
> ```
## Plot
```bash
benchmarks plot -i $RESULTS_DIR -o out field group setup commit linalg fec --cpu-hash-pattern '^ee672bb3' --src-hash-pattern '^c8f3481f' --rust-build 'debug'
```
```bash
benchmarks plot -i $RESULTS_DIR -o out field group setup commit linalg fec --cpu-hash-pattern '^ee672bb3' --src-hash-pattern '^(00086216|04541a50)' --rust-build 'release'
```
```bash
use regex.nu *
let srcs = [
"00086216", # 909176b0, da197416
"b4212615", # 825cec65
"04541a50", # a780eb1d, 206fe9d2, 5727d551
"544835dd", # 5727d551
"fa141146", # 5727d551
"491b37ea", # 5727d551
"4daad4a0", # 5727d551
"b92ecb2d", # 5727d551
"64f25f1d", # 5727d551
"53e7bf81", # 5727d551
"e591a733", # 5727d551
"43ad9f18", # 062a39b5
"90394e42", # 057569f7
"18b67518", # 0acf66a2
"e8d6f8fa", # 943e5932
"0d0768b9", # e7b9968c
]
(benchmarks plot
-i $RESULTS_DIR
-o out
protocols
--git-hash-pattern ''
--cpu-hash-pattern ('ee672bb315ea00fe5815f0e20db6aa88017c1ba8355794f411c10a6057377e57' | regex exact)
--src-hash-pattern ($srcs | regex or | regex start)
--rust-build 'release'
)
```
[gitlab.isae-supaero.fr:dragoon/komodo-benchmark-results]: https://gitlab.isae-supaero.fr/dragoon/komodo-benchmark-results
[`nuenv`]: https://github.com/nushell/nu_scripts/blob/main/nu-hooks/nu-hooks/nuenv/hook.nu
export use run.nu
export use plot.nu
export-env {
^$nu.current-exe ./scripts/check-nushell-version.nu
}
use ../log.nu [ "log info", "log warning", "log error", "log hint", "str color" ]
const CPU_FIELDS = [
"Architecture",
"CPU op-mode(s)",
"Address sizes",
"Byte Order",
"CPU(s)",
"On-line CPU(s) list",
"Model name",
"CPU family",
"Model",
"Thread(s) per core",
"Core(s) per socket",
"Socket(s)",
"Stepping",
"CPU max MHz",
"CPU min MHz",
"BogoMIPS",
"Virtualization",
"L1d cache",
"L1i cache",
"L2 cache",
"L3 cache",
"NUMA node(s)",
"NUMA node0 CPU(s)",
]
const BENCHES = [ field, group, setup, commit, linalg, fec, recoding, semi-avid, kzg, aplonk ]
def lscpu []: [ nothing -> record ] {
^lscpu --json
| from json
| get lscpu
| update field { str trim --right --char ":" }
| transpose --header-row
| into record
}
def --wrapped bench [--rust-build: string, ...args: string] {
let rust_build = match $rust_build {
"release" => { cargo_flag: [ "--release" ], build: "release" },
"debug" => { cargo_flag: [], build: "debug" },
_ => {
log warning $"unknown Rust build (ansi yellow)($rust_build)(ansi reset), defaulting to (ansi green)release(ansi reset) for best performance"
{ cargo_flag: [ --release ], build: "release" }
},
}
let options = [
...$rust_build.cargo_flag
--package benchmarks
--
--rust-build $rust_build.build
...$args
]
log info $"cargo run ($options | str join ' ')"
cargo run ...$options
}
export def run [
...benches : string,
--all,
--output-dir (-o) : path = "./a.out",
--curves : list<string> = [],
--degrees : list<int> = [],
--matrix-sizes : list<int> = [],
--data-sizes : list<int> = [],
--ks : list<int> = [],
--rhos : list<float> = [],
--rust-build : string = "release",
--steps : list<string>,
--overwrite,
] {
let benches = match [ $all, ($benches | length) ] {
[ false, 0 ] => {
log error "nothing to do"
return
},
[ false, _ ] => $benches,
[ true, 0 ] => $BENCHES,
[ true, _ ] => {
log warning "--all is raised even though benches have been provided"
$BENCHES
},
}
let target_dir = $output_dir
let cpus_dir = $target_dir | path join "cpus"
if not ($target_dir | path exists) {
log warning $"creating directory ($target_dir | str color purple)"
mkdir $target_dir
}
let komodo_hash = git rev-parse HEAD
let src_hash = ls src/*.rs benchmarks/**/*.rs
| each { open $in.name | hash sha256 }
| str join
| hash sha256
let cpu = lscpu | select ...$CPU_FIELDS
let cpu_hash = $cpu | to json | hash sha256
def out [stem: string]: [ nothing -> path] {
{ parent: $target_dir, stem: $stem, extension: "ndjson" } | path join
}
for b in $benches {
let opts = match $b {
"field" => { out: $b , args: { n: 10000, rest: [ --curves ...$curves --all ] } },
"group" => { out: $b , args: { n: 1000, rest: [ --curves ...$curves --all ] } },
"setup" => { out: $b , args: { n: 10, rest: [ --curves ...$curves --degrees ...$degrees ] } },
"commit" => { out: $b , args: { n: 10, rest: [ --curves ...$curves --degrees ...$degrees ] } },
"linalg" => { out: $b , args: { n: 10, rest: [ --curves ...$curves --sizes ...$matrix_sizes ] } },
"fec" => { out: "fec" , args: { n: 10, rest: [ --curves ...$curves --sizes ...$data_sizes --ks ...$ks --rhos ...$rhos --encoding random ] } },
"recoding" => { out: "fec" , args: { n: 10, rest: [ --curves ...$curves --sizes ...$data_sizes --ks ...$ks --shards ...$ks ] } },
"semi-avid" => { out: "protocols" , args: { n: 10, rest: [ --curves ...$curves --sizes ...$data_sizes --ks ...$ks --rhos ...$rhos ] } },
"kzg" => { out: "protocols" , args: { n: 5, rest: [ --curves ...$curves --sizes ...$data_sizes --ks ...$ks --rhos ...$rhos ] } },
"aplonk" => { out: "protocols" , args: { n: 1, rest: [ --curves ...$curves --sizes ...$data_sizes --ks ...$ks --rhos ...$rhos ] } },
_ => {
log error $"unknown bench `($b)`"
log hint $" choose one of these: ($BENCHES | each { str color green })"
continue
},
}
let opts = [
(if $overwrite { --overwrite })
--git $komodo_hash
--cpu $cpu_hash
--src $src_hash
-n $opts.args.n
-o (out $opts.out)
$b
...(if $steps != null { [--steps, ...$steps] } else { [] })
...$opts.args.rest
]
bench --rust-build $rust_build ...($opts | compact)
}
mkdir $cpus_dir
$cpu | to json | save --force ({ parent: $cpus_dir, stem: $cpu_hash, extension: "json"} | path join)
}
This diff is collapsed.
use ../log.nu [ "log info", "log warning", "log error", "log hint", "str color" ]
const CPU_FIELDS = [
"Architecture",
"CPU op-mode(s)",
"Address sizes",
"Byte Order",
"CPU(s)",
"On-line CPU(s) list",
"Model name",
"CPU family",
"Model",
"Thread(s) per core",
"Core(s) per socket",
"Socket(s)",
"Stepping",
"CPU max MHz",
"CPU min MHz",
"BogoMIPS",
"Virtualization",
"L1d cache",
"L1i cache",
"L2 cache",
"L3 cache",
"NUMA node(s)",
"NUMA node0 CPU(s)",
]
const BENCHES = [ field, group, setup, commit, linalg, fec, recoding, semi-avid, kzg, aplonk ]
def lscpu []: [ nothing -> record ] {
^lscpu --json
| from json
| get lscpu
| update field { str trim --right --char ":" }
| transpose --header-row
| into record
}
def --wrapped bench [--rust-build: string, ...args: string] {
let rust_build = match $rust_build {
"release" => { cargo_flag: [ "--release" ], build: "release" },
"debug" => { cargo_flag: [], build: "debug" },
_ => {
log warning $"unknown Rust build (ansi yellow)($rust_build)(ansi reset), defaulting to (ansi green)release(ansi reset) for best performance"
{ cargo_flag: [ --release ], build: "release" }
},
}
let options = [
...$rust_build.cargo_flag
--package benchmarks
--
--rust-build $rust_build.build
...$args
]
log info $"cargo run ($options | str join ' ')"
cargo run ...$options
}
export def main [
...benches : string,
--all,
--output-dir (-o) : path = "./a.out",
--curves : list<string> = [],
--degrees : list<int> = [],
--matrix-sizes : list<int> = [],
--data-sizes : list<int> = [],
--ks : list<int> = [],
--rhos : list<float> = [],
--rust-build : string = "release",
--steps : list<string>,
--overwrite,
] {
let benches = match [ $all, ($benches | length) ] {
[ false, 0 ] => {
log error "nothing to do"
return
},
[ false, _ ] => $benches,
[ true, 0 ] => $BENCHES,
[ true, _ ] => {
log warning "--all is raised even though benches have been provided"
$BENCHES
},
}
let target_dir = $output_dir
let cpus_dir = $target_dir | path join "cpus"
if not ($target_dir | path exists) {
log warning $"creating directory ($target_dir | str color purple)"
mkdir $target_dir
}
let komodo_hash = git rev-parse HEAD
let src_hash = ls src/*.rs benchmarks/**/*.rs
| each { open $in.name | hash sha256 }
| str join
| hash sha256
let cpu = lscpu | select ...$CPU_FIELDS
let cpu_hash = $cpu | to json | hash sha256
def out [stem: string]: [ nothing -> path] {
{ parent: $target_dir, stem: $stem, extension: "ndjson" } | path join
}
for b in $benches {
let opts = match $b {
"field" => { out: $b , args: { n: 10000, rest: [ --curves ...$curves --all ] } },
"group" => { out: $b , args: { n: 1000, rest: [ --curves ...$curves --all ] } },
"setup" => { out: $b , args: { n: 10, rest: [ --curves ...$curves --degrees ...$degrees ] } },
"commit" => { out: $b , args: { n: 10, rest: [ --curves ...$curves --degrees ...$degrees ] } },
"linalg" => { out: $b , args: { n: 10, rest: [ --curves ...$curves --sizes ...$matrix_sizes ] } },
"fec" => { out: "fec" , args: { n: 10, rest: [ --curves ...$curves --sizes ...$data_sizes --ks ...$ks --rhos ...$rhos --encoding random ] } },
"recoding" => { out: "fec" , args: { n: 10, rest: [ --curves ...$curves --sizes ...$data_sizes --ks ...$ks --shards ...$ks ] } },
"semi-avid" => { out: "protocols" , args: { n: 10, rest: [ --curves ...$curves --sizes ...$data_sizes --ks ...$ks --rhos ...$rhos ] } },
"kzg" => { out: "protocols" , args: { n: 5, rest: [ --curves ...$curves --sizes ...$data_sizes --ks ...$ks --rhos ...$rhos ] } },
"aplonk" => { out: "protocols" , args: { n: 1, rest: [ --curves ...$curves --sizes ...$data_sizes --ks ...$ks --rhos ...$rhos ] } },
_ => {
log error $"unknown bench `($b)`"
log hint $" choose one of these: ($BENCHES | each { str color green })"
continue
},
}
let opts = [
(if $overwrite { --overwrite })
--git $komodo_hash
--cpu $cpu_hash
--src $src_hash
-n $opts.args.n
-o (out $opts.out)
$b
...(if $steps != null { [--steps, ...$steps] } else { [] })
...$opts.args.rest
]
bench --rust-build $rust_build ...($opts | compact)
}
mkdir $cpus_dir
$cpu | to json | save --force ({ parent: $cpus_dir, stem: $cpu_hash, extension: "json"} | path join)
}
export def "regex or" []: [ list<string> -> string ] { str join '|' | $"\(($in)\)" }
export def "regex start" []: [ string -> string ] { $"^($in)" }
export def "regex end" []: [ string -> string ] { $"($in)$" }
export def "regex exact" []: [ string -> string ] { $"^($in)$" }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment