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

Allow timescale tuner to not decrease timescale #5583

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

knelli2
Copy link
Contributor

@knelli2 knelli2 commented Oct 22, 2023

Proposed changes

For size control, the DecreaseFactor of the TimescaleTuner has to be 1.0 because other logic takes care of decreasing the timescale. If it isn't 1.0, the run will crash almost instantly. Therefore, it doesn't really make sense to allow this as an option for size control. This PR templates TimescaleTuner on a bool to AllowDecrease. All other control systems have this bool as true, but size control has it as false.

Upgrade instructions

If your executable has a Size control system, remove the DecreaseThreshold: and DecreaseFactor: options from the TimescaleTuner of the Size control systems. Note that you should keep these options for the SmootherTuner option of Size control.

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments


template <typename T>
struct has_signature_1<
T, std::void_t<decltype(
Copy link
Member

Choose a reason for hiding this comment

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

[optional] This looks very similar to std::is_invocable_r. Might be able to simplify.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That made things a lot cleaner, thanks!

@@ -24,6 +25,11 @@ namespace control_system {
/// their public member names and assigned to their corresponding DataBox tags.
template <typename ControlSystem>
struct OptionHolder {
private:
static constexpr bool is_size =
::control_system::size::is_size_v<ControlSystem>;
Copy link
Member

Choose a reason for hiding this comment

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

[future work] It would be nice to not have everything in the control system infrastructure special-cased on size control. At some point maybe we should have control systems report what features they want with something like ControlSystem::allow_timescale_decrease.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. I'll hopefully put this into the control system protocol eventually, but was a bit too much work at the moment.

const double increase_timescale_threshold, const double increase_factor,
const double decrease_factor)
const double decrease_timescale_threshold, const double decrease_factor)
Copy link
Member

Choose a reason for hiding this comment

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

Do some sort of check that these are reasonable in the no-decrease case. Check decrease_factor == 1.0, at least.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only did the decrease_factor == 1.0 check because I pass limits::max() for the decrease threshold and that's less intuitive of a default.

test_equality_and_serialization();
tmpl::for_each<tmpl::list<std::true_type, std::false_type>>(
[](const auto bool_v) {
constexpr bool AllowDecrease = tmpl::type_from<decltype(bool_v)>::value;
Copy link
Member

Choose a reason for hiding this comment

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

Snake-case.

@knelli2
Copy link
Contributor Author

knelli2 commented Oct 23, 2023

@wthrowe Squashed in the changes

wthrowe
wthrowe previously approved these changes Oct 23, 2023
@wthrowe wthrowe merged commit 525b5c2 into sxs-collaboration:develop Oct 24, 2023
21 of 22 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