Offline replay of the stream's 3D chain: solve3D_chunks¶
Implementation note. solve3D_chunks was committed on 2026-10-11 (da5a17e89); the whole-stack run
cuts, its defaults and UI, and SOLVE3D_BENCH.txt followed in 76c37002b. The implementation is done;
three validation runs are open (section 9). Its plan module is simple_solve3D_chunks_plan.
Policies: doc/policies/3D/solve3D_chunks_policy.md is the contract of solve3D_chunks.
doc/policies/3D/solve3D_policy.md and doc/policies/3D/solve3D_addon_policy.md are the contracts of
the runs it executes.
1. Purpose¶
Stream task 7 (simple_stream_stage_solve3D) runs one solve3D on the first particles the pool
publishes. It then runs one solve3D_addon for each growth of the pool. Its run time and map quality
depend on a few settings: base size, cohort size, nstates, nstages, lpstop, the sample size,
nparts and nthr. A live session cannot be replayed, and its timing is entangled with the upstream
tasks. So these settings cannot be tuned there.
solve3D_chunks replays the stream's solve3D and solve3D_addon chain offline, on an existing
project, and sizes the runs itself. It is meant mainly for stream emulation and for finding stream
parameters. Its runs are cut as the stream cuts them: consecutive whole stacks in arrival order.
simple_exec prg=solve3D_chunks projfile=<project> <solve3D inputs>
Each invocation is one setting; a parameter sweep is several invocations. It produces the chain of projects the stream would publish, and a report that puts the steps' timing and quality side by side.
2. The stream and solve3D_chunks¶
Sources: simple_stream_stage_solve3D.f90 (start_solve3D, start_addon, cap_rows,
roll_back_addon) and simple_commanders_stream_p07_solve3D_multistate.f90.
| Stream | solve3D_chunks |
|
|---|---|---|
| Rows | one row set that grows; rows not in a run are deselected in the job's project | all rows from the start; rows of later runs deselected |
| Base | the first published particles, whole stacks up to nptcls3D_max |
the first block of whole stacks, sized automatically |
| Cohort | whole stacks in order, up to nptcls_addon_max (cap_rows); cadence gate |
the next block of whole stacks; no cadence gate |
| Add-on | solve3D_addon, compute keys only, the rest replayed from the manifest |
same commander |
| Regressed add-on | rolled back, cohort retried with more particles | always adopted, logged |
| Sample size | from the stream's settings | fixed total of 5000 per iteration |
It does not reproduce the upstream tasks: the pool's 2D, its selection model, or the sieve's
cavg_ini_ext start. Nor does it run the final multi-state refine3D the stream runs on pool_final.
3. Run plan¶
The workflow counts the rows whose input ptcl2D state is above 0, in row order. That is the stream's
order: pool stacks in import order. Inactive rows belong to no run and stay inactive in every step. Let
N be the number of active rows. The full rule is in the policy (solve3D_chunks_policy.md, sections
3 and 4). In short:
- Sample size. Every run samples 5000 particles per iteration, all states together.
solve3Dsamplesnsample * nstates, a rule that stays unchanged, so the workflow setsnsample = 5000 / nstates, rounded down. The add-ons replay it from the base manifest. - Run sizes. Every run searches 10000 to 30000 new particles, two to six times the sample size.
The run count is
R = ceiling(N / 30000). - Cuts. The active particles are cut in row order into
Rblocks of consecutive whole stacks. Each cut goes to the stack boundary nearest its balanced target that keeps every run within the limits. Failing that, it falls inside a stack; the log and the report count those cuts. - Refusal. Fewer than 10000 active particles is the only one. With 10000 to 30000, only the base runs.
Run 0 is the base, the start of the session as in the stream. Uneven views within a run are left to
balance=cavg.
4. Steps¶
4.1 Directory layout¶
The workflow's params%new creates the execution directory E and copies the input project into it.
E/<project>.simple input copy; the final result is published over it
E/source.simple the 3D-free source (4.2)
E/base.simple base step project
E/1_solve3D/base.simple base result, registers its run manifest
E/addon_01.simple add-on 1 step project, replaced by its published union
E/2_solve3D_addon/ add-on 1 run directory: frozen copy, maps, manifest, add-on report
E/addon_02.simple, E/3_solve3D_addon/, ...
E/solve3D_chunks_report.txt
Every run directory also holds SOLVE3D_BENCH.txt (section 6).
4.2 The source copy¶
Once, on source.simple, everything 3D and every run registration is removed:
cls3D;- the 3D entries of
out; - the
ptcl3Dalignment; - the
projinfoentriessigma2_state,solve3D_manifestandsolve3D_run_id.
The 2D solution stays: cls2D, and the class-average and frc2D entries of out. That keeps
balance=cavg and the FRC-planned ladder available. These are the classes of the whole dataset, a mild
look-ahead the stream does not have. Without a usable 2D solution the base runs under balance=none,
with the mskdiam ladder.
4.3 Base and add-on k¶
The step project of run k is the source with runs k+1 and later deselected in ptcl2D and
ptcl3D. It is rebuilt from the source each time. The frozen particles' poses and labels come from the
frozen project, not the step project.
- Base:
solve3D projfile=E/base.simple mkdir=yes, with the base command line (section 5). Its result is the first frozen project. - Add-on k:
solve3D_addon projfile=E/addon_kk.simple projfile_frozen=<current frozen> mkdir=yes, with the forwarded keys. It publishes the union overE/addon_kk.simple, which becomes the frozen project of add-onk+1. Each add-on runs a registration pass and the base run's last stage.
Both commanders run in-process, unchanged. The workflow returns to E after each run.
4.4 Verdicts and adoption¶
After every add-on, the workflow reads its solve3D_addon_report.txt and keeps the per-state verdicts.
Every add-on is adopted, so each block is searched exactly once. A regression is logged with the states
it affects and shown in the report.
4.5 Publication¶
At the end, solve3D_chunks publishes the final result over E/<project>.simple, where simple_exec
records the job. It does this the way solve3D_addon publishes its own result: temporary file renamed
over the target, manifest registered by absolute path.
5. Command line and routing¶
The UI entry uses add_solve3D_base_inputs (simple_ui_solve3D.f90) with the stream-compatible inputs,
without vol1, cavg_ini, cavg_ini_ext, state, nsample, rec_backend and the PCG controls.
| Key | Status |
|---|---|
projfile |
required |
addon_diag |
optional, default yes; goes to every add-on |
filt_mode |
optional, default nonuniform_lpset |
other stream-compatible solve3D inputs |
as in solve3D; go to the base; nstages at least 3 |
nsample |
not accepted; set to 5000 / nstates |
rec_backend and the PCG controls |
not accepted; rec_backend=gridding is set |
vol1, cavg_ini, cavg_ini_ext, state, projfile_frozen |
not accepted |
Every key is checked against the program's UI entry, so nothing is ignored silently. The defaults are
set before params%new, in the form the UI default audit (scripts/default_audit.py) reads, so the UI
shows them. balance keeps solve3D's default: cavg with a usable 2D solution, none without.
5.1 Routing to the add-ons¶
An entry key goes to an add-on when the solve3D_addon UI accepts it and the base manifest does not
record it as an input (manifest_records_input). That covers addon_diag, nparts, nthr and
overlap. Recorded inputs (balance, nclust, mskdiam, filt_mode, rec_backend, ...) reach the
add-ons through the base manifest. nsample is not a recorded input, but the manifest's replay sets
it, with nstates, from the base run's sampling record, so the workflow leaves its own nsample off
the add-on command line. The workflow's own keys never reach the child runs.
6. Reports and benchmarks¶
The report is rewritten after every run, so a run that stops part-way keeps what it measured. Its
header records the run count, nstates, nsample with the total it samples, every run's size, and
the number of cuts inside a stack. It has one row per run:
- kind, run index, frozen and added particles, union size;
- last stage, with its low-pass limit and box;
- wall time, and seconds per 1000 added particles;
- adopted.
Then come per-state lines:
- Every run: the FSC=0.143 and FSC=0.5 resolutions of the result.
- Add-ons, in addition: the verdict, FSC shell shift, map correlation with the frozen map, and the
cohort-only resolution. That last figure is 0.00 when
addon_diag=no, which means "not computed".
Every solve3D and solve3D_addon run also writes SOLVE3D_BENCH.txt in its run directory, under
L_BENCH_GLOB, in the format of the other SIMPLE benchmark files. It times six phases:
- setup;
- the starting state (for an add-on, the frozen accumulation);
- the registration pass;
- the refine3D stages;
- the final reconstruction;
- the epilogue (for an add-on, its report and cohort-only map).
Read across the chain, these separate the capped search from the passes over the whole union.
7. Code map¶
| File | Owns |
|---|---|
src/main/commanders/simple/simple_commanders_solve3D_chunks.f90 |
commander_solve3D_chunks: validation, the run plan, the child runs, routing, statistics, the report, adoption and publication |
src/main/solve/simple_solve3D_chunks_plan.f90 |
chunk_nsample, derive_chunk_run_count, partition_selected_balanced (whole-stack cuts), the constants, prepare_chunks_source, select_chunks_step, chunks_step, chunks_report |
src/main/solve/simple_solve3D_chunks_plan_tester.f90 |
the unit sub-suite solve3D chunks plan (unit_project) |
src/main/commanders/simple/simple_commanders_solve3D.f90 |
the child runs, unchanged except SOLVE3D_BENCH.txt |
src/main/ui/simple/simple_ui_solve3D.f90, src/main/exec/simple_exec_solve3D.f90 |
the UI entry and dispatch |
solve3D_chunks adds no parameter keys.
8. Evidence so far¶
All three runs below used the version committed in da5a17e89, which still dealt particles to the runs
class by class. It did not yet have the whole-stack cuts.
| Project | Particles | Runs | States | Storage | Result |
|---|---|---|---|---|---|
| msp1 | 141838 | 5 of about 28368 | 2 | /usr/local/cache |
base 2238 s; add-ons 1461, 1510, 1560 s; resolution improves at every add-on, to 5.6 and 5.9 Å after add-on 3; cohort-only maps 4.6 to 6.6 Å |
| embb | 57970 | 2 of 28985 | 3 | /usr/local/data |
base 2320 s, add-on 1179 s; states 1 and 3 improve to 6.0 and 6.2 Å; state 2 stays at 19.7 Å (collapsed); run without addon_diag |
| ribosome | 436455 of 751729 rows | 15 of 29097 | 3 | spinning disk | base at iteration 65 of at most 84 after almost two hours; a late iteration took 204 s, 140 s of it the probabilistic pre-step, with the CPUs often idle; one state collapsed to 1979 particles at 19.7 Å |
What the runs show:
- The add-on chain works. It improves the maps at every step, and with growing union size each add-on takes slightly longer: about 50 s per step in msp1.
- Reading dominated the ribosome run. Dealt by class, each iteration's sample touched about one particle per stack file across the whole dataset. That motivated the whole-stack cuts.
- One state collapsed in both three-state runs. Each add-on starts its cohort with states assigned uniformly at random, so a collapsed state still receives a third of every cohort.
9. Open validation¶
- The ribosome rerun with whole-stack cuts, with
SOLVE3D_BENCH.txtfrom every run directory. - A base-only run, a split near the 30000 boundary, and a cut that falls inside a stack.
- The published project: its solution and its manifest registration.
10. Known limits¶
- Row growth is not exercised. All rows exist from the start, so the superset relation never sees appended rows. The stream's append path is covered by the snapshot generator test.
- Look-ahead in the 2D solution (4.2).
- The cap bounds the search, not the union. Each add-on also accumulates the frozen term over every frozen particle and reconstructs the whole union. That cost grows with every step, in the stream as well.
- Fewer sampled particles per state. With a fixed total, each state gets about
5000 / nstatesfreshly searched particles per iteration.
11. Decisions¶
Hans, 2026-10-11:
- All sizing derives from a fixed sample of 5000 per iteration. Runs hold 10000 to 30000 particles.
nsample = 5000 / nstates, whilesolve3D's own rule (nsample * nstatesper iteration) stays unchanged. - It is meant mainly for stream emulation. Runs are the fewest that fit, cut in row order at stack boundaries, as the stream cuts them. A class-by-class deal was tried and dropped: it hid the stream's base condition and made reading bound by disk seeks.
- A base-only plan is allowed. Fewer than 10000 particles is refused, and so is
nstagesbelow 3, before anything is written. - Every add-on is adopted. Regressions are logged.
- The 30000 cap is on the newly searched particles of a run, not on the union.
- The final result is published over the execution directory's project.
- Defaults:
addon_diag=yes,filt_mode=nonuniform_lpset, and gridding reconstruction always, with no PCG controls;balancefollowssolve3D. - From the review of 2026-10-10, kept: masked steps on one row set, not physical snapshots; the source's 2D classes and FRCs are kept, despite their look-ahead; add-ons get only forwarded keys; the runs execute the commanders in-process, with no subprocesses.