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)  

errcode.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-2007 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) 2006 University of Houston. All rights reserved.
14  * Copyright (c) 2007-2015 Cisco Systems, Inc. All rights reserved.
15  * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
16  * reserved.
17  * $COPYRIGHT$
18  *
19  * Additional copyrights may follow
20  *
21  * $HEADER$
22  */
25 #ifndef OMPI_MPI_ERRCODE_H
26 #define OMPI_MPI_ERRCODE_H
27 
28 #include "ompi_config.h"
29 
30 #include "mpi.h"
31 #include "opal/class/opal_object.h"
33 
35 
46  int code;
47  int cls;
48  char errstring[MPI_MAX_ERROR_STRING];
49 };
51 
55 
57 
61 static inline bool ompi_mpi_errcode_is_invalid(int errcode)
62 {
63  if ( errcode >= 0 && errcode <= ompi_mpi_errcode_lastused )
64  return 0;
65  else
66  return 1;
67 }
68 
72 static inline int ompi_mpi_errcode_get_class (int errcode)
73 {
75 
76  if (errcode >= 0) {
78  /* If we get a bogus errcode, return MPI_ERR_UNKNOWN */
79  }
80 
81  if (NULL != err) {
82  if ( err->code != MPI_UNDEFINED ) {
83  return err->cls;
84  }
85  }
86  return ompi_err_unknown.cls;
87 }
88 
89 static inline int ompi_mpi_errcode_is_predefined ( int errcode )
90 {
91  if ( errcode >= 0 && errcode <= ompi_mpi_errcode_lastpredefined )
92  return true;
93 
94  return false;
95 }
96 
97 static inline int ompi_mpi_errnum_is_class ( int errnum )
98 {
100 
101  if (errnum < 0) {
102  return false;
103  }
104 
105  if ( errnum <= ompi_mpi_errcode_lastpredefined ) {
106  /* Predefined error values represent an error code and
107  an error class at the same time */
108  return true;
109  }
110 
112  if (NULL != err) {
113  if ( MPI_UNDEFINED == err->code) {
114  /* Distinction between error class and error code is that for the
115  first one the code section is set to MPI_UNDEFINED */
116  return true;
117  }
118  }
119 
120  return false;
121 }
122 
123 
127 static inline char* ompi_mpi_errnum_get_string (int errnum)
128 {
130 
131  if (errnum >= 0) {
133  /* If we get a bogus errcode, return a string indicating that this
134  truly should not happen */
135  }
136 
137  if (NULL != err) {
138  return err->errstring;
139  } else {
140  return "Unknown error (this should not happen!)";
141  }
142 }
143 
144 
153 int ompi_mpi_errcode_init(void);
154 
162 int ompi_mpi_errcode_finalize(void);
163 
173 int ompi_mpi_errcode_add (int errclass);
174 
184 int ompi_mpi_errclass_add (void);
185 
196 int ompi_mpi_errnum_add_string (int errnum, const char* string, int len);
197 
199 
200 #endif /* OMPI_MPI_ERRCODE_H */
ompi_mpi_errnum_add_string
int ompi_mpi_errnum_add_string(int errnum, const char *string, int len)
Add an error string to an error code.
Definition: errcode.c:343
ompi_mpi_errcode_t::code
int code
Definition: errcode.h:46
ompi_mpi_errcode_get_class
static int ompi_mpi_errcode_get_class(int errcode)
Return the error class.
Definition: errcode.h:72
opal_pointer_array.h
ompi_mpi_errcode_t::cls
int cls
Definition: errcode.h:47
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_mpi_errcode_t::super
opal_object_t super
Definition: errcode.h:45
ompi_mpi_errcodes
opal_pointer_array_t ompi_mpi_errcodes
Definition: errcode.c:37
ompi_mpi_errcode_t
Back-end type for MPI error codes.
Definition: errcode.h:44
opal_object_t
Base object.
Definition: opal_object.h:194
ompi_mpi_errnum_get_string
static char * ompi_mpi_errnum_get_string(int errnum)
Return the error string.
Definition: errcode.h:127
ompi_mpi_errcode_lastused
int ompi_mpi_errcode_lastused
Definition: errcode.c:38
opal_object.h
err
err
Definition: sharedfp_sm_file_open.c:245
ompi_mpi_errcode_add
int ompi_mpi_errcode_add(int errclass)
Add an error code.
Definition: errcode.c:318
ompi_mpi_errcode_t::errstring
char errstring[MPI_MAX_ERROR_STRING]
Definition: errcode.h:48
ompi_mpi_errcode_init
int ompi_mpi_errcode_init(void)
Initialize the error codes.
Definition: errcode.c:131
ompi_mpi_errnum_is_class
static int ompi_mpi_errnum_is_class(int errnum)
Definition: errcode.h:97
ompi_err_unknown
ompi_mpi_errcode_t ompi_err_unknown
Definition: errcode.c:55
ompi_mpi_errcode_is_invalid
static bool ompi_mpi_errcode_is_invalid(int errcode)
Check for a valid error code.
Definition: errcode.h:61
opal_pointer_array_t
dynamic pointer array
Definition: opal_pointer_array.h:43
opal_pointer_array_get_item
static void * opal_pointer_array_get_item(opal_pointer_array_t *table, int element_index)
Get the value of an element in array.
Definition: opal_pointer_array.h:125
ompi_mpi_errclass_add
int ompi_mpi_errclass_add(void)
Add an error class.
Definition: errcode.c:331
ompi_mpi_errcode_finalize
int ompi_mpi_errcode_finalize(void)
Finalize the error codes.
Definition: errcode.c:225
ompi_config.h
END_C_DECLS
#define END_C_DECLS
Definition: opal_config_bottom.h:86
ompi_mpi_errcode_is_predefined
static int ompi_mpi_errcode_is_predefined(int errcode)
Definition: errcode.h:89
ompi_mpi_errcode_lastpredefined
int ompi_mpi_errcode_lastpredefined
Definition: errcode.c:39
OMPI_DECLSPEC
#define OMPI_DECLSPEC
Definition: ompi_config.h:52
NULL
#define NULL
Copyright (C) 2000-2004 by Etnus, LLC.
Definition: ompi_msgq_dll.c:136