Skip to content

Reorganize and clarify exception handling (try-catch) in qmcapp.cpp - #6362

Merged
prckent merged 4 commits into
QMCPACK:developfrom
ye-luo:reorg-catch
Oct 27, 2026
Merged

prckent merged 4 commits into
QMCPACK:developfrom
ye-luo:reorg-catch

Conversation

@ye-luo

@ye-luo ye-luo commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

Reorganize and clarify exception handling (try-catch) in qmcapp.cpp for both global scope and per-ensemble calculation scopes.

Changes

  • Redundancy & Deadlock Fix in qmcapp.cpp:
    • Removed the redundant inner try-catch around command-line parsing and rank verification.
    • Wrapped qmc->parse() and qmc->execute() in a dedicated try-catch (const UniformCommunicateError& ue) that aborts on the group communicator qmcComm rather than the global controller.
    • Removed unused variable validInput.
  • Contextual Error Messages:
    • In qmcComm catch handler: prepended input file name and, when running ensemble jobs, the ensemble job index (qmcComm.getGroupID()).
    • In global UniformCommunicateError catch handler: prepended "Global parallel scope: " to distinguish setup/partitioning failures from calculation failures.
    • In catch (const std::exception& e) and catch (...): removed raw std::cerr usage, incorporated e.what() directly into APP_ABORT, and prepended global rank ID (OHMMS::Controller->rank()).

What type(s) of changes does this code introduce?

  • Bugfix
  • New feature

Does this introduce a breaking change?

  • No

What systems has this change been tested on?

laptop

Checklist

    • I have read the pull request guidance and develop docs
    • This PR is up to date with the current state of 'develop'
    • Code added or changed in the PR has been clang-formatted
    • This PR adds tests to cover any new code, or to catch a bug that is being fixed
    • Documentation has been added (if appropriate)

@github-actions github-actions Bot added the c/c++ label Oct 27, 2026
@ye-luo ye-luo changed the title Reorganize and clarify exception handling (try-catch) in Reorganize and clarify exception handling (try-catch) in qmcapp.cpp Oct 27, 2026
@ye-luo

ye-luo commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Test this please

@prckent prckent 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

I would like to see us achieve full coverage of the top level qmcapp.cpp features.

@prckent
prckent enabled auto-merge October 27, 2026 17:42
@prckent
prckent merged commit f1b3c57 into QMCPACK:develop Oct 27, 2026
56 of 57 checks passed
@ye-luo
ye-luo deleted the reorg-catch branch October 28, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants