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

Add support for Kokkos::fence in the fwd mode #1048

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

gojakuch
Copy link
Collaborator

@gojakuch gojakuch commented Aug 20, 2024

Although this function doesn't need to be differentiated and is correctly used by Clad automatically, this custom pushforward prevents Clad from throwing a warning during that.

P.S. this PR has been developed on top of #1022 and should be merged after that. I just don't want to slow down the review of #1022 any longer by adding new commits to it.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@@ -6,6 +6,7 @@
#define CLAD_DIFFERENTIATOR_KOKKOSBUILTINS_H

#include <Kokkos_Core.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'Kokkos_Core.hpp' file not found [clang-diagnostic-error]

#include <Kokkos_Core.hpp>
         ^

Copy link
Owner

Choose a reason for hiding this comment

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

We should probably install Kokkos as part of our clang-tidy CI dependencies...

return;
/// Fence
template <typename S> void fence_pushforward(const S& s, const S& /*d_s*/) {
::Kokkos::fence(s);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 's' is not initialized [cppcoreguidelines-init-variables]

Suggested change
::Kokkos::fence(s);
::Kokkos::fence(s = 0);

Copy link
Owner

Choose a reason for hiding this comment

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

That seems broken, probably because my previous comment on kokkos and our CI.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, I saw this, I don't think it's a valid suggestion either :)

Choose a reason for hiding this comment

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

Note, this is fine for forward mode but for the reverse mode we probably want d_s for the argument of the fence call to be able to identify the fences from the forward passes vs the fences of the reverse passes.

Copy link

codecov bot commented Aug 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.28%. Comparing base (66b6af4) to head (d00360e).
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1048   +/-   ##
=======================================
  Coverage   94.28%   94.28%           
=======================================
  Files          55       55           
  Lines        8293     8293           
=======================================
  Hits         7819     7819           
  Misses        474      474           

@vgvassilev
Copy link
Owner

@gojakuch, could you rebase this PR?

@kliegeois, can you take a look?

@gojakuch gojakuch force-pushed the kokkos-support-2 branch 4 times, most recently from 3b0acb4 to 6473e60 Compare August 21, 2024 15:52
Although this function doesn't need to be differentiated and
is correctly used by Clad automatically, this custom pushforward
prevents Clad from throwing a warning during that.
Copy link
Owner

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

Lgtm! Thank you @gojakuch and @kliegeois!

@vgvassilev vgvassilev merged commit 397e3b0 into vgvassilev:master Aug 21, 2024
89 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