wondering wondering - 1 year ago 186
C++ Question

Is there a CUDA equivalent to std::numeric_limits?

I would like to determine the maximum

value in a CUDA kernel. Unfortunately I can't find anything similar to
for CUDA. Trying to use the
function results in a error:

error : calling a __host__ function("std::numeric_limits<int> ::max") from a __global__ function("xyz_kernel") is not allowed C:\cuda.cu(153) (col. 10)

Is there a way to determine the desired value from withing a kernel, or should I just pass it as a parameter?

Answer Source

It exists but it is not as generic as std::numeric_limits. See this page for the list.

For example, you can have NPP_MAX_32U but this is specific to 32-bit unsigned rather than to the int type, whose width is system-dependent.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download