Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Unused Parameter Warnings #223

Merged
merged 14 commits into from
Sep 28, 2022

Conversation

n01r
Copy link
Member

@n01r n01r commented Aug 29, 2022

Adds warnings about unused parameters like in WarpX as requested in #120

  • Can you please check if amrex.abort_on_unused_inputs = 1 works already as well?
  • This one needs to be documented in both WarpX and AMReX docs, please.
  • We need to please document warpx.abort_on_warning_threshold (or equivalent) in ImpactX.
  • implemented it like in WarpX but it does not abort, yet, when I do some warning logger testing as described in the WarpX docs
  • move impl to separate .cpp file
  • add Python control
  • add docs for Python control
  • [ ] add Python tests for unused inputs and for warning in tests/python/test_impactx.py skipped for follow-up since more testing is needed

@n01r n01r requested a review from ax3l August 29, 2022 23:32
@n01r n01r added this to the Beta Release Version milestone Aug 29, 2022
@ax3l ax3l self-assigned this Aug 30, 2022
@ax3l ax3l added the enhancement New feature or request label Aug 30, 2022
@ax3l
Copy link
Member

ax3l commented Aug 30, 2022

Thanks!

  • Can you please check if amrex.abort_on_unused_inputs = 1 works already as well?
  • This one needs to be documented in both WarpX and AMReX docs, please.
  • We need to please document warpx.abort_on_warning_threshold (or equivalent) in ImpactX.

src/ImpactX.cpp Outdated Show resolved Hide resolved
@n01r
Copy link
Member Author

n01r commented Aug 31, 2022

Setting amrex.abort_on_unused_inputs = 1 and having an unused input does not abort the sim, yet.

It works, but it aborts after the sim runs through which first confused me.

@ax3l
Copy link
Member

ax3l commented Sep 2, 2022

Thanks, please don't forget adding user-facing docs.

@n01r
Copy link
Member Author

n01r commented Sep 2, 2022

We need to please document warpx.abort_on_warning_threshold (or equivalent) in ImpactX.

I think this additional implementation of these options and maybe it justifies creating a function ImpactX::ReadParameters like the existing one in WarpX.

@ax3l
Copy link
Member

ax3l commented Sep 6, 2022

The nice thing about amrex::ParmParse is, that you can read parameters anywhere. For which current collection of parameters do you suggest grouping in a ReadParameters?

Please let me know when these items are ready (#223 (comment)) and this can be merged :) I moved them as to-do's in the PR description.

@n01r
Copy link
Member Author

n01r commented Sep 7, 2022

The nice thing about amrex::ParmParse is, that you can read parameters anywhere. For which current collection of parameters do you suggest grouping in a ReadParameters?

Why not sort all? In WarpX it seems they are all grouped into a ReadParameters function and every group has its own context like:

    {
        ParmParse pp_<context>("< context >");
        pp_<context>.query("name-of-some-option")
    }

Please let me know when these items are ready (#223 (comment)) and this can be merged :) I moved them as to-do's in the PR description.

  • Can you please check if amrex.abort_on_unused_inputs = 1 works already as well?

this works already and user-facing docs have been added :)

  • This one needs to be documented in both WarpX and AMReX docs, please.
  • We need to please document warpx.abort_on_warning_threshold (or equivalent) in ImpactX.
  • implemented it like in WarpX but it does not abort, yet, when I do some warning logger testing as described in the WarpX docs

src/ImpactX.cpp Outdated Show resolved Hide resolved
src/ImpactX.cpp Outdated Show resolved Hide resolved
src/ImpactX.cpp Outdated Show resolved Hide resolved
src/ImpactX.cpp Outdated Show resolved Hide resolved
src/ImpactX.cpp Outdated Show resolved Hide resolved
@ax3l ax3l force-pushed the topic-addUnusedParameterWarnings branch 2 times, most recently from 73f4bf8 to 129312e Compare September 20, 2022 23:34
@ax3l
Copy link
Member

ax3l commented Sep 21, 2022

In WarpX it seems they are all grouped into a ReadParameters function ...

Minutes for what we discussed: We need no static member variables for states because we store our options directly in amrex::ParmParse. This also keeps us in sync which options take precedence for control from the Python side. Querying ParmParse is fast and can be done in-place instead of at the init stage only.

src/ImpactX.H Outdated Show resolved Hide resolved
src/ImpactX.cpp Outdated Show resolved Hide resolved
src/ImpactX.cpp Outdated Show resolved Hide resolved
@@ -181,6 +181,35 @@ void init_ImpactX(py::module& m)
"The minimum number of digits (default: 6) used for the step\n"
"number appended to the diagnostic file names."
)
.def("set_abort_on_warning_threshold",
Copy link
Member

Choose a reason for hiding this comment

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

Please add tests for this functionality as noted in the PR description

Copy link
Member Author

Choose a reason for hiding this comment

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

update: skipping Python tests for this PR as discussed this morning and doing them in a follow-up

src/python/ImpactX.cpp Outdated Show resolved Hide resolved
add docs for:
  - abort_on_warning_threshold
  - abort_on_unused_inputs
  - always_warn_immediately
src/ImpactX.cpp Outdated Show resolved Hide resolved
src/ImpactX.H Outdated Show resolved Hide resolved
src/ImpactX.cpp Outdated Show resolved Hide resolved
src/initialization/Warnings.cpp Outdated Show resolved Hide resolved
src/initialization/Warnings.cpp Show resolved Hide resolved
src/initialization/Warnings.cpp Show resolved Hide resolved
src/initialization/Warnings.cpp Outdated Show resolved Hide resolved
Thanks for the suggestions!

Co-authored-by: Axel Huebl <[email protected]>
src/ImpactX.H Outdated Show resolved Hide resolved
@ax3l ax3l merged commit 0529161 into ECP-WarpX:development Sep 28, 2022
@n01r n01r deleted the topic-addUnusedParameterWarnings branch September 28, 2022 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants