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

#5385 Add necessary fence() calls in sorting routines that were missing them #5389

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

PhilMiller
Copy link
Contributor

@PhilMiller PhilMiller commented Aug 25, 2022

Sorting routines that don't take an execution space parameter need to globally fence before calling any kernels on a default-constructed execution space instance, to ensure that input data is stable.

Fixes #5385

@PhilMiller
Copy link
Contributor Author

This is based on #5388, so that should be merged first

@PhilMiller PhilMiller linked an issue Aug 25, 2022 that may be closed by this pull request
@PhilMiller PhilMiller added this to In Review in Developer: Phil Miller Aug 25, 2022
@masterleinad masterleinad marked this pull request as draft August 29, 2022 18:02
@PhilMiller PhilMiller marked this pull request as ready for review August 30, 2022 19:22
Copy link
Contributor

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@PhilMiller
Copy link
Contributor Author

The preceding PR was merged, so this is good to review now.

typename ViewType::execution_space exec;
sort(exec, view);
exec.fence("Kokkos::Sort: fence after sorting");
exec.fence("Kokkos::sort: fence after sorting");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
exec.fence("Kokkos::sort: fence after sorting");
exec.fence("Kokkos::sort: after");

@@ -638,6 +649,7 @@ std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort(

template <class ViewType>
void sort(ViewType view, size_t const begin, size_t const end) {
Kokkos::fence("Kokkos::sort: before");
typename ViewType::execution_space exec;
sort(exec, view, begin, end);
exec.fence("Kokkos::Sort: fence after sorting");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
exec.fence("Kokkos::Sort: fence after sorting");
exec.fence("Kokkos::sort: after");

@crtrott crtrott merged commit 34bda9e into kokkos:develop Aug 31, 2022
Developer: Phil Miller automation moved this from In Review to Pending release 4.0 Aug 31, 2022
@PhilMiller PhilMiller deleted the 5385-develop-sort-fence branch August 31, 2022 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Developer: Phil Miller
Done in release 4.0
Development

Successfully merging this pull request may close these issues.

Synchronization of sort(View) with exec space argument
4 participants