Does the CUDA function throw an exception?

Hi all,
Whether there is a CUDA function that throws an C++ exception? such as in NPP and runtion api, also other library. I find my code throw a C++ exception and crashed. Thank you.

No, CUDA runtime API and most CUDA library functions do not throw exceptions.

Thrust functions can throw exceptions. Also, if you use some “add-on” headers/libraries for NPP, some of those may throw exceptions. But the basic NPP functionality as defined in the NPP documentation does not throw exceptions.

1 Like

hi txbob, thank you.
I only use nppi and npps library. By the way, what is “add-on” headers/libraries for NPP. Is it contained in nppi and npps?

No, the “add on” stuff I’m referring to is not accessed by nppi or npps header files. It would be accessed for example via


See here for an example:

Study the compile/link command there to find out where these headers and associated libraries are located on a standard CUDA linux install. Again, these headers/libraries are not documented in NPP, and they are not formally part of NPP. They are “helper” functions provided to make the writing of the various CUDA NPP sample codes easier. Like any sample code, there are no particular guarantees associated with their use, and they are not formally maintained by NVIDIA.