-
Notifications
You must be signed in to change notification settings - Fork 53
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
Common math function support? #9
Comments
This could indeed be useful. Please see the discussion on #6 though. Portability is very important here, so a good design is important. I welcome pull requests. Thanks! |
I'm a bit torn on whether to look at this from the CUDA side or the host. I suspect it would be easier to use the math function names. This way, the functionality is clear (especially w/r/t rounding). Going the other way (from functions in to API is more natural to program in, but there's a pile of very specific functions with different rounding behaviors. Right now, I've got everything as templated inline functions. Interesting side effect is that when the compiler is evaluating what template to use when the result of ?: is being passed to a function, the output is a bit weird when the types differ slightly (like a signed/unsigned int). It's fixable via typecasting, though. On a related note, is there a preference as to a framework to use for writing testcases for some of these additions to Hemi? |
See #10 for a pull request for this. |
I would probably use google test, BTW (haven't looked at pull request yet). |
Is it desirable in general to have a short math header that contains common functions from and are supported on the device? Maybe templated to allow for selection of the fast functions on CUDA? I've noticed that the compiler can get confused and go for a template of something from cmath where instead you'd want to promote an int to a double and use the device function instead.
I use std::pow() and std::abs() in my own device code, so it's useful for me. Something like being able to call hemi::pow(x,y) and get reasonable results on both the host and device?
The text was updated successfully, but these errors were encountered: