-
Notifications
You must be signed in to change notification settings - Fork 122
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 basic Kokkos support for the original tests of #783 #977
Conversation
The exact way this has been implemented in this PR is a subject for a discussion. I'm specifically talking about the way I put all the pushforwards in this file in the unittest directory. I also removed the initial tests I'd written in favour of the original ones from the PR #783 that basically cover the same things. |
@vgvassilev as far as I can see, clang-format and some other checks are failing because there's no valid OpenPGP data being found, so it's probably not the PR's fault. |
clang-tidy review says "All clean, LGTM! 👍" |
@gojakuch It couldn't resolve the url ( |
@MihailMihov thanks, I'll do that a bit later. |
35000d0
to
9244e85
Compare
e0d814e
to
dfd46aa
Compare
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.
clang-tidy made some suggestions
@vgvassilev the failing check I have right now in this PR is the most important Kokkos one and yet I cannot replicate it on my machine. it works out fine for me. what shall I do in this situation? |
Debug on the bots? |
how do I do that? |
https://clad.readthedocs.io/en/latest/user/DevelopersDocumentation.html#debugging-github-runners |
79d9de3
to
3c08112
Compare
@vgvassilev so basically I've managed to debug and fix this on the GitHub runner, but only by modifying a line of code in Clad's main code base. the change is quite small and honestly seems reasonable to me, but that's still something I'd like to discuss during today's meeting. I'm pushing it here for now to have all the checks passing, but maybe it'd be better to have it as a separate commit. |
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.
I think this is heading in a good direction.
@kliegeois, @brian-kelley can you take a look?
// pullbacks. Please include it manually to use Clad on Kokkos code. | ||
|
||
#ifndef CLAD_KOKKOS_BUILTINS_H | ||
#define CLAD_KOKKOS_BUILTINS_H |
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.
That's a good suggestion.
#ifndef CLAD_KOKKOS_BUILTINS_H | ||
#define CLAD_KOKKOS_BUILTINS_H | ||
|
||
#include <Kokkos_Core.hpp> |
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.
Maybe wrap this in _has_include
?
@@ -1198,7 +1198,7 @@ StmtDiff BaseForwardModeVisitor::VisitCallExpr(const CallExpr* CE) { | |||
// If all arguments are constant literals, then this does not contribute to | |||
// the gradient. | |||
// FIXME: revert this when this is integrated in the activity analysis pass. | |||
if (!callDiff) { | |||
if (!callDiff && !CE->getType().getTypePtr()->isVoidType()) { |
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.
We should move this as a separate PR with an appropriate test.
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.
Thanks @gojakuch it looks good to me!
@gojakuch It also looks good to me, I just suggest using variadic template arguments to simplify the |
7260cd0
to
d154949
Compare
@vgvassilev the |
d154949
to
2443ebc
Compare
@@ -0,0 +1,55 @@ | |||
// This header file contains the implementation of the Kokkos framework | |||
// differentiation support in Clad in the form of custom pushforwards and | |||
// pullbacks. Please include it manually to use Clad on Kokkos code. |
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.
// pullbacks. Please include it manually to use Clad on Kokkos code. | |
// pullbacks. Please include it manually to enable Clad for Kokkos code. |
#define CLAD_KOKKOS_BUILTINS_H | ||
|
||
#include <Kokkos_Core.hpp> | ||
#include "clad/Differentiator/Differentiator.h" |
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.
We can ignore that suggestion.
namespace Kokkos { | ||
template <typename View1, typename View2, typename T> | ||
inline void deep_copy_pushforward(const View1& dst, const View2& src, T param, | ||
const View1& _d_dst, const View2& _d_src, |
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.
These suggestions are relevant. The _
identifiers are normally reserved for special builtins and we are not doing anything special here.
This commit adds a test from the original Kokkos PR vgvassilev#783 and provides the implementation of the simplest Kokkos features in the form of custom pushforwards. This commit only addresses the forward mode.
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.
LGTM!
Thanks a lot for having merged the PR @vgvassilev and @gojakuch ! |
This commit adds a test from the original Kokkos PR #783 and provides the implementation of the simplest Kokkos features in the form of custom pushforwards. This commit only addresses the forward mode.