I see in the CUDA Math API documentation that there are functions for single and double precision min/max operations (e.g. fminf()
). I assume these are highly optimized, etc. There don't seem to be functions like these for integers. Is this true? Is there a reason for that?
There are min/max device functions for integers, but they are all called with an overloaded max()
. Look in device_functions.hpp:
__DEVICE_FUNCTIONS_STATIC_DECL__ int max(int x, int y)
{
return __nv_max(x, y);
}
__DEVICE_FUNCTIONS_STATIC_DECL__ unsigned int umax(unsigned int x, unsigned int y)
{
return __nv_umax(x, y);
}
__DEVICE_FUNCTIONS_STATIC_DECL__ long long llmax(long long x, long long y)
{
return __nv_llmax(x, y);
}
__DEVICE_FUNCTIONS_STATIC_DECL__ unsigned long long ullmax(unsigned long long x,
unsigned long long y)
{
return __nv_ullmax(x, y);
}
They're not listed in the Integer Intinsics section because in math_functions.hpp the max
function is overloaded to call these functions for you. The __nv*
functions are documented in device_function_decls.hpp.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With