-
Notifications
You must be signed in to change notification settings - Fork 8
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 switches for some functions to compile differently for host vs device #434
Conversation
…or tables on CUDA
Correction, unfortunately this alternate implementation trick does not work for function prototypes. I had to split |
@@ -148,8 +148,13 @@ class EosBase { | |||
|
|||
// Generic evaluator | |||
template <typename Functor_t> | |||
constexpr void Evaluate(Functor_t &f) const { | |||
CRTP copy = *(static_cast<CRTP const *>(this)); | |||
PORTABLE_INLINE_FUNCTION void EvaluateDevice(const Functor_t f) const { |
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 don't recall the exact error, but I recall making this a forwarding reference fixed some issues I had seen. Probably worth trying.
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 can try that.
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.
Actually the current version works, so if you're happy with the split function signature (as discussed below) lets keep it as is. However, if you really dislike the split function signature I can take a look and try games with forwarding references, etc.
So does this mean codes that use evaluate are going to have a bunch of |
I'm not sure I understand what you mean. |
Co-authored-by: Jeff Peterson <[email protected]>
…to jmm/fix-warnings
The tests we expect to pass are all now passing. I'd like to merge this, with a note that we still have a segfault on HIP which needs to be resolved. |
@jhp-lanl @dholladay00 any objections? |
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! My only comment is just to document here for future self that the associated symptom was not a segfault, but rather corrputed data. This should close Issue #393 (which I think is already linked to this PR).
Looks good 👍 |
PR Summary
This MR is motivated by two things:
PORTABLE_INLINE_FUNCTION
markings.Evaluate
method in the base class needs to work on both host and device, but theconstexpr
method did not appear to fully function as desired and we were seeing segfualts with tables in riot.Here we use the macro
to create switches for separate implementations or prototypes depending on whether a function is called on either host or device. This unfortunately breaks the portability layer in
ports-of-call
but I don't see a way to hide#if blah
inside an abstraction layer. So this is what we get.@rbberger at your convenience, please try enabling EOSPAC for the RZadams CI for this MR and see if it kills it. There's a WIP PR on re-git you can use.
@pdmullen plase try to reproduce the segfault in riot that you experienced. Lets see if it still happens.
PR Checklist
make format
command after configuring withcmake
.If preparing for a new release, in addition please check the following:
when='@main'
dependencies are updated to the release version in the package.py