Skip to content

detect model-section input mistakes (issue #300 bugs #2 & #3)#363

Merged
PDoakORNL merged 3 commits into
CompFUSE:masterfrom
tylersax:issue-300-2
Jun 5, 2026
Merged

detect model-section input mistakes (issue #300 bugs #2 & #3)#363
PDoakORNL merged 3 commits into
CompFUSE:masterfrom
tylersax:issue-300-2

Conversation

@tylersax

@tylersax tylersax commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

A DCA++ executable is compiled for one model and reads one "*-model" section. Previously a typo'd or missing model section was silently ignored: ModelParameters::readWrite swallows the missing-group exception and the run proceeds on default model parameters.

Detect this at parse time, while the parsed tree is still live:

  • Instrument the JSON reader to track which top-level groups were read. JSONObject gains a mutable accessed_ flag (set on successful getGroup); JSONGroup::childGroupAccess() / JSONReader:: topLevelGroupAccess() report {name, accessed} as ChildGroupStatus. getGroup also switched from operator[] to find(), so a lookup miss no longer inserts a null entry.
  • Add checkModelSections (model_section_check.hpp), a standalone helper invoked from readInput for the JSON path. It reacts to three cases:
    • typo / wrong file (model section present, none read) -> throw std::invalid_argument;
    • multi-model file (built model read, others present) -> warn; - no model section at all -> warn, so model-agnostic uses of Parameters keep working.

The check is compile-time guarded to JSONReader, since the HDF5 reader does not implement a model-section input guard (justified, since HDF5 input is, presumably, machine-generated.

Tests: reader-level access tracking in json_reader_test, and unit coverage of all checkModelSections branches in a new model_section_check_test.

… & CompFUSE#3)

A DCA++ executable is compiled for one model and reads one "*-model"
section. Previously a typo'd or missing model section was silently
ignored: ModelParameters::readWrite swallows the missing-group exception
and the run proceeds on default model parameters.

Detect this at parse time, while the parsed tree is still live:
  * Instrument the JSON reader to track which top-level groups were
    read.
    JSONObject gains a mutable accessed_ flag (set on successful
    getGroup); JSONGroup::childGroupAccess() / JSONReader::
    topLevelGroupAccess() report {name, accessed} as ChildGroupStatus.
    getGroup also switched from operator[] to find(), so a lookup miss
    no
    longer inserts a null entry.
  * Add checkModelSections (model_section_check.hpp), a standalone
    helper
    invoked from readInput for the JSON path. It reacts to three cases:
      - typo / wrong file (model section present, none read) -> throw
        std::invalid_argument;
      - multi-model file (built model read, others present) -> warn;
      - no model section at all -> warn, so model-agnostic uses of
        Parameters keep working.

The check is compile-time guarded to JSONReader, since the HDF5
reader does not implement a model-section input guard (justified,
since HDF5 input is, presumably, machine-generated.

Tests: reader-level access tracking in json_reader_test, and unit
coverage of all checkModelSections branches in a new
model_section_check_test.
@tylersax tylersax marked this pull request as ready for review June 3, 2026 16:23
PDoakORNL
PDoakORNL previously approved these changes Jun 4, 2026

@PDoakORNL PDoakORNL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is real improvement of the behavior wrt model sections in the input.

@tylersax

tylersax commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

ACK the partial CI failure. I'll dig in see what's going on, then report back here.

@PDoakORNL

Copy link
Copy Markdown
Contributor

It looks like the a couple of gpu tests have outlier input files, you may be able to figure it out without being able to build CUDA or it may be easier to get you onto the section CI/development machine tomorrow.

@tylersax

tylersax commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Based on a quick look, I think this is a simple fix. The input validation is working exactly as intended: it's throwing because the input file for this GPU test does not contain a model section for the model it's building an executable against (and is therefore silently falling back to default params, which is the thing we don't want.)

So I think the clear answer is we need to update those test fixtures to explicitly include the model section, bringing them up to par with the newly introduced input validation scheme. I'll write that up tomorrow and see if it passes. (I'll also try the CUDA build on my GPU box to see if I can repro on my own, that would be handy)

The model-section validation added for issue CompFUSE#300 throws when an input
contains *-model sections but none matches the executable's own model.
The shared GPU tp-accumulator fixtures input_4x4_complex.json and
input_4x4_2_transfer.json carry a section per consuming model, but the
Rashba and FeAs builds silently relied on default model parameters and
had no section of their own, so the new check failed them in SetUp().

Add the missing sections with values equal to the model defaults so the
executables read their own section (warn on the others) and the computed
results are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@PDoakORNL PDoakORNL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM the tests breaking our rules for model sections have been fixed. More may appear in the extensive tests but there are other failures to address there so I'd consider it out of scope for this PR.

@PDoakORNL PDoakORNL merged commit e8161fc into CompFUSE:master Jun 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants