-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy patherror.h
66 lines (49 loc) · 2.03 KB
/
error.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef ERROR_H
#define ERROR_H
#include "magma_types.h"
// overloaded C++ functions to deal with errors
void magma_xerror( cudaError_t err, const char* func, const char* file, int line );
void magma_xerror( cublasStatus_t err, const char* func, const char* file, int line );
void magma_xerror( magma_int_t err, const char* func, const char* file, int line );
#ifdef __cplusplus
extern "C" {
#endif
// cuda provides cudaGetErrorString,
// but not cublasGetErrorString, so provide our own.
// In magma.h, we also provide magma_strerror.
const char* magma_cublasGetErrorString( cublasStatus_t error );
#ifdef __cplusplus
}
#endif
#ifdef NDEBUG
#define check_error( err ) ((void)0)
#define check_xerror( err, func, file, line ) ((void)0)
#else
/***************************************************************************//**
Checks if err is not success, and prints an error message.
Similar to assert(), if NDEBUG is defined, this does nothing.
This version adds the current func, file, and line to the error message.
@param[in]
err Error code.
@ingroup magma_error_internal
*******************************************************************************/
#define check_error( err ) \
magma_xerror( err, __func__, __FILE__, __LINE__ )
/***************************************************************************//**
Checks if err is not success, and prints an error message.
Similar to assert(), if NDEBUG is defined, this does nothing.
This version takes func, file, and line as arguments to add to error message.
@param[in]
err Error code.
@param[in]
func Function where error occurred.
@param[in]
file File where error occurred.
@param[in]
line Line where error occurred.
@ingroup magma_error_internal
*******************************************************************************/
#define check_xerror( err, func, file, line ) \
magma_xerror( err, func, file, line )
#endif // not NDEBUG
#endif // #ifndef ERROR_H