errhandler(错误处理)
<p><strong>errhandler</strong></p>
<p>错误处理</p>
<p><strong>数据类型执行代码</strong>
<a href="https://github.com/qianyongjun895/HPIPS/tree/master/OpenMpi-Chain/ompi/errhandler">https://github.com/qianyongjun895/HPIPS/tree/master/OpenMpi-Chain/ompi/errhandler</a></p>
<p><strong>ompi_errcode_intern_t定义</strong>
struct ompi_errcode_intern_t {</p>
<pre><code>opal_object_t super;
int code;
int mpi_code;
int index;
char errstring[OMPI_MAX_ERROR_STRING];</code></pre>
<p>};
typedef struct ompi_errcode_intern_t ompi_errcode_intern_t</p>
<p><strong>获取错误编号</strong>
static inline int ompi_errcode_get_mpi_code(int errcode)</p>
<p><strong>设置所有错误信息编号</strong>
int ompi_errcode_intern_init(void)</p>
<p><strong>销毁的错误信息</strong>
int ompi_errcode_intern_finalize(void)</p>
<p><strong>ompi_mpi_errcode_t定义</strong>
struct ompi_mpi_errcode_t {</p>
<pre><code>opal_object_t super;
int code;
int cls;
char errstring[MPI_MAX_ERROR_STRING];</code></pre>
<p>};</p>
<p>typedef struct ompi_mpi_errcode_t ompi_mpi_errcode_t;</p>
<p><strong>判断错误信息是不是有效</strong>
static inline bool ompi_mpi_errcode_is_invalid(int errcode)</p>
<p><strong>获取错误信息类型</strong>
static inline int ompi_mpi_errcode_get_class (int errcode)</p>
<p><strong>判断错误信息是不是预定信息</strong>
static inline int ompi_mpi_errcode_is_predefined ( int errcode )</p>
<p><strong>获取错误返回值的类型</strong>
tatic inline int ompi_mpi_errnum_is_class ( int errnum )</p>
<p><strong>打印错误信息的内容</strong>
static inline char* ompi_mpi_errnum_get_string (int errnum)</p>
<p><strong>初始化错误处理</strong>
int ompi_mpi_errcode_finalize(void)</p>
<p><strong>添加一个错误信息</strong>
int ompi_mpi_errcode_add (int errclass)</p>
<p><strong>添加一个错误类型</strong>
int ompi_mpi_errclass_add (void)</p>
<p><strong>添加一个错误提示内容</strong>
int ompi_mpi_errnum_add_string (int errnum, const char* string, int len)</p>
<p><strong>所有的函数的提示内容</strong>
typedef void (ompi_errhandler_fortran_handler_fn_t)(MPI_Fint <em>, MPI_Fint </em>, ...)</p>
<p><strong>通用的函数错误提示</strong>
typedef void (ompi_errhandler_generic_handler_fn_t)(void <em>, int </em>, ...)</p>
<p><strong>枚举来表示错误处理程序创建的语言</strong>
enum ompi_errhandler_lang_t {</p>
<pre><code>OMPI_ERRHANDLER_LANG_C,
OMPI_ERRHANDLER_LANG_CXX,
OMPI_ERRHANDLER_LANG_FORTRAN</code></pre>
<p>};
typedef enum ompi_errhandler_lang_t ompi_errhandler_lang_t</p>
<p><strong>用于描述错误处理程序的类型的 MPI 对象的枚举</strong>
enum ompi_errhandler_type_t {</p>
<pre><code>OMPI_ERRHANDLER_TYPE_PREDEFINED,
OMPI_ERRHANDLER_TYPE_COMM,
OMPI_ERRHANDLER_TYPE_WIN,
OMPI_ERRHANDLER_TYPE_FILE</code></pre>
<p>};</p>
<p>typedef enum ompi_errhandler_type_t ompi_errhandler_type_t</p>
<p><strong>c++ 调用函数签名</strong>
typedef void (ompi_errhandler_cxx_dispatch_fn_t)(void <em>handle, int </em>err_code,const char <em>message, ompi_errhandler_generic_handler_fn_t </em>fn)</p>
<p><strong>MPI_Errorhandler 的后端类型</strong>
struct ompi_errhandler_t {</p>
<pre><code>opal_object_t super;
char eh_name[MPI_MAX_OBJECT_NAME];
/* 此处理程序所针对的 MPI 对象的类型 */
ompi_errhandler_type_t eh_mpi_object_type;
/* 中创建的错误处理程序的语言 */
ompi_errhandler_lang_t eh_lang;
/*函数指针。 请注意, 我们 * 有 * 为所有4种类型 (例如, 联合), 因为可以在任何 MPI 对象类型上调用预定义的 errhandlers, 因此我们需要对所有三的回调。 */
MPI_Comm_errhandler_function *eh_comm_fn;
ompi_file_errhandler_fn *eh_file_fn;
MPI_Win_errhandler_function *eh_win_fn;
ompi_errhandler_fortran_handler_fn_t *eh_fort_fn;
/*对 c++ errhandlers 有单独的回调。 此指针被初始化为 NULL, 并将由 Create_errhandler 的 c++ 绑定显式设置。 此函数在 eh_lang = = OMPI_ERRHANDLER_LANG_CXX 时调用, 以便可以使用正确的语言语义调用用户的回调函数 */
ompi_errhandler_cxx_dispatch_fn_t *eh_cxx_dispatch_fn;
/* 在 Fortran 中的索引 &lt;-&gt; C 转换数组*/
int eh_f_to_c_index;</code></pre>
<p>};</p>
<p>typedef struct ompi_errhandler_t ompi_errhandler_t</p>
<p><strong>ompi_predefined_errhandler_t定义</strong>
struct ompi_predefined_errhandler_t {</p>
<pre><code>struct ompi_errhandler_t eh;
char padding[PREDEFINED_ERRHANDLER_PAD - sizeof(ompi_errhandler_t)];</code></pre>
<p>}
typedef struct ompi_predefined_errhandler_t ompi_predefined_errhandler_t;</p>
<p><strong>初始化错误处理程序接口</strong>
int ompi_errhandler_init(void)</p>
<p><strong>完成错误处理程序接口</strong>
int ompi_errhandler_finalize(void)</p>
<p><strong>不应直接调用此函数。它只应由 OMPI_ERRHANDLER_INVOKE ()、OMPI_ERRHANDLER_CHECK () 或OMPI_ERRHANDLER_RETURN ()</strong>
OMPI_DECLSPEC int ompi_errhandler_invoke(ompi_errhandler_t <em>errhandler, void </em>mpi_object,int type, int err_code, const char *message)</p>
<p><strong>请求调用错误处理程序</strong>
int ompi_errhandler_request_invoke(int count,struct ompi_request_t *<em>requests,const char </em>message)</p>
<p><strong>创建一个ompi_errhandler_t</strong>
OMPI_DECLSPEC ompi_errhandler_t <em>ompi_errhandler_create(ompi_errhandler_type_t object_type, ompi_errhandler_generic_handler_fn_t </em>func, ompi_errhandler_lang_t language)</p>
<p><strong>ompi_errhandler_errtrk_t定义</strong>
typedef struct {</p>
<pre><code>volatile bool active;
int status;</code></pre>
<p>} ompi_errhandler_errtrk_t</p>
<p><strong>回调错误信息函数</strong>
OMPI_DECLSPEC void ompi_errhandler_callback(int status,const opal_process_name_t <em>source, opal_list_t </em>info, opal_list_t <em>results, opal_pmix_notification_complete_fn_t cbfunc,void </em>cbdata)</p>
<p><strong>回调注册错误信息函数</strong>
OMPI_DECLSPEC void ompi_errhandler_registration_callback(int status,
size_t errhandler_ref,void *cbdata)</p>
<p><strong>获取错误信息的内容</strong>
static inline bool ompi_errhandler_is_intrinsic(ompi_errhandler_t *errhandler)</p>
<p><strong>MPI_ERRORS_ARE_FATAL 的处理函数</strong>
<strong>致命的通信错误处理程序</strong>
OMPI_DECLSPEC void ompi_mpi_errors_are_fatal_comm_handler(struct ompi_communicator_t *<em>comm,int </em>error_code, ...)</p>
<p><strong>致命的文件错误处理程序</strong>
OMPI_DECLSPEC void ompi_mpi_errors_are_fatal_file_handler(struct ompi_file_t *<em>file,int </em>error_code, ...)</p>
<p><strong>致命的系统错误处理程序</strong>
OMPI_DECLSPEC void ompi_mpi_errors_are_fatal_win_handler(struct ompi_win_t *<em>win,int </em>error_code, ...)</p>
<p><strong>MPI_ERRORS_RETURN的处理函数</strong>
<strong>通讯返回的错误信息</strong>
OMPI_DECLSPEC void ompi_mpi_errors_return_comm_handler(struct ompi_communicator_t *<em>comm,int </em>error_code, ...)</p>
<p><strong>文件返回的错误信息</strong>
OMPI_DECLSPEC void ompi_mpi_errors_return_file_handler(struct ompi_file_t *<em>file,int </em>error_code, ...)</p>
<p><strong>系统返回的错误信息</strong>
OMPI_DECLSPEC void ompi_mpi_errors_return_win_handler(struct ompi_win_t *<em>win,int </em>error_code, ...)</p>