Custom assert - how to implement?


I want to create a custom MY_ASSERT macro that is not dependent on NDEBUG to have more control over it.

Therefore I cannot call the built-in assert macro that works for both host and device (since it depends on NDEBUG, even with different printouts and behavior).

For regular C++ code I’d implement it like:

void assert_impl(...)

However I cannot call std::abort in CUDA code.

How can I solve this then? One option is to call __assert_fail but the Standard says it’s undefined behavior to call reserved identifiers (e.g. starting with double underscore).