10 #ifndef EIGEN_CORE_UTIL_ASSERT_H
11 #define EIGEN_CORE_UTIL_ASSERT_H
30 #if !defined(EIGEN_NO_DEBUG) && (!defined(EIGEN_GPU_COMPILE_PHASE) || !defined(EIGEN_NO_DEBUG_GPU))
34 #ifndef EIGEN_USE_CUSTOM_PLAIN_ASSERT
36 #define EIGEN_USE_CUSTOM_PLAIN_ASSERT 0
39 #if EIGEN_USE_CUSTOM_PLAIN_ASSERT
41 #ifndef EIGEN_HAS_BUILTIN_FILE
48 #if (EIGEN_HAS_BUILTIN(__builtin_FILE) && (EIGEN_COMP_CLANG || !defined(EIGEN_CUDA_ARCH))) || \
49 (EIGEN_GNUC_STRICT_AT_LEAST(5, 0, 0) && (EIGEN_COMP_NVCC >= 110000 || !defined(EIGEN_CUDA_ARCH))) || \
50 (EIGEN_COMP_MSVC >= 1926 && (!EIGEN_COMP_NVCC || EIGEN_COMP_NVCC >= 110000))
51 #define EIGEN_HAS_BUILTIN_FILE 1
53 #define EIGEN_HAS_BUILTIN_FILE 0
57 #if EIGEN_HAS_BUILTIN_FILE
58 #define EIGEN_BUILTIN_FILE __builtin_FILE()
59 #define EIGEN_BUILTIN_LINE __builtin_LINE()
62 #define EIGEN_BUILTIN_FILE __FILE__
63 #define EIGEN_BUILTIN_LINE __LINE__
71 #define EIGEN_BUILTIN_FUNCTION __FUNCSIG__
73 #define EIGEN_BUILTIN_FUNCTION __PRETTY_FUNCTION__
75 #define EIGEN_BUILTIN_FUNCTION __func__
82 template <
typename EnableIf = void,
typename... EmptyArgs>
83 struct assert_handler_impl {
85 const char*
function) {
86 #ifdef EIGEN_GPU_COMPILE_PHASE
90 printf(
"Assertion failed at %s:%u in %s: %s\n", file ==
nullptr ?
"<file>" : file,
line,
91 function ==
nullptr ?
"<function>" :
function, expression);
99 fprintf(stderr,
"Assertion failed at %s:%u in %s: %s\n", file ==
nullptr ?
"<file>" : file,
line,
100 function ==
nullptr ?
"<function>" :
function, expression);
116 template <
typename... EmptyArgs>
117 struct assert_handler_impl<
void_t<decltype(__assert_fail((const
char*)
nullptr,
118 (
const char*)
nullptr,
120 (
const char*)
nullptr,
121 std::declval<EmptyArgs>()...
126 const char*
function) {
128 __assert_fail(expression, file,
line,
function, std::declval<EmptyArgs>()...);
133 unsigned line,
const char*
function) {
140 #define eigen_plain_assert(expression) \
141 (EIGEN_PREDICT_FALSE(!(expression)) ? Eigen::internal::__assert_handler(#expression, EIGEN_BUILTIN_FILE, \
142 EIGEN_BUILTIN_LINE, EIGEN_BUILTIN_FUNCTION) \
148 #define eigen_plain_assert(condition) assert(condition)
154 #define eigen_plain_assert(condition) ((void)0)
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_DONT_INLINE
Definition: Macros.h:853
void void_t
Definition: Meta.h:228
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
auto run(Kernel kernel, Args &&... args) -> decltype(kernel(args...))
Definition: gpu_test_helper.h:414
line
Definition: calibrate.py:103
Definition: Eigen_Colamd.h:49
void run(const string &dir_name, LinearSolver *linear_solver_pt, const unsigned nel_1d, bool mess_up_order)
Definition: two_d_poisson_compare_solvers.cc:317