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::parallel_for in the fwd mode #1022

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

gojakuch
Copy link
Collaborator

@gojakuch gojakuch commented Aug 2, 2024

No description provided.

@gojakuch gojakuch marked this pull request as draft August 2, 2024 21:28
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

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.12%. Comparing base (cfea783) to head (50d2baf).
Report is 4 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1022   +/-   ##
=======================================
  Coverage   94.12%   94.12%           
=======================================
  Files          55       55           
  Lines        8275     8275           
=======================================
  Hits         7789     7789           
  Misses        486      486           

@gojakuch gojakuch marked this pull request as ready for review August 3, 2024 19:40
@gojakuch gojakuch force-pushed the kokkos-support branch 3 times, most recently from f5dd53a to e4febde Compare August 4, 2024 18:47
@gojakuch gojakuch force-pushed the kokkos-support branch 2 times, most recently from fd3c361 to 9b61df6 Compare August 10, 2024 14:44
@gojakuch
Copy link
Collaborator Author

@vgvassilev I've finally managed to fix the failing check. can we merge this?

@vgvassilev
Copy link
Owner

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

@gojakuch
Copy link
Collaborator Author

if we merge #1038 before this, I think it'd make sense to update the tests in this PR accordingly


Foo<Kokkos::View<double[5], Kokkos::HostSpace>> f(res, x);

f(0);
Copy link
Owner

Choose a reason for hiding this comment

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

Can we add a fixme note to track this being a workaround for a bug in clad?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@kliegeois
Copy link

@vgvassilev I will try to review this PR by the end of the week.

@kliegeois
Copy link

Does it work with the generate-source-file option?
I tried briefly locally and got a bunch of warnings and/or errors.

@gojakuch
Copy link
Collaborator Author

gojakuch commented Aug 16, 2024

Does it work with the generate-source-file option? I tried briefly locally and got a bunch of warnings and/or errors.

I haven't tried that. could you give some clues on what exactly you ran?

upd: I get it now, I'll take a look

@kliegeois
Copy link

Thanks @gojakuch ! I was going to reply today but that's great that you have been able to reproduce it as well.
I am wondering if we should have some sort of unit tests that verify that generate-source-file works with Kokkos based code and that the generated files are as expected.
What do you think @vgvassilev ?

@vgvassilev
Copy link
Owner

Thanks @gojakuch ! I was going to reply today but that's great that you have been able to reproduce it as well. I am wondering if we should have some sort of unit tests that verify that generate-source-file works with Kokkos based code and that the generated files are as expected. What do you think @vgvassilev ?

Yes, we should. It's on my todo list but still have not got time to work on it. Basically the idea is to enhance the unittest infrastructure to use the infrastructure to generate a file and then use it as part of the compilation. That should be possible with cmake but will need some time to implement.

@kliegeois
Copy link

@vgvassilev what you suggested sounds good to me but something simpler could work as well. Another project on which I worked (Binder) has tests that takes as input a source code (such as https://github.com/RosettaCommons/binder/blob/master/test/T00.basic.hpp) and then generates the output and compares it to a reference code (such as https://github.com/RosettaCommons/binder/blob/master/test/T00.basic.ref.cpp). If there is a mismatch between the generated code and the reference code, it throws an error. Something like that could be done for Clad. The downside would be that the reference file need to be updated for every new modifications that actually modified the output of previously supported features. However, I like the fact that this approach explicitly tell you what the output should look like.

@gojakuch
Copy link
Collaborator Author

gojakuch commented Aug 19, 2024

Thanks @gojakuch ! I was going to reply today but that's great that you have been able to reproduce it as well. I am wondering if we should have some sort of unit tests that verify that generate-source-file works with Kokkos based code and that the generated files are as expected. What do you think @vgvassilev ?

@kliegeois well, that's the thing. I understand what you ran but it works out fine on my machine (at least while generating). it produces code without warnings, however the produced code is not compilable on its own, but that's a problem of Clang, as far as I'm aware. it's just that some types are not output to text correctly when resolving template definitions. so I'm not sure it's fixable on the Clad's side. at least that's the only thing happening on my machine from what I can see. correct me if you meant smth else.

@gojakuch
Copy link
Collaborator Author

the last forced push was just me rebasing the PR

@gojakuch
Copy link
Collaborator Author

Thanks @gojakuch ! I was going to reply today but that's great that you have been able to reproduce it as well. I am wondering if we should have some sort of unit tests that verify that generate-source-file works with Kokkos based code and that the generated files are as expected. What do you think @vgvassilev ?

@kliegeois well, that's the thing. I understand what you ran but it works out fine on my machine (at least while generating). it produces code without warnings, however the produced code is not compilable on its own, but that's a problem of Clang...

@kliegeois an update: after a quick chat with Vassil earlier today, I'm now convinced that it's fixable on our side. but that falls out of the scope of this PR, so I'll open a separate issue for this and fix it in a separate PR. do you have any suggestions apart from that? if not, I think we can merge this and move on, while I'm working on a fix for that

@kliegeois
Copy link

@gojakuch sure, that sounds good to me, thanks!

@vgvassilev vgvassilev merged commit b7f8e5d 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