scorecard: one thread per run and eight runs at a time, and --resume
This commit is contained in:
parent
d7547085e5
commit
3181c5ef7b
2 changed files with 51 additions and 14 deletions
|
|
@ -94,14 +94,16 @@ minute are reported, never judged: healing more can follow losing more.
|
||||||
|
|
||||||
## Cost and size
|
## Cost and size
|
||||||
|
|
||||||
On the ten-core build box a session run costs about 15 to 20 wall seconds per brain minute of
|
A run's brain minute costs about 75 CPU seconds however it is split, and the result does not
|
||||||
throughput, whatever the split: one job of five threads, two of four and three of three were
|
depend on the thread count (the same seed gives an identical report at one thread and at four).
|
||||||
within 20% of each other (two jobs of four threads was best, and is the default; the legacy loop
|
The split matters for wall time, because a run's sweep pool spins at its barriers: on a quiet
|
||||||
is about a quarter faster). The default suite, twelve checkpoints by three seeds by ten brain
|
ten-core box two jobs of four threads are fine, but on a box shared with compiles and tests one
|
||||||
minutes, is 360 brain minutes: about an hour and a half on a quiet box. The box is shared: a
|
job of four threads ran five times slower per brain minute than one-thread jobs did. So the
|
||||||
compile storm beside it triples the wall time and changes no number. More seeds tighten the
|
default is one thread per run and eight runs at a time. The default suite, twelve checkpoints by
|
||||||
test; longer runs let rungs climb. Three seeds is the smallest suite whose pair count (36) can
|
three seeds by ten brain minutes, is 360 brain minutes: about three quarters of an hour of ten
|
||||||
reach p < 0.001.
|
quiet cores, about twice that when the box is busy. More seeds tighten the test; longer runs let
|
||||||
|
rungs climb. Three seeds is the smallest suite whose pair count (36) can reach p < 0.001.
|
||||||
|
`--resume` keeps the runs an interrupted suite had finished (`<out>.runs.jsonl`).
|
||||||
|
|
||||||
## What it does not do
|
## What it does not do
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ use flysim::snapshot::MacroMode;
|
||||||
|
|
||||||
use fly_scorecard::compare::compare;
|
use fly_scorecard::compare::compare;
|
||||||
use fly_scorecard::runner::{Runtime, RunSpec, build_info, run_legacy, run_session};
|
use fly_scorecard::runner::{Runtime, RunSpec, build_info, run_legacy, run_session};
|
||||||
|
use fly_scorecard::tally::RunReport;
|
||||||
use fly_scorecard::suite::{
|
use fly_scorecard::suite::{
|
||||||
CheckpointSet, ChildArgs, Job, SCHEMA, SuiteConfig, SuiteReport, note, run_jobs,
|
CheckpointSet, ChildArgs, Job, SCHEMA, SuiteConfig, SuiteReport, note, run_jobs,
|
||||||
};
|
};
|
||||||
|
|
@ -56,7 +57,7 @@ enum Cmd {
|
||||||
runtime: String,
|
runtime: String,
|
||||||
#[arg(long, default_value = "macros")]
|
#[arg(long, default_value = "macros")]
|
||||||
mode: String,
|
mode: String,
|
||||||
#[arg(long, default_value_t = 4)]
|
#[arg(long, default_value_t = 1)]
|
||||||
threads: usize,
|
threads: usize,
|
||||||
#[arg(long, default_value_t = 120.0)]
|
#[arg(long, default_value_t = 120.0)]
|
||||||
probe_s: f64,
|
probe_s: f64,
|
||||||
|
|
@ -86,11 +87,13 @@ enum Cmd {
|
||||||
runtime: String,
|
runtime: String,
|
||||||
#[arg(long, default_value = "macros")]
|
#[arg(long, default_value = "macros")]
|
||||||
mode: String,
|
mode: String,
|
||||||
/// Sweep threads per run.
|
/// Sweep threads per run. One: a run's pool spins at its barriers, so on a box shared with
|
||||||
#[arg(long, default_value_t = 4)]
|
/// other jobs one-thread runs lose far less than four-thread ones, and the result does
|
||||||
|
/// not depend on the count.
|
||||||
|
#[arg(long, default_value_t = 1)]
|
||||||
threads: usize,
|
threads: usize,
|
||||||
/// Runs at a time.
|
/// Runs at a time.
|
||||||
#[arg(long, default_value_t = 2)]
|
#[arg(long, default_value_t = 8)]
|
||||||
jobs: usize,
|
jobs: usize,
|
||||||
#[arg(long, default_value_t = 120.0)]
|
#[arg(long, default_value_t = 120.0)]
|
||||||
probe_s: f64,
|
probe_s: f64,
|
||||||
|
|
@ -109,6 +112,9 @@ enum Cmd {
|
||||||
/// Fail instead of running a smaller set when a checkpoint of the set is missing.
|
/// Fail instead of running a smaller set when a checkpoint of the set is missing.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
strict: bool,
|
strict: bool,
|
||||||
|
/// Keep the runs an earlier invocation finished (`<out>.runs.jsonl`) and run the rest.
|
||||||
|
#[arg(long)]
|
||||||
|
resume: bool,
|
||||||
},
|
},
|
||||||
/// Release A against release B. Exit 1 when a metric regressed.
|
/// Release A against release B. Exit 1 when a metric regressed.
|
||||||
Compare {
|
Compare {
|
||||||
|
|
@ -258,7 +264,7 @@ fn real_main() -> Result<()> {
|
||||||
}
|
}
|
||||||
Cmd::Suite {
|
Cmd::Suite {
|
||||||
set, extra, only, seeds, minutes, runtime, mode, threads, jobs, probe_s, window_s, label, out, md,
|
set, extra, only, seeds, minutes, runtime, mode, threads, jobs, probe_s, window_s, label, out, md,
|
||||||
dataset, strict,
|
dataset, strict, resume,
|
||||||
} => {
|
} => {
|
||||||
Runtime::parse(&runtime)?;
|
Runtime::parse(&runtime)?;
|
||||||
mode_of(&mode)?;
|
mode_of(&mode)?;
|
||||||
|
|
@ -266,12 +272,33 @@ fn real_main() -> Result<()> {
|
||||||
let resolved = resolve(&set, &extra, &only, strict)?;
|
let resolved = resolve(&set, &extra, &only, strict)?;
|
||||||
let exe = std::env::current_exe().context("finding this executable")?;
|
let exe = std::env::current_exe().context("finding this executable")?;
|
||||||
let seed_list: Vec<u32> = (1..=seeds).collect();
|
let seed_list: Vec<u32> = (1..=seeds).collect();
|
||||||
|
// Every finished run is appended to `<out>.runs.jsonl` at once, so a suite that dies
|
||||||
|
// (a box that reboots, a job that is killed) keeps what it finished.
|
||||||
|
let runs_log = out.with_extension("runs.jsonl");
|
||||||
|
let mut prior: Vec<RunReport> = Vec::new();
|
||||||
|
if resume {
|
||||||
|
if let Ok(text) = std::fs::read_to_string(&runs_log) {
|
||||||
|
prior = text
|
||||||
|
.lines()
|
||||||
|
.filter_map(|line| serde_json::from_str::<RunReport>(line).ok())
|
||||||
|
.filter(|run| run.runtime == runtime && run.mode == mode && run.minutes >= minutes - 0.01)
|
||||||
|
.collect();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let _ = std::fs::remove_file(&runs_log);
|
||||||
|
}
|
||||||
let mut queue = Vec::new();
|
let mut queue = Vec::new();
|
||||||
for r in &resolved {
|
for r in &resolved {
|
||||||
for seed in &seed_list {
|
for seed in &seed_list {
|
||||||
|
if prior.iter().any(|run| run.checkpoint == r.id && run.seed == *seed) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
queue.push(Job { id: r.id.clone(), path: r.path.clone(), seed: *seed });
|
queue.push(Job { id: r.id.clone(), path: r.path.clone(), seed: *seed });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !prior.is_empty() {
|
||||||
|
eprintln!("scorecard: resuming with {} finished runs, {} to go", prior.len(), queue.len());
|
||||||
|
}
|
||||||
let child = ChildArgs {
|
let child = ChildArgs {
|
||||||
runtime: runtime.clone(),
|
runtime: runtime.clone(),
|
||||||
mode: mode.clone(),
|
mode: mode.clone(),
|
||||||
|
|
@ -304,8 +331,13 @@ fn real_main() -> Result<()> {
|
||||||
};
|
};
|
||||||
eprintln!("{line}");
|
eprintln!("{line}");
|
||||||
note(&progress, &line);
|
note(&progress, &line);
|
||||||
|
if let Ok(run) = outcome
|
||||||
|
&& let Ok(text) = serde_json::to_string(run)
|
||||||
|
{
|
||||||
|
note(&runs_log, &text);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
let mut runs = Vec::new();
|
let mut runs = prior;
|
||||||
let mut failed_runs = Vec::new();
|
let mut failed_runs = Vec::new();
|
||||||
for outcome in outcomes {
|
for outcome in outcomes {
|
||||||
match outcome {
|
match outcome {
|
||||||
|
|
@ -313,6 +345,9 @@ fn real_main() -> Result<()> {
|
||||||
Err(failed) => failed_runs.push(failed),
|
Err(failed) => failed_runs.push(failed),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let order: BTreeMap<&str, usize> =
|
||||||
|
resolved.iter().enumerate().map(|(i, r)| (r.id.as_str(), i)).collect();
|
||||||
|
runs.sort_by_key(|run| (order.get(run.checkpoint.as_str()).copied().unwrap_or(usize::MAX), run.seed));
|
||||||
let suite = SuiteReport {
|
let suite = SuiteReport {
|
||||||
schema: SCHEMA.to_owned(),
|
schema: SCHEMA.to_owned(),
|
||||||
label,
|
label,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue