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

Kokkos reverse mode improvements #1116

Merged
merged 2 commits into from
Oct 16, 2024
Merged

Conversation

gojakuch
Copy link
Collaborator

No description provided.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.37%. Comparing base (183719a) to head (56e4faa).
Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1116   +/-   ##
=======================================
  Coverage   94.37%   94.37%           
=======================================
  Files          50       50           
  Lines        8366     8366           
=======================================
  Hits         7895     7895           
  Misses        471      471           

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@gojakuch gojakuch marked this pull request as draft October 15, 2024 11:43
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@gojakuch gojakuch changed the title Add support for Kokkos::resize in the rvs mode Kokkos reverse mode improvements Oct 15, 2024
@gojakuch gojakuch marked this pull request as ready for review October 15, 2024 12:20
@gojakuch gojakuch requested a review from vgvassilev October 15, 2024 12:20
@vgvassilev
Copy link
Owner

@kliegeois, @brian-kelley can you take a look?

Copy link

@brian-kelley brian-kelley 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 fine to me! My only suggestion is that you could probably get away with hardcoding size_t as the type for all the resize dimensions and their derivatives, since those arguments to Kokkos::resize are always size_t.

@vgvassilev
Copy link
Owner

This looks fine to me! My only suggestion is that you could probably get away with hardcoding size_t as the type for all the resize dimensions and their derivatives, since those arguments to Kokkos::resize are always size_t.

Thanks for the comment. I am confused, are you suggesting reduce the template specializations to one which takes a size_t argument?

@brian-kelley
Copy link

brian-kelley commented Oct 15, 2024

@vgvassilev size_t wouldn't have to be a template argument anymore, but the View being resized still does. So instead of

template <typename View, typename Idx0, typename Idx1, typename Idx2,
          typename Idx3, typename Idx4, typename Idx5, typename Idx6,
          typename Idx7, typename dIdx0, typename dIdx1, typename dIdx2,
          typename dIdx3, typename dIdx4, typename dIdx5, typename dIdx6,
          typename dIdx7> ...

it could just be

template <typename View> ...

@gojakuch
Copy link
Collaborator Author

gojakuch commented Oct 15, 2024

This looks fine to me! My only suggestion is that you could probably get away with hardcoding size_t as the type for all the resize dimensions and their derivatives, since those arguments to Kokkos::resize are always size_t.

I think it's better to keep these as templates, since sometimes Clad generates numerical values of different types depending on the argument and thus may fail to find this custom derivative in some edge cases (such as when using both literal and variable indices of different types as arguments).

@vgvassilev
Copy link
Owner

This looks fine to me! My only suggestion is that you could probably get away with hardcoding size_t as the type for all the resize dimensions and their derivatives, since those arguments to Kokkos::resize are always size_t.

I think it's better to keep these as templates, since sometimes Clad generates numerical values of different types depending on the argument and thus may fail to find this custom derivative in some edge cases (such as when using both literal and variable indices of different types as arguments).

Can we check if that is really limitation? If we can drop all of these template arguments it would be become significantly more readable.

@gojakuch
Copy link
Collaborator Author

I've rebased this PR and managed to reduce the number of lines by having std::size_t arguments in some cases. seems like it's no longer an issue there.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@vgvassilev
Copy link
Owner

@brian-kelley, were these changes what you were aiming for?

@brian-kelley
Copy link

@vgvassilev @gojakuch Yes, that's what I had in mind. Thanks!

@vgvassilev vgvassilev merged commit d82f7fd into vgvassilev:master Oct 16, 2024
90 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.

3 participants