File indexing completed on 2025-01-18 10:13:51
0001 #ifndef VECCORE_ASSERT_H
0002 #define VECCORE_ASSERT_H
0003
0004 #if !defined(__NVCC__)
0005 #include <cassert>
0006 #else
0007
0008
0009
0010
0011
0012
0013
0014 #ifdef assert
0015 #undef assert
0016 #endif
0017
0018 #ifdef NDEBUG
0019 #define assert(x)
0020 #else
0021
0022 #include <cstdio>
0023
0024 #ifndef __CUDA_ARCH__
0025 #define assert(x) \
0026 do { \
0027 if (!(x)) { \
0028 fprintf(stderr, "%s:%d: Assertion failed: '%s'\n", __FILE__, __LINE__, #x); \
0029 abort(); \
0030 } \
0031 } while (0)
0032 #else
0033 #define assert(x) \
0034 do { \
0035 if (!(x)) { \
0036 printf("%s:%d:\n%s: Assertion failed: '%s'\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, #x); \
0037 __syncthreads(); \
0038 asm("trap;"); \
0039 } \
0040 } while (0)
0041 #endif
0042
0043 #endif
0044
0045 #endif
0046
0047 #endif