GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
error.h File Reference

Types, functions and macros for error handling. More...

#include <string.h>
#include "log.h"
#include "errorhandler.h"
Include dependency graph for error.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ZOLTAN_OK   0
 
#define GHOST_CALL_RETURN(call)
 This macro should be used for calling a GHOST function inside a function which itself returns a ghost_error. It calls the function and in case of an error logs the error message and returns the according ghost_error which was return by the called function. More...
 
#define GHOST_CALL_GOTO(call, label, __err)
 This macro should be used for calling a GHOST function inside a function which itself returns a ghost_error but needs to do some clean up before returning.. It calls the function. In case of an error it logs the error message, sets the parameter __err to the occured ghost_error and jumps (goto) to the defined parameter label. More...
 
#define GHOST_CALL(call, __err)
 This macro should be used for calling a GHOST function inside another function. The parameter __err will be set to the error which occured in the call. This macro is probably not very useful by itself, cf. GHOST_CALL_GOTO and GHOST_CALL_RETURN instead. More...
 
#define MPI_CALL_RETURN(call)
 
#define MPI_CALL_GOTO(call, label, __err)
 
#define MPI_CALL(call, __err)
 
#define HWLOC_CALL_RETURN(call)
 
#define HWLOC_CALL_GOTO(call, label, __err)
 
#define HWLOC_CALL(call, __err)
 
#define CUDA_CALL_RETURN(call)
 
#define CUDA_CALL_GOTO(call, label, __err)
 
#define CUDA_CALL(call, __err)
 
#define CUBLAS_CALL_RETURN(call)
 
#define CUBLAS_CALL_GOTO(call, label, __err)
 
#define CUBLAS_CALL(call, __err)
 
#define CURAND_CALL_RETURN(call)
 
#define CURAND_CALL_GOTO(call, label, __err)
 
#define CURAND_CALL(call, __err)
 
#define CUSPARSE_CALL_RETURN(call)
 
#define CUSPARSE_CALL_GOTO(call, label, __err)
 
#define CUSPARSE_CALL(call, __err)
 
#define SCOTCH_CALL_RETURN(call)
 
#define SCOTCH_CALL_GOTO(call, label, __err)
 
#define SCOTCH_CALL(call, __err)
 
#define COLPACK_CALL_RETURN(call)
 
#define COLPACK_CALL_GOTO(call, label, __err)
 
#define COLPACK_CALL(call, __err)
 
#define ZOLTAN_CALL_RETURN(call)
 
#define ZOLTAN_CALL_GOTO(call, label, __err)
 
#define ZOLTAN_CALL(call, __err)
 
#define BLAS_CALL_RETURN(call)
 
#define BLAS_CALL_GOTO(call, label, __err)
 
#define BLAS_CALL(call, __err)
 

Enumerations

enum  ghost_error {
  GHOST_SUCCESS, GHOST_ERR_INVALID_ARG, GHOST_ERR_MPI, GHOST_ERR_CUDA,
  GHOST_ERR_CUBLAS, GHOST_ERR_CUSPARSE, GHOST_ERR_CURAND, GHOST_ERR_HWLOC,
  GHOST_ERR_SCOTCH, GHOST_ERR_ZOLTAN, GHOST_ERR_UNKNOWN, GHOST_ERR_NOT_IMPLEMENTED,
  GHOST_ERR_IO, GHOST_ERR_DATATYPE, GHOST_ERR_COLPACK, GHOST_ERR_BLOCKCOLOR,
  GHOST_ERR_NOT_COLORED, GHOST_ERR_RED_BLACK, GHOST_ERR_LAPACK, GHOST_ERR_BLAS,
  GHOST_ERR_COMPATIBILITY
}
 Error return type. More...
 

Functions

char * ghost_error_string (ghost_error e)
 Get a string of the GHOST error. More...
 

Detailed Description

Types, functions and macros for error handling.

Author
Moritz Kreutzer morit.nosp@m.z.kr.nosp@m.eutze.nosp@m.r@fa.nosp@m.u.de

Macro Definition Documentation

#define BLAS_CALL (   call,
  __err 
)
Value:
{\
call;\
int err = ghost_blas_err_pop();\
if (err) {\
GHOST_ERROR_LOG("BLAS Error: %d",err);\
if (h) {\
h((void *)&err);\
}\
__err = GHOST_ERR_BLAS;\
} else {\
__err = GHOST_SUCCESS;\
}\
}\
#define GHOST_ERROR_LOG(...)
Definition: log.h:125
No error occured.
Definition: error.h:27
An error in a BLAS call occured.
Definition: error.h:103
int ghost_blas_err_pop()
Definition: blas_util.c:26
void *(* ghost_errorhandler)(void *error)
Definition: errorhandler.h:11
ghost_errorhandler ghost_errorhandler_get(ghost_error e)
Get the handler of a given GHOST error.
Definition: errorhandler.cpp:9
#define BLAS_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
BLAS_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
#define BLAS_CALL(call, __err)
Definition: error.h:472
No error occured.
Definition: error.h:27
#define BLAS_CALL_RETURN (   call)
Value:
{\
BLAS_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
#define BLAS_CALL(call, __err)
Definition: error.h:472
No error occured.
Definition: error.h:27
ghost_error
Error return type.
Definition: error.h:23
#define COLPACK_CALL (   call,
  __err 
)
Value:
{\
int err = call;\
if (err != _TRUE) {\
GHOST_ERROR_LOG("ColPack Error: %d",err);\
if (h) {\
h((void *)&err);\
}\
} else {\
__err = GHOST_SUCCESS;\
}\
}\
#define GHOST_ERROR_LOG(...)
Definition: log.h:125
No error occured.
Definition: error.h:27
An error in a ColPack call occured.
Definition: error.h:83
void *(* ghost_errorhandler)(void *error)
Definition: errorhandler.h:11
ghost_errorhandler ghost_errorhandler_get(ghost_error e)
Get the handler of a given GHOST error.
Definition: errorhandler.cpp:9
#define COLPACK_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
COLPACK_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
No error occured.
Definition: error.h:27
#define COLPACK_CALL(call, __err)
Definition: error.h:414
#define COLPACK_CALL_RETURN (   call)
Value:
{\
COLPACK_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
No error occured.
Definition: error.h:27
#define COLPACK_CALL(call, __err)
Definition: error.h:414
ghost_error
Error return type.
Definition: error.h:23
#define CUBLAS_CALL (   call,
  __err 
)
#define CUBLAS_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
CUBLAS_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
No error occured.
Definition: error.h:27
#define CUBLAS_CALL(call, __err)
Definition: error.h:267
#define CUBLAS_CALL_RETURN (   call)
Value:
{\
CUBLAS_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
No error occured.
Definition: error.h:27
ghost_error
Error return type.
Definition: error.h:23
#define CUBLAS_CALL(call, __err)
Definition: error.h:267
#define CUDA_CALL (   call,
  __err 
)
Value:
{\
cudaError_t __cuerr = call;\
if (__cuerr != cudaSuccess) {\
GHOST_ERROR_LOG("CUDA Error: %s (%d)",cudaGetErrorString(__cuerr),(int)__cuerr);\
if (h) {\
h((void *)&__cuerr);\
}\
__err = GHOST_ERR_CUDA;\
} else {\
__err = GHOST_SUCCESS;\
}\
}\
#define GHOST_ERROR_LOG(...)
Definition: log.h:125
No error occured.
Definition: error.h:27
void *(* ghost_errorhandler)(void *error)
Definition: errorhandler.h:11
An error in a CUDA call occured.
Definition: error.h:39
ghost_errorhandler ghost_errorhandler_get(ghost_error e)
Get the handler of a given GHOST error.
Definition: errorhandler.cpp:9
#define CUDA_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
CUDA_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
#define CUDA_CALL(call, __err)
Definition: error.h:238
No error occured.
Definition: error.h:27
#define CUDA_CALL_RETURN (   call)
Value:
{\
CUDA_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
#define CUDA_CALL(call, __err)
Definition: error.h:238
No error occured.
Definition: error.h:27
ghost_error
Error return type.
Definition: error.h:23
#define CURAND_CALL (   call,
  __err 
)
Value:
{\
curandStatus_t err = call;\
if (err != CURAND_STATUS_SUCCESS) {\
GHOST_ERROR_LOG("CURAND Error: %d",(int)err);\
if (h) {\
h((void *)&err);\
}\
__err = GHOST_ERR_CURAND;\
} else {\
__err = GHOST_SUCCESS;\
}\
}\
#define GHOST_ERROR_LOG(...)
Definition: log.h:125
No error occured.
Definition: error.h:27
An error in a CURAND call occured.
Definition: error.h:51
void *(* ghost_errorhandler)(void *error)
Definition: errorhandler.h:11
ghost_errorhandler ghost_errorhandler_get(ghost_error e)
Get the handler of a given GHOST error.
Definition: errorhandler.cpp:9
#define CURAND_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
CURAND_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
#define CURAND_CALL(call, __err)
Definition: error.h:327
No error occured.
Definition: error.h:27
#define CURAND_CALL_RETURN (   call)
Value:
{\
CURAND_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
#define CURAND_CALL(call, __err)
Definition: error.h:327
No error occured.
Definition: error.h:27
ghost_error
Error return type.
Definition: error.h:23
#define CUSPARSE_CALL (   call,
  __err 
)
Value:
{\
cusparseStatus_t err = call;\
if (err != CUSPARSE_STATUS_SUCCESS) {\
GHOST_ERROR_LOG("CUSPARSE Error: %d",(int)err);\
if (h) {\
h((void *)&err);\
}\
} else {\
__err = GHOST_SUCCESS;\
}\
}\
#define GHOST_ERROR_LOG(...)
Definition: log.h:125
No error occured.
Definition: error.h:27
An error in a CUSPARSE call occured.
Definition: error.h:47
void *(* ghost_errorhandler)(void *error)
Definition: errorhandler.h:11
ghost_errorhandler ghost_errorhandler_get(ghost_error e)
Get the handler of a given GHOST error.
Definition: errorhandler.cpp:9
#define CUSPARSE_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
CUSPARSE_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
No error occured.
Definition: error.h:27
#define CUSPARSE_CALL(call, __err)
Definition: error.h:356
#define CUSPARSE_CALL_RETURN (   call)
Value:
{\
CUSPARSE_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
No error occured.
Definition: error.h:27
ghost_error
Error return type.
Definition: error.h:23
#define CUSPARSE_CALL(call, __err)
Definition: error.h:356
#define GHOST_CALL (   call,
  __err 
)
Value:
{\
__err = call;\
if (__err != GHOST_SUCCESS) {\
}\
}\
No error occured.
Definition: error.h:27
#define GHOST_ANSI_COLOR_RED
Definition: log.h:27
#define GHOST_LOG(type, color,...)
Definition: log.h:105
ghost_error
Error return type.
Definition: error.h:23
char * ghost_error_string(ghost_error e)
Get a string of the GHOST error.
Definition: error.c:4

This macro should be used for calling a GHOST function inside another function. The parameter __err will be set to the error which occured in the call. This macro is probably not very useful by itself, cf. GHOST_CALL_GOTO and GHOST_CALL_RETURN instead.

Parameters
callThe function call.
__errA defined ghost_error variable which will be set to the error returned by the calling function.
#define GHOST_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
GHOST_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
No error occured.
Definition: error.h:27
#define GHOST_CALL(call, __err)
This macro should be used for calling a GHOST function inside another function. The parameter __err w...
Definition: error.h:155

This macro should be used for calling a GHOST function inside a function which itself returns a ghost_error but needs to do some clean up before returning.. It calls the function. In case of an error it logs the error message, sets the parameter __err to the occured ghost_error and jumps (goto) to the defined parameter label.

Parameters
callThe function call.
labelThe jump label where clean up is performed.
__errA defined ghost_error variable which will be set to the error returned by the calling function.
#define GHOST_CALL_RETURN (   call)
Value:
{\
GHOST_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
No error occured.
Definition: error.h:27
#define GHOST_CALL(call, __err)
This macro should be used for calling a GHOST function inside another function. The parameter __err w...
Definition: error.h:155
ghost_error
Error return type.
Definition: error.h:23

This macro should be used for calling a GHOST function inside a function which itself returns a ghost_error. It calls the function and in case of an error logs the error message and returns the according ghost_error which was return by the called function.

Parameters
callThe complete function call.
Returns
A ghost_error in case the function return an error.
#define HWLOC_CALL (   call,
  __err 
)
Value:
{\
int __hwlocerr = call;\
if (__hwlocerr) {\
GHOST_ERROR_LOG("HWLOC Error: %d",__hwlocerr);\
if (h) {\
h((void *)&__hwlocerr);\
}\
__err = GHOST_ERR_HWLOC;\
} else {\
__err = GHOST_SUCCESS;\
}\
}\
#define GHOST_ERROR_LOG(...)
Definition: log.h:125
No error occured.
Definition: error.h:27
An error in a Hwloc call occured.
Definition: error.h:55
void *(* ghost_errorhandler)(void *error)
Definition: errorhandler.h:11
ghost_errorhandler ghost_errorhandler_get(ghost_error e)
Get the handler of a given GHOST error.
Definition: errorhandler.cpp:9
#define HWLOC_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
HWLOC_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
No error occured.
Definition: error.h:27
#define HWLOC_CALL(call, __err)
Definition: error.h:209
#define HWLOC_CALL_RETURN (   call)
Value:
{\
HWLOC_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
No error occured.
Definition: error.h:27
ghost_error
Error return type.
Definition: error.h:23
#define HWLOC_CALL(call, __err)
Definition: error.h:209
#define MPI_CALL (   call,
  __err 
)
Value:
{\
int mpicallmacroerr = call;\
if (mpicallmacroerr != MPI_SUCCESS) {\
char errstr[MPI_MAX_ERROR_STRING];\
int strlen;\
MPI_Error_string(mpicallmacroerr,errstr,&strlen);\
GHOST_ERROR_LOG("MPI Error: %s",errstr);\
if (h) {\
h((void *)&mpicallmacroerr);\
}\
__err = GHOST_ERR_MPI;\
} else {\
__err = GHOST_SUCCESS;\
}\
}\
#define GHOST_ERROR_LOG(...)
Definition: log.h:125
No error occured.
Definition: error.h:27
An error in an MPI call occured.
Definition: error.h:35
void *(* ghost_errorhandler)(void *error)
Definition: errorhandler.h:11
ghost_errorhandler ghost_errorhandler_get(ghost_error e)
Get the handler of a given GHOST error.
Definition: errorhandler.cpp:9
#define MPI_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
MPI_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
No error occured.
Definition: error.h:27
#define MPI_CALL(call, __err)
Definition: error.h:177
#define MPI_CALL_RETURN (   call)
Value:
{\
MPI_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
No error occured.
Definition: error.h:27
#define MPI_CALL(call, __err)
Definition: error.h:177
ghost_error
Error return type.
Definition: error.h:23
#define SCOTCH_CALL (   call,
  __err 
)
Value:
{\
int err = call;\
if (err) {\
GHOST_ERROR_LOG("SCOTCH Error: %d",err);\
if (h) {\
h((void *)&err);\
}\
__err = GHOST_ERR_SCOTCH;\
} else {\
__err = GHOST_SUCCESS;\
}\
}\
#define GHOST_ERROR_LOG(...)
Definition: log.h:125
No error occured.
Definition: error.h:27
void *(* ghost_errorhandler)(void *error)
Definition: errorhandler.h:11
ghost_errorhandler ghost_errorhandler_get(ghost_error e)
Get the handler of a given GHOST error.
Definition: errorhandler.cpp:9
An error in a SCOTCH call occured.
Definition: error.h:59
#define SCOTCH_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
SCOTCH_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
No error occured.
Definition: error.h:27
#define SCOTCH_CALL(call, __err)
Definition: error.h:385
#define SCOTCH_CALL_RETURN (   call)
Value:
{\
SCOTCH_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
No error occured.
Definition: error.h:27
ghost_error
Error return type.
Definition: error.h:23
#define SCOTCH_CALL(call, __err)
Definition: error.h:385
#define ZOLTAN_CALL (   call,
  __err 
)
Value:
{\
int err = call;\
if (err != ZOLTAN_OK) {\
GHOST_ERROR_LOG("Zoltan Error: %d",err);\
if (h) {\
h((void *)&err);\
}\
__err = GHOST_ERR_ZOLTAN;\
} else {\
__err = GHOST_SUCCESS;\
}\
}\
#define GHOST_ERROR_LOG(...)
Definition: log.h:125
No error occured.
Definition: error.h:27
An error in a Zoltan call occured.
Definition: error.h:63
void *(* ghost_errorhandler)(void *error)
Definition: errorhandler.h:11
ghost_errorhandler ghost_errorhandler_get(ghost_error e)
Get the handler of a given GHOST error.
Definition: errorhandler.cpp:9
#define ZOLTAN_OK
Definition: error.h:17
#define ZOLTAN_CALL_GOTO (   call,
  label,
  __err 
)
Value:
{\
ZOLTAN_CALL(call,__err);\
if (__err != GHOST_SUCCESS) {\
goto label;\
}\
}\
No error occured.
Definition: error.h:27
#define ZOLTAN_CALL(call, __err)
Definition: error.h:443
#define ZOLTAN_CALL_RETURN (   call)
Value:
{\
ZOLTAN_CALL(call,macroerr);\
if (macroerr != GHOST_SUCCESS) {\
return macroerr;\
}\
}\
No error occured.
Definition: error.h:27
ghost_error
Error return type.
Definition: error.h:23
#define ZOLTAN_CALL(call, __err)
Definition: error.h:443
#define ZOLTAN_OK   0

Enumeration Type Documentation

Error return type.

Enumerator
GHOST_SUCCESS 

No error occured.

GHOST_ERR_INVALID_ARG 

One or more of the arguments are invalid.

GHOST_ERR_MPI 

An error in an MPI call occured.

GHOST_ERR_CUDA 

An error in a CUDA call occured.

GHOST_ERR_CUBLAS 

An error in a CUBLAS call occured.

GHOST_ERR_CUSPARSE 

An error in a CUSPARSE call occured.

GHOST_ERR_CURAND 

An error in a CURAND call occured.

GHOST_ERR_HWLOC 

An error in a Hwloc call occured.

GHOST_ERR_SCOTCH 

An error in a SCOTCH call occured.

GHOST_ERR_ZOLTAN 

An error in a Zoltan call occured.

GHOST_ERR_UNKNOWN 

An unknown error occured.

GHOST_ERR_NOT_IMPLEMENTED 

The function is not (yet) implemented.

GHOST_ERR_IO 

An error during I/O occured.

GHOST_ERR_DATATYPE 

An error with datatypes occured.

GHOST_ERR_COLPACK 

An error in a ColPack call occured.

GHOST_ERR_BLOCKCOLOR 

An error in Block coloring occured.

GHOST_ERR_NOT_COLORED 

ERROR if the matrix is not colored.

GHOST_ERR_RED_BLACK 

An error in Red-Black splitting occured.

GHOST_ERR_LAPACK 

An error in a LAPACK call occured.

GHOST_ERR_BLAS 

An error in a BLAS call occured.

GHOST_ERR_COMPATIBILITY 

brief Incompatibly permuted sparsemat and/or densemat.