Repository navigation
Forward all supported params to the Fortran run - #233
Merged
Merged
Conversation
This was referenced Aug 15, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the harness half of #228. The gate-design half (what to do about a non-reproducible reference) is separate and still open.
Problem
run_fortran_amicarewrote six hardcoded keys —files,outdir,max_iter,lrate,pdftype,num_mix_comps— and passed every other line of the template through untouched. Any other setting in the caller'sparamswas honored on the Python side and silently ignored on the Fortran side.params["do_newton"] = Falsetherefore ran Python without Newton against a reference still using it. The harness already warns about params the NG backend cannot honor; the reverse direction was unguarded, and it is the direction that quietly makes a comparison uncontrolled. It bit me while investigating #228: an experiment I ran to rule out Newton was invalid and I did not notice until reading the writer.This also matters now that
block_sizedefaults to 8192 (#229) while the template says 512.Fix
write_fortran_param_fileforwards every param the binary accepts, rewriting the template line or appending when the template lacks it — the binary accepts 88 keywords, the shippedinput.paramlists 74.The accepted set is parsed from
amica15.f90's owncase('...')arms rather than hardcoded, so it cannot drift from the binary being run. If the source is unavailable the filter disables itself rather than dropping settings.Anything the binary does not accept is reported by name.
device/seed/dtypeconfigure our side only and are exempt, so the warning stays meaningful.Three params.json spellings differ from the Fortran keyword and are aliased:
num_mix→num_mix_comps,share_int→share_iter,maxrej→numrej. Booleans become 0/1.Two bugs in my first cut, caught by testing
files/outdir, pointing the reference run at the path from params.json. Overrides are now applied last.max_decs→maxdecs, which is wrong:max_decsis the keyword,maxdecsonly the internal variable. The alias made a supported key look unsupported.Both are covered by tests.
Tests
pamica/tests/test_fortran_param_forwarding.py, 10 tests:do_newtonandblock_sizeforwarding (the two that motivated this), alias translation, appending keys absent from the template, overrides winning, untouched template values surviving, unsupported keys being reported, and Python-only keys staying quiet.Note
This does not make the reference reproducible — it has no seed parameter, and that is the rest of #228.