-
Notifications
You must be signed in to change notification settings - Fork 113
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
Error macros now have GPU variant. #4465
Conversation
jenkins build this opm-simulators=5962 please |
1 similar comment
jenkins build this opm-simulators=5962 please |
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 like it. Of course those writing gpu code has to be aware of the interface here as it's not all that obvious how things are tied together. (ie you have to re-check on cpu side), but at least those who are writing cpu code and are unaware they are being exploited by the gpu guys don't have to do anything special. One small request which I think makes things more readable.
jenkins build this opm-simulators=5962 please |
Jenkins build this please |
Just out of curiosity: Does |
Yes, that is correct. You can see this effect in the following Compiler Explorer example that compiles since the #define NDEBUG 1
#include <cassert>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cstdio>
// Type your code here, or load an example.
__global__ void square() {
printf("From the kernel\n");
assert(variable_that_does_not_exist);
}
int main(int, char**) {
square<<<1, 1>>>();
cudaDeviceSynchronize();
} This is a risk, but we are also talking about code that will mostly be run in an inner loop. I can replace it with |
Agreed. You're the expert here, so if you're happy with this trade-off, then I have no objection. |
Now, the current version does not protect against:
I can amend this, though. Adding |
Jenkins build this please |
Can this be merged or does it need any other changes? |
This PR is in principle fine to merge, BUT, we have seen that it does not work as expected on Hipcc, and would like to wait with merging until we have figured out the Hipcc problems |
0bcb0ea
to
2549806
Compare
jenkins build this opm-simulators=5962 please |
1 similar comment
jenkins build this opm-simulators=5962 please |
jenkins build this hipify opm-simulators=5962 please |
This will allow us to keep code such as
also in the GPU kernels. The alternative would be to wrap every such throw-statement in the following manner:
Note that while it is possible to supply the message to assert as well, this is not really practically feasible in all the places the throw macro is used, and it is probably not needed either.
While not necessary for this to build, I have also included unit tests for the updated macros in the opm-simulators PR 5962