Commit 84ef4e85 authored by Junchao Zhang's avatar Junchao Zhang
Browse files

Add MPIR_ERRTEST_* macros for MPI_T


Signed-off-by: default avatarAntonio J. Pena <apenya@mcs.anl.gov>
parent 02da81ee
......@@ -500,6 +500,97 @@
} \
}
#ifdef HAVE_ERROR_CHECKING
#define MPIR_ERRTEST_MPIT_INITIALIZED(err_) \
do { \
if (!MPIR_T_is_initialized()) { \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_NOT_INITIALIZED, goto fn_fail, "**mpitinit"); \
} \
} while (0)
#else
#define MPIR_ERRTEST_MPIT_INITIALIZED(err_)
#endif
#define MPIR_ERRTEST_CAT_INDEX(index_,err_) \
do { \
if ((index_) < 0 || (index_) >= utarray_len(cat_table)) \
{ \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**catindex"); \
} \
} while (0)
#define MPIR_ERRTEST_ENUM_HANDLE(handle_, err_) \
do { \
if ((handle_) == MPI_T_ENUM_NULL) \
{ \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**enumhandlenull"); \
} \
else if ((handle_)->kind != MPIR_T_ENUM_HANDLE) \
{ \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**enumhandle"); \
} \
} while (0)
#define MPIR_ERRTEST_ENUM_ITEM(enum_, index_, err_) \
do { \
if ((index_) < 0 || (index_) >= utarray_len((enum_)->items)) \
{ \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_ITEM, goto fn_fail, "**itemindex"); \
} \
} while (0)
#define MPIR_ERRTEST_CVAR_INDEX(index_,err_) \
do { \
if ((index_) < 0 || (index_) >= utarray_len(cvar_table)) \
{ \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**cvarindex"); \
} \
} while (0)
#define MPIR_ERRTEST_CVAR_HANDLE(handle_, err_) \
do { \
if ((handle_) == MPI_T_CVAR_HANDLE_NULL) \
{ \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**cvarhandlenull"); \
} \
else if ((handle_)->kind != MPIR_T_CVAR_HANDLE) \
{ \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**cvarhandle"); \
} \
} while (0)
#define MPIR_ERRTEST_PVAR_INDEX(index_,err_) \
do { \
if ((index_) < 0 || (index_) >= utarray_len(pvar_table)) \
{ \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**pvarindex"); \
} \
} while (0)
#define MPIR_ERRTEST_PVAR_HANDLE(handle_, err_) \
do { \
if (handle_ == MPI_T_PVAR_HANDLE_NULL) \
{ \
MPIU_ERR_SETANDSTMT(err_,MPI_T_ERR_INVALID_HANDLE, goto fn_fail,"**pvarhandlenull"); \
} \
else if ((handle_)->kind != MPIR_T_PVAR_HANDLE) \
{ \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**pvarhandle"); \
} \
} while (0)
#define MPIR_ERRTEST_PVAR_SESSION(session_,err_) \
do { \
if ((session_) == MPI_T_PVAR_SESSION_NULL) \
{ \
MPIU_ERR_SETANDSTMT(err_,MPI_T_ERR_INVALID_SESSION, goto fn_fail,"**pvarsessionnull"); \
} \
else if ((session_)->kind != MPIR_T_PVAR_SESSION) \
{ \
MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_SESSION, goto fn_fail, "**pvarsession"); \
} \
} while (0)
/* some simple memcpy aliasing checks */
#define MPIU_ERR_CHKMEMCPYANDSTMT(err_,stmt_,src_,dst_,len_) \
MPIU_ERR_CHKANDSTMT3(MPIU_MEM_RANGES_OVERLAP((dst_),(len_),(src_),(len_)),err_,MPI_ERR_INTERN,stmt_,"**memcpyalias","**memcpyalias %p %p %L",(src_),(dst_),(long long)(len_))
......
**mpitinit: MPI tool information interface is not initialized
**catindex: Category index is invalid
**enumhandlenull: Enum handle is NULL
**enumhandle: Enum handle is invalid
**itemindex: Enum item index is invalid
**cvarindex: Control variable index is invalid
**cvarhandlenull: Control variable handle is NULL
**cvarhandle: Control variable handle is invalid
**pvarindex: Performance variable index is invalid
**pvarhandlenull: Performance variable handle is NULL
**pvarhandle: Performance variable handle is invalid
**pvarsessionnull: Performance variable session is NULL
**pvarsession: Performance variable session is invalid
**mpi_t_init_thread: MPI_T_init_thread failed
**mpi_t_init_thread %d %p: MPI_T_init_thread(required=%d, provided=%p)
**mpi_t_finalize: MPI_T_finalize failed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment