Rename ExaModelsC to ExaModelsCompiler; publish a model's named blocks - #311
Conversation
Three changes that belong together, since they touch the same files. RENAME. ExaModelsC sat one character from ExaModels, which is inside General's AutoMerge name-similarity cutoff (Damerau-Levenshtein 1, cutoff 2) — registrable only with a maintainer waiver, as QiskitIBMRuntimeC needed. ExaModelsCompiler clears it and says what the package does; the ExaModels family already sits well clear (MadNLPGPU 3, ExaModelsPower 5). NAMED BLOCKS. A compiled library now publishes which named variable, constraint and parameter blocks its model has — kind, offset, length and dims — through P_nblocks / P_block / P_block_name, plus P_get_value / P_set_value for parameters. The layout is instance state: a recipe instantiated at another size reports that size's offsets. In ExaModels itself, get_vars / get_cons / get_pars return the named blocks of each kind, by name or all at once. PARAMETERS ARE PER MODEL. set_parameter! is now set_value!, paired with get_value, matching the two-stage vocabulary; and a model copies the core's parameter vector when it is built. Without that copy every model from one core shared one θ — instantiate passes a placeholder-free container through by identity — so setting a parameter on one compiled instance set it on all. The suite's assertion that instances are independent is what would catch losing it. The schema's version field is dropped: versioning an ABI buys nothing before the packages are registered. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A model copies the core's parameter vector when it is built, so after that point the core is the blueprint and the model owns the values. The two after-build sites — the parameter suite's "Modify after build" testset and the parameters doc page — now call set_value! on the model; calls that precede the build are unchanged, since the copy takes the values as they stand. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Your PR requires formatting changes to meet the project's style guidelines. Please run: julia --project=@runic -e 'using Pkg; Pkg.add("Runic")'
julia --project=@runic -e "using Runic; exit(Runic.main(ARGS))" -- --fix <files>(or Note: the full diff is omitted because it can exceed GitHub Actions input limits. |
|
The ExaModels suite is green on the branch tip: 1619 passed, 0 failed, 2 broken (26m45s) — matching main's own baseline exactly. The six failures on the previous run were all the Full gate set for this branch:
The two consumers are already on their masters, so this branch is the last piece. 🤖 Generated with Claude Code |
Benchmark Results |
Three changes that belong together, since they touch the same files.
Rename:
ExaModelsC→ExaModelsCompilerExaModelsCsits one character fromExaModels, inside General's AutoMerge name-similarity cutoff (Damerau-Levenshtein 1, cutoff 2; lowercase cutoff 1) — registrable only with a maintainer waiver, asQiskitIBMRuntimeCneeded.ExaModelsCompilerclears the check and says what the package does; the rest of the family already sits well clear (MadNLPGPU3,ExaModelsPower5). Git records it as a rename, so the diff is the real delta rather than a re-add.Named blocks, published and queryable
@add_var(c, x, ...)registersx, and until now a consumer holding only a compiled library had no way to learn that. Each model now publishes its named variable, constraint and parameter blocks — kind, offset, length and dims — throughP_nblocks/P_block/P_block_name, plusP_get_value/P_set_valuefor parameters. The layout is instance state: a recipe instantiated at another size reports that size's offsets, which is why every accessor takes an id.In ExaModels itself:
A name of the wrong kind names the accessor that would work; a typo lists what exists — the blocks share one flat namespace, so both mistakes are easy and want different fixes.
The consumers mirror it exactly (CNLPModels.jl, cnlpmodels, both already on master), so a compiled model is addressed the way an in-Julia one is:
Named blocks are an optional ABI surface: a library that publishes none — a hand-written C library, say — reports empty tuples and is consumed exactly as before.
Parameters: one vocabulary, and a model owns its values
set_parameter!is gone;set_value!is the only spelling, paired withget_value, matching the two-stage methods that already used those names. Core-level methods were the ones missing and are now present.A model copies the core's parameter vector when it is built.
instantiatepasses a placeholder-free container through by identity, so without the copy every model built from one core shared oneθ— setting a parameter on one compiled instance set it on all, and two instances at different sizes would have shared one vector. The suite's assertion that instances are independent is what would catch losing this again.The consequence is deliberate and user-visible: after a model is built, updates go to the model, not the core.
The parameters doc page and the "Modify after build" testset were the two places telling the old story and now tell this one. Calls that precede the build are unchanged, since the copy takes the values as they stand. What this buys: several models from one core, each with its own parameters — and several compiled instances in one library likewise.
Also dropped: the schema's ABI version field. Versioning an interface buys nothing before the packages are registered.
Verification
🤖 Generated with Claude Code