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

Adding OpenMPTarget parallel_scan #3655

Merged
merged 2 commits into from
Dec 18, 2020
Merged

Adding OpenMPTarget parallel_scan #3655

merged 2 commits into from
Dec 18, 2020

Conversation

crtrott
Copy link
Member

@crtrott crtrott commented Dec 6, 2020

No description provided.

@crtrott
Copy link
Member Author

crtrott commented Dec 6, 2020

Ignore all the removed code in OpenMP_Parallel.hpp that was just dead (commented) code before.

typename std::enable_if< std::is_same< TagType , void >::value >::type
exec_range( const FunctorType & functor
, const Member ibeg , const Member iend
, reference_type update , const bool final )
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: all the removed code is irrelevant. That was dead (commented code) from the original CPU OpenMP backend).

@@ -465,6 +466,51 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>,
//----------------------------------------
};

template <class FunctorType, class ReturnType, class... Traits>
Copy link
Member Author

Choose a reason for hiding this comment

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

I hope you guys are proud how I avoided duplicated code :-)

Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

This looks good but you forgot work tags. Obviously we are not testing for it... I think we would have caught that if we enabled the sorting unit test in algotithm

#pragma omp for
for (int i = 0; i < chunk_size; i++) {
int64_t idx = local_offset + i;
if (idx < N) a_functor(idx, element_values(team_id, i), false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't idx be of type Policy::index_type?

Copy link
Member Author

Choose a reason for hiding this comment

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

added that

if (omp_get_thread_num() == 0) {
value_type sum = 0;
for (int i = 0; i < chunk_size; i++) {
sum += element_values(team_id, i);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why isn't this ValueJoin::join?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I am doing that.

value_type sum = 0;
for (int i = 0; i < chunk_size; i++) {
sum += element_values(team_id, i);
element_values(team_id, i) = sum;
Copy link
Contributor

Choose a reason for hiding this comment

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

ValueOps::copy?

Copy link
Member Author

Choose a reason for hiding this comment

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

we don't support array type scans so I think its not needed.

@crtrott
Copy link
Member Author

crtrott commented Dec 11, 2020

Added WorkTag too.

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 reasonable to me.

@crtrott crtrott merged commit 9612c31 into kokkos:develop Dec 18, 2020
@crtrott crtrott deleted the ompt-scan branch December 18, 2020 17:18
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.

None yet

3 participants