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

Use Kokkos::abort() where necessary. #17018

Merged
merged 2 commits into from
May 16, 2024
Merged

Conversation

bangerth
Copy link
Member

@masterleinad I must admit that I don't know the intricacies of what is or isn't available in Kokkos for specific versions. Does this seem right to address your comment that we can't call straight std::abort() in our assertion machinery?

If so, this fixes #16553.

@bangerth bangerth added this to the Release 9.6 milestone May 14, 2024
Copy link
Member

@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.

You should be able to just call Kokkos::abort without distinguishing between host and device execution if you were only calling a plain std::abort before. We only have that separation in the Assert macro since we want to pass through more information that is not device-compatible.

@bangerth
Copy link
Member Author

Even better, of course!

@luca-heltai
Copy link
Member

I think you need to add a (""):

/__w/dealii/dealii/source/base/exceptions.cc:519:20: error: too few arguments to function ‘void Kokkos::abort(const char*)’
  519 |       Kokkos::abort();
      |       ~~~~~~~~~~~~~^~
In file included from /__w/dealii/dealii/bundled/kokkos-3.7.00/core/src/Kokkos_Core_fwd.hpp:57,
                 from /__w/dealii/dealii/bundled/kokkos-3.7.00/core/src/Kokkos_Core.hpp:55,
                 from /__w/dealii/dealii/include/deal.II/base/exceptions.h:25,
                 from /__w/dealii/dealii/source/base/exceptions.cc:15:
/__w/dealii/dealii/bundled/kokkos-3.7.00/core/src/impl/Kokkos_Error.hpp:230:56: note: declared here
  230 | KOKKOS_IMPL_ABORT_NORETURN KOKKOS_INLINE_FUNCTION void abort(
      |                                                        ^~~~~
/__w/dealii/dealii/source/base/exceptions.cc:520:5: error: ‘noreturn’ function does return [-Werror]
  520 |     }

@masterleinad
Copy link
Member

I think you need to add a (""):

Yes, you need to provide an error string.

@bangerth
Copy link
Member Author

Yes, I noticed too yesterday. I didn't see it because I merged @masterleinad suggestion on the web site, rather than making the change locally and compiling. I will get to fix this later today.

@bangerth
Copy link
Member Author

OK, works now!

@tjhei
Copy link
Member

tjhei commented May 16, 2024

I think it would make sense to leave a comment about the necessity to use the Kokkos version on device code but that it is equivalent to std::abort otherwise.

Co-authored-by: Daniel Arndt <arndtd@ornl.gov>
@bangerth
Copy link
Member Author

I added the comment.

@masterleinad masterleinad merged commit bb3c1cb into dealii:master May 16, 2024
15 of 16 checks passed
@bangerth bangerth deleted the kokkos-abort branch May 16, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Kokkos::abort() in DEAL_II_NOT_IMPLEMENTED().
4 participants