openmpi  3.1.6
About: Open MPI is a high performance Message Passing Interface (MPI) library project combining technologies and resources from several other projects (FT-MPI, LA-MPI, LAM/MPI, and PACX-MPI) in order to build the best MPI library available. 3.x series.
  Fossies Dox: openmpi-3.1.6.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

errhandler.h
Go to the documentation of this file.
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4  * University Research and Technology
5  * Corporation. All rights reserved.
6  * Copyright (c) 2004-2011 The University of Tennessee and The University
7  * of Tennessee Research Foundation. All rights
8  * reserved.
9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10  * University of Stuttgart. All rights reserved.
11  * Copyright (c) 2004-2005 The Regents of the University of California.
12  * All rights reserved.
13  * Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved
14  * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
15  * Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
16  * Copyright (c) 2016 Los Alamos National Security, LLC. All rights
17  * reserved.
18  * Copyright (c) 2016 Research Organization for Information Science
19  * and Technology (RIST). All rights reserved.
20  * $COPYRIGHT$
21  *
22  * Additional copyrights may follow
23  *
24  * $HEADER$
25  */
28 #ifndef OMPI_ERRHANDLER_H
29 #define OMPI_ERRHANDLER_H
30 
31 #include "ompi_config.h"
32 
33 #include "mpi.h"
34 
35 #include "opal/prefetch.h"
36 #include "opal/class/opal_object.h"
38 #include "opal/mca/pmix/pmix.h"
39 
43 
45 
46 /*
47  * These must correspond to the fortran handle indices
48  */
49 enum {
53 };
54 
55 
60  MPI_Fint *, ...);
61 
65 typedef void (ompi_errhandler_generic_handler_fn_t)(void *, int *, ...);
66 
74 };
76 
77 
86 };
88 
89 
90 /*
91  * Need to forward declare this for use in ompi_errhandle_cxx_dispatch_fn_t.
92  */
93 struct ompi_errhandler_t;
94 
98 typedef void (ompi_errhandler_cxx_dispatch_fn_t)(void *handle, int *err_code,
99  const char *message, ompi_errhandler_generic_handler_fn_t *fn);
100 
106 
107  char eh_name[MPI_MAX_OBJECT_NAME];
108  /* Type of MPI object that this handler is for */
109 
111 
112  /* What language was the error handler created in */
114 
115  /* Function pointers. Note that we *have* to have all 4 types
116  (vs., for example, a union) because the predefined errhandlers
117  can be invoked on any MPI object type, so we need callbacks for
118  all of three. */
119  MPI_Comm_errhandler_function *eh_comm_fn;
120  ompi_file_errhandler_fn *eh_file_fn;
121  MPI_Win_errhandler_function *eh_win_fn;
123 
124  /* Have separate callback for C++ errhandlers. This pointer is
125  initialized to NULL and will be set explicitly by the C++
126  bindings for Create_errhandler. This function is invoked
127  when eh_lang==OMPI_ERRHANDLER_LANG_CXX so that the user's
128  callback function can be invoked with the right language
129  semantics. */
131 
132  /* index in Fortran <-> C translation array */
134 };
135 typedef struct ompi_errhandler_t ompi_errhandler_t;
136 
142 #define PREDEFINED_ERRHANDLER_PAD 1024
143 
145  struct ompi_errhandler_t eh;
147 };
148 
150 
151 
157 
163 
169 
175 
180 
181 
186 struct ompi_request_t;
187 
188 
204 #define OMPI_ERR_INIT_FINALIZE(name) \
205  { \
206  int32_t state = ompi_mpi_state; \
207  if (OPAL_UNLIKELY(state < OMPI_MPI_STATE_INIT_COMPLETED || \
208  state > OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT)) { \
209  ompi_mpi_errors_are_fatal_comm_handler(NULL, NULL, name); \
210  } \
211  }
212 
228 #define OMPI_ERRHANDLER_INVOKE(mpi_object, err_code, message) \
229  ompi_errhandler_invoke((mpi_object)->error_handler, \
230  (mpi_object), \
231  (int)(mpi_object)->errhandler_type, \
232  ompi_errcode_get_mpi_code(err_code), \
233  (message));
234 
248 #define OMPI_ERRHANDLER_CHECK(rc, mpi_object, err_code, message) \
249  if( OPAL_UNLIKELY(rc != OMPI_SUCCESS) ) { \
250  int __mpi_err_code = ompi_errcode_get_mpi_code(err_code); \
251  OPAL_CR_EXIT_LIBRARY() \
252  ompi_errhandler_invoke((mpi_object)->error_handler, \
253  (mpi_object), \
254  (int) (mpi_object)->errhandler_type, \
255  (__mpi_err_code), \
256  (message)); \
257  return (__mpi_err_code); \
258  }
259 
275 #define OMPI_ERRHANDLER_RETURN(rc, mpi_object, err_code, message) \
276  OPAL_CR_EXIT_LIBRARY() \
277  if ( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) { \
278  int __mpi_err_code = ompi_errcode_get_mpi_code(err_code); \
279  ompi_errhandler_invoke((mpi_object)->error_handler, \
280  (mpi_object), \
281  (int)(mpi_object)->errhandler_type, \
282  (__mpi_err_code), \
283  (message)); \
284  return (__mpi_err_code); \
285  } else { \
286  return MPI_SUCCESS; \
287  }
288 
289 
290 
301  int ompi_errhandler_init(void);
302 
311  int ompi_errhandler_finalize(void);
312 
341  OMPI_DECLSPEC int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
342  int type, int err_code, const char *message);
343 
344 
352  struct ompi_request_t **requests,
353  const char *message);
354 
379  ompi_errhandler_lang_t language);
380 
390 typedef struct {
391  volatile bool active;
392  int status;
394 
396  const opal_process_name_t *source,
397  opal_list_t *info, opal_list_t *results,
399  void *cbdata);
400 
402  size_t errhandler_ref,
403  void *cbdata);
416 static inline bool ompi_errhandler_is_intrinsic(ompi_errhandler_t *errhandler)
417 {
419  return true;
420 
421  return false;
422 }
423 
425 
426 #endif /* OMPI_ERRHANDLER_H */
OMPI_ERRHANDLER_LANG_CXX
@ OMPI_ERRHANDLER_LANG_CXX
Definition: errhandler.h:72
OMPI_ERRHANDLER_NULL_FORTRAN
@ OMPI_ERRHANDLER_NULL_FORTRAN
Definition: errhandler.h:50
ompi_mpi_errhandler_null_addr
ompi_predefined_errhandler_t * ompi_mpi_errhandler_null_addr
Definition: errhandler.c:65
ompi_errhandler_cxx_dispatch_fn_t
void() ompi_errhandler_cxx_dispatch_fn_t(void *handle, int *err_code, const char *message, ompi_errhandler_generic_handler_fn_t *fn)
C++ invocation function signature.
Definition: errhandler.h:98
OMPI_ERRORS_ARE_FATAL_FORTRAN
@ OMPI_ERRORS_ARE_FATAL_FORTRAN
Definition: errhandler.h:51
MPI_Fint
#define MPI_Fint
OMPI-specific Fortran code that should be in ompi_config.h, but not in the other projects.
Definition: ompi_config.h:41
errcode-internal.h
ompi_mpi_errors_are_fatal
ompi_predefined_errhandler_t ompi_mpi_errors_are_fatal
Global variable for MPI_ERRORS_ARE_FATAL (_addr flavor is for F03 bindings)
Definition: errhandler.c:67
ompi_errhandler_finalize
int ompi_errhandler_finalize(void)
Finalize the error handler interface.
Definition: errhandler.c:157
info
static output_desc_t info[64]
Definition: output.c:114
ompi_errhandler_fortran_handler_fn_t
void() ompi_errhandler_fortran_handler_fn_t(ompi_fortran_integer_t *, ompi_fortran_integer_t *,...)
Typedef for all fortran errhandler functions.
Definition: errhandler.h:59
ompi_errhandler_registration_callback
void ompi_errhandler_registration_callback(int status, size_t errhandler_ref, void *cbdata)
Definition: errhandler.c:224
OMPI_ERRHANDLER_LANG_FORTRAN
@ OMPI_ERRHANDLER_LANG_FORTRAN
Definition: errhandler.h:73
opal_pointer_array.h
ompi_errhandler_init
int ompi_errhandler_init(void)
Initialize the error handler interface.
Definition: errhandler.c:81
ompi_errhandler_generic_handler_fn_t
void() ompi_errhandler_generic_handler_fn_t(void *, int *,...)
Typedef for generic errhandler function.
Definition: errhandler.h:65
ompi_errhandler_request_invoke
int ompi_errhandler_request_invoke(int count, struct ompi_request_t **requests, const char *message)
Invoke an MPI exception on the first request found in the array that has a non-MPI_SUCCESS value for ...
Definition: errhandler_invoke.c:120
ompi_errhandler_t::eh_file_fn
ompi_file_errhandler_fn * eh_file_fn
Definition: errhandler.h:120
prefetch.h
cbfunc
static void cbfunc(int status, void *cbdata)
Definition: show_help.c:619
ompi_errhandler_errtrk_t
Callback function to alert the MPI layer of an error or notification from the internal RTE and/or the...
Definition: errhandler.h:390
ompi_mpi_errors_return
ompi_predefined_errhandler_t ompi_mpi_errors_return
Global variable for MPI_ERRORS_RETURN (_addr flavor is for F03 bindings)
Definition: errhandler.c:70
OMPI_ERRORS_RETURN_FORTRAN
@ OMPI_ERRORS_RETURN_FORTRAN
Definition: errhandler.h:52
BEGIN_C_DECLS
#define BEGIN_C_DECLS
code that should be in ompi_config_bottom.h regardless of build status
Definition: opal_config_bottom.h:85
OMPI_ERRHANDLER_TYPE_COMM
@ OMPI_ERRHANDLER_TYPE_COMM
Definition: errhandler.h:83
ompi_errhandler_t::eh_mpi_object_type
ompi_errhandler_type_t eh_mpi_object_type
Definition: errhandler.h:110
ompi_errhandler_t::eh_name
char eh_name[MPI_MAX_OBJECT_NAME]
Definition: errhandler.h:107
opal_object_t
Base object.
Definition: opal_object.h:194
ompi_mpi_errors_are_fatal_addr
ompi_predefined_errhandler_t * ompi_mpi_errors_are_fatal_addr
Definition: errhandler.c:68
ompi_errhandler_t::super
opal_object_t super
Definition: errhandler.h:105
opal_object.h
ompi_errhandler_t::eh_cxx_dispatch_fn
ompi_errhandler_cxx_dispatch_fn_t * eh_cxx_dispatch_fn
Definition: errhandler.h:130
ompi_mpi_errors_throw_exceptions
ompi_predefined_errhandler_t ompi_mpi_errors_throw_exceptions
Global variable for MPI::ERRORS_THROW_EXCEPTIONS.
Definition: errhandler.c:73
ompi_errhandler_create
ompi_errhandler_t * ompi_errhandler_create(ompi_errhandler_type_t object_type, ompi_errhandler_generic_handler_fn_t *func, ompi_errhandler_lang_t language)
Create a ompi_errhandler_t.
Definition: errhandler.c:178
ompi_errhandler_type_t
ompi_errhandler_type_t
Enum used to describe what kind MPI object an error handler is used for.
Definition: errhandler.h:81
requests
static opal_list_t requests
Definition: dfs_app.c:97
ompi_errhandler_errtrk_t::status
int status
Definition: errhandler.h:392
ompi_predefined_errhandler_t::eh
struct ompi_errhandler_t eh
Definition: errhandler.h:145
ompi_mpi_errors_return_addr
ompi_predefined_errhandler_t * ompi_mpi_errors_return_addr
Definition: errhandler.c:71
ompi_errhandler_t
Back-end type for MPI_Errorhandler.
Definition: errhandler.h:104
OMPI_ERRHANDLER_TYPE_FILE
@ OMPI_ERRHANDLER_TYPE_FILE
Definition: errhandler.h:85
ompi_errhandler_callback
void ompi_errhandler_callback(int status, const opal_process_name_t *source, opal_list_t *info, opal_list_t *results, opal_pmix_notification_complete_fn_t cbfunc, void *cbdata)
Default errhandler callback.
Definition: errhandler.c:238
opal_process_name_t
Definition: dss_types.h:46
ompi_predefined_errhandler_t::padding
char padding[1024 - sizeof(ompi_errhandler_t)]
Definition: errhandler.h:146
PREDEFINED_ERRHANDLER_PAD
#define PREDEFINED_ERRHANDLER_PAD
Padded struct to maintain back compatibiltiy.
Definition: errhandler.h:142
ompi_mpi_errhandler_null
ompi_predefined_errhandler_t ompi_mpi_errhandler_null
Global variable for MPI_ERRHANDLER_NULL (_addr flavor is for F03 bindings)
Definition: errhandler.c:64
ompi_errhandler_invoke
int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object, int type, int err_code, const char *message)
Definition: errhandler_invoke.c:36
ompi_request_t
Main top-level request struct definition.
Definition: request.h:124
ompi_errhandler_t::eh_f_to_c_index
int eh_f_to_c_index
Definition: errhandler.h:133
OMPI_ERRHANDLER_LANG_C
@ OMPI_ERRHANDLER_LANG_C
Definition: errhandler.h:71
ompi_errhandler_t
struct ompi_errhandler_t ompi_errhandler_t
Definition: errhandler.h:135
ompi_errhandler_errtrk_t::active
volatile bool active
Definition: errhandler.h:391
count
void int count
Definition: op.c:237
mpiruntime.h
ompi_errhandler_is_intrinsic
static bool ompi_errhandler_is_intrinsic(ompi_errhandler_t *errhandler)
Check to see if an errhandler is intrinsic.
Definition: errhandler.h:416
pmix.h
ompi_predefined_errhandler_t
Definition: errhandler.h:144
ompi_errhandler_t::eh_fort_fn
ompi_errhandler_fortran_handler_fn_t * eh_fort_fn
Definition: errhandler.h:122
opal_pmix_notification_complete_fn_t
void(* opal_pmix_notification_complete_fn_t)(int status, opal_list_t *results, opal_pmix_op_cbfunc_t cbfunc, void *thiscbdata, void *notification_cbdata)
Definition: pmix_types.h:522
ompi_errhandler_t::eh_comm_fn
MPI_Comm_errhandler_function * eh_comm_fn
Definition: errhandler.h:119
opal_list_t
Definition: opal_list.h:152
opal_pointer_array_t
dynamic pointer array
Definition: opal_pointer_array.h:43
errhandler_predefined.h
OMPI_ERRHANDLER_TYPE_PREDEFINED
@ OMPI_ERRHANDLER_TYPE_PREDEFINED
Definition: errhandler.h:82
ompi_errhandler_t::eh_win_fn
MPI_Win_errhandler_function * eh_win_fn
Definition: errhandler.h:121
ompi_errhandler_f_to_c_table
opal_pointer_array_t ompi_errhandler_f_to_c_table
Table for Fortran <-> C errhandler handle conversion.
Definition: errhandler.c:40
ompi_errhandler_lang_t
ompi_errhandler_lang_t
Enum to denote what language the error handler was created from.
Definition: errhandler.h:70
ompi_config.h
END_C_DECLS
#define END_C_DECLS
Definition: opal_config_bottom.h:86
ompi_errhandler_t::eh_lang
ompi_errhandler_lang_t eh_lang
Definition: errhandler.h:113
OMPI_DECLSPEC
#define OMPI_DECLSPEC
Definition: ompi_config.h:52
OMPI_ERRHANDLER_TYPE_WIN
@ OMPI_ERRHANDLER_TYPE_WIN
Definition: errhandler.h:84