-
Notifications
You must be signed in to change notification settings - Fork 192
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
Change TerminatePhase return value #6335
Open
knelli2
wants to merge
1
commit into
sxs-collaboration:develop
Choose a base branch
from
knelli2:change_terminate_phase
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Distributed under the MIT License. | ||
// See LICENSE.txt for details. | ||
|
||
#pragma once | ||
|
||
#include <optional> | ||
|
||
#include "Parallel/AlgorithmExecution.hpp" | ||
|
||
/// \cond | ||
namespace tuples { | ||
template <typename... InboxTags> | ||
struct TaggedTuple; | ||
} // namespace tuples | ||
namespace Parallel { | ||
template <typename Metavariables> | ||
class GlobalCache; | ||
} // namespace Parallel | ||
/// \endcond | ||
|
||
namespace Parallel::Actions { | ||
|
||
/*! | ||
* \ingroup ActionsGroup | ||
* \brief Pause the algorithm by returning | ||
* `Parallel::AlgorithmExecution::Pause`. | ||
*/ | ||
struct PausePhase { | ||
template <typename DataBox, typename... InboxTags, typename Metavariables, | ||
typename ArrayIndex, typename ActionList, | ||
typename ParallelComponent> | ||
static Parallel::iterable_action_return_t apply( | ||
DataBox& /*box*/, const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, | ||
const Parallel::GlobalCache<Metavariables>& /*cache*/, | ||
const ArrayIndex& /*array_index*/, | ||
// NOLINTNEXTLINE(readability-avoid-const-params-in-decls) | ||
const ActionList /*meta*/, | ||
// NOLINTNEXTLINE(readability-avoid-const-params-in-decls) | ||
const ParallelComponent* const /*meta*/) { | ||
return {Parallel::AlgorithmExecution::Pause, std::nullopt}; | ||
} | ||
}; | ||
|
||
} // namespace Parallel::Actions |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Distributed under the MIT License. | ||
// See LICENSE.txt for details. | ||
|
||
#include "Framework/TestingFramework.hpp" | ||
|
||
#include "Framework/ActionTesting.hpp" | ||
#include "Parallel/Phase.hpp" | ||
#include "ParallelAlgorithms/Actions/PausePhase.hpp" | ||
#include "Utilities/TMPL.hpp" | ||
|
||
namespace { | ||
template <typename Metavariables> | ||
struct Component { | ||
using metavariables = Metavariables; | ||
using chare_type = ActionTesting::MockArrayChare; | ||
using array_index = int; | ||
using phase_dependent_action_list = tmpl::list<Parallel::PhaseActions< | ||
Parallel::Phase::Testing, tmpl::list<Parallel::Actions::PausePhase>>>; | ||
}; | ||
|
||
struct Metavariables { | ||
using component_list = tmpl::list<Component<Metavariables>>; | ||
}; | ||
} // namespace | ||
|
||
SPECTRE_TEST_CASE("Unit.Parallel.Actions.PausePhase", | ||
"[Unit][Parallel][Actions]") { | ||
using component = Component<Metavariables>; | ||
|
||
ActionTesting::MockRuntimeSystem<Metavariables> runner{{}}; | ||
ActionTesting::emplace_component<component>(&runner, 0); | ||
|
||
ActionTesting::set_phase(make_not_null(&runner), Parallel::Phase::Testing); | ||
|
||
CHECK_FALSE(ActionTesting::get_terminate<component>(runner, 0)); | ||
ActionTesting::next_action<component>(make_not_null(&runner), 0); | ||
CHECK(ActionTesting::get_terminate<component>(runner, 0)); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ | |
#include "Parallel/AlgorithmExecution.hpp" | ||
#include "Parallel/Phase.hpp" | ||
#include "Parallel/PhaseDependentActionList.hpp" | ||
#include "ParallelAlgorithms/Actions/PausePhase.hpp" | ||
#include "ParallelAlgorithms/Actions/TerminatePhase.hpp" | ||
#include "Time/Actions/CleanHistory.hpp" | ||
#include "Time/Actions/RecordTimeStepperData.hpp" | ||
#include "Time/Actions/SelfStartActions.hpp" | ||
|
@@ -161,10 +163,15 @@ struct Component { | |
Actions::CleanHistory<typename metavariables::system, false>, | ||
tmpl::conditional_t<has_primitives, Actions::UpdatePrimitives, | ||
tmpl::list<>>>; | ||
using action_list = tmpl::flatten< | ||
tmpl::list<SelfStart::self_start_procedure< | ||
step_actions, typename metavariables::system>, | ||
step_actions>>; | ||
// This test doesn't operate exactly like how SelfStart would normally work in | ||
// an executable. Instead it jumps around quite a lot. Therefore to avoid any | ||
// issues that TerminatePhase would cause, we just replace it with PausePhase. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just remove it. No reason to replace it with a no-op. |
||
using action_list = tmpl::replace< | ||
tmpl::flatten< | ||
tmpl::list<SelfStart::self_start_procedure< | ||
step_actions, typename metavariables::system>, | ||
step_actions>>, | ||
Parallel::Actions::TerminatePhase, Parallel::Actions::PausePhase>; | ||
using phase_dependent_action_list = tmpl::list< | ||
Parallel::PhaseActions<Parallel::Phase::Initialization, | ||
tmpl::list<ActionTesting::InitializeDataBox< | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a ton of unexplained changes like this in this PR. What is going on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 5 actions in the initialization phase for this component. Previously the last one returned
Pause
, so when it calledActionTesting::next_action
one extra time, nothing bad happened. But now that the last action returnsHalt
, calling it an extra time causes an error. So it was a bug previously to call it 6 times. Same for the rest of the changes like this