The CUDA Math API

Now, we will take a look at the CUDA Math API. This is a library that consists of device functions similar to those in the standard C math.h library that can be called from individual threads in a kernel. One difference here is that single and double valued floating-point operations are overloaded, so if we use sin(x) where x is a float, the sin function will yield a 32-bit float as the output, while if x were a 64-bit double, then the output of sin would also be a 64-bit value (Usually, this is the proper name for a 32-bit function, but it has an f at the end, such as sinf). There are also additional instrinsic functions. Intrinsic functions are less accurate but faster math functions that are built into the NVIDIA CUDA hardware; generally, they have similar names to the original function, except that they are preceded with two underscores—therefore, the intrinsic, 32-bit sin function is __sinf.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.100.89