Parametric sweep module - #395
Open
bburke38 wants to merge 12 commits into
Open
Conversation
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.
Summary
New
funtofem.sweepsubmodule: a reusable, callback-driven parameter sweep framework that replaces case-specific sweep scripts. Purely additive: everything lives in a new subpackage, and the only change to existing code is the export line infuntofem/__init__.py.Marked experimental: the API may change without a deprecation cycle. Deliberately not re-exported into the top-level
funtofemnamespace. Users must import explicitly:What's in it
SweepStrategyABC withCartesianStrategy(full product) andZipStrategy(element-wise) built in; subclass for LHS/Sobol.MeshModeenum controls which mesh callbacks fire per design point (FULL_REGEN/CFD_ONLY/STRUCT_ONLY/NONE).ParameterSweeporchestrates the lifecycle: point enumeration, per-point directory isolation, mesh regeneration, model/solver construction, forward and adjoint solves, result extraction, and incremental CSV output. Allset_*callbacks validate their signature at registration time and returnselffor chaining.SlurmSweepSubmittergenerates and submits one SLURM job per design point, withdry_runandskip_completedmodes. Jobs re-enter the user's script through the--point-fileCLI path (cli_main→run_single).Robustness
Per-point failures are caught and recorded as
status = "failed"rather than aborting the sweep, and CSV rows are written incrementally so partial results survive an interruption.resume=Trueskips points already recorded as successful.Output layout
Design keys default to a SHA-256 hash of the JSON-serialized point, truncated to
pt_+ 12 hex chars, so key length is independent of parameter count.key_fnoverrides this for readable keys on small sweeps.cfd_rootandstruct_rootshare a<root>/<key>/<kind>template, so with the defaults everything for a design point lands in one directory:Setting them to different roots splits the two trees instead (e.g., for clusters where CFD output belongs on scratch while structural results stay on a backed-up filesystem).
Experimental marking
ParameterSweepandSlurmSweepSubmittercarry a.. warning:: **Experimental.**block at the top of their class docstrings, in the numpydoc slot after the short summary, so Sphinx renders it as a callout and it shows inhelp()and IDE hover.Testing
tests/unit_tests/sweep/— tests across six modules covering point execution, CSV writing, resume logic, the--point-fileCLI, the SLURM submitter, and the per-point output layout. They import the sweep modules directly rather than throughfuntofem, so they run without native TACS or FUN3D.