Using assert within kernel invocation
问题 Is there convenient way for using asserts within the kernels invocation on device mode? Thanks, in advance. 回答1: CUDA now has a native assert function. Use assert(...) . If its argument is zero, it will stop kernel execution and return an error. (or trigger a breakpoint if in CUDA debugging.) Make sure to include "assert.h". Also, this requires compute capability 2.x or higher, and is not supported on MacOS. For more details see CUDA C Programming Guide, Section B.16. The programming guide