Skip to content

Commit 3a8b0e2

Browse files
committed
fix error return values for ABI routines
somehow was using the wrong converter to translate ompi intern error values with abi ones. Many are actually the same but that's just by chance. Signed-off-by: Howard Pritchard <howardp@lanl.gov>
1 parent b066003 commit 3a8b0e2

File tree

2 files changed

+175
-3
lines changed

2 files changed

+175
-3
lines changed

ompi/mpi/bindings/ompi_bindings/c_type.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,23 @@ def callback_wrapper_code(self):
8989
"""Return True if this parameter has callback wrapper code to generate."""
9090
return False
9191

92-
@Type.add_type('ERROR_CLASS')
92+
@Type.add_type('ERROR_CLASS', abi_type=['ompi'])
9393
class TypeErrorClass(Type):
9494

9595
def type_text(self, enable_count=False):
9696
return 'int'
9797

9898
def return_code(self, name):
99-
return [f'return {ConvertFuncs.ERROR_CLASS}({name});']
99+
return [f'return {name};']
100+
101+
@Type.add_type('ERROR_CLASS', abi_type=['standard'])
102+
class TypeErrorClass(Type):
103+
104+
def type_text(self, enable_count=False):
105+
return 'int'
106+
107+
def return_code(self, name):
108+
return [f'return {ConvertOMPIToStandard.ERROR_CLASS}({name});']
100109

101110

102111
@Type.add_type('BUFFER')

ompi/mpi/c/abi_converters.h

Lines changed: 164 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern "C" {
1717
/*
1818
* see section 20.3.4 of the MPI 5.0 standard
1919
*/
20-
#define OMPI_ABI_HANDLE_BASE_OFFSET 16384
20+
#define OMPI_ABI_HANDLE_BASE_OFFSET 16385
2121

2222
__opal_attribute_always_inline__ static inline int ompi_convert_abi_error_intern_error(int error_class)
2323
{
@@ -180,6 +180,169 @@ __opal_attribute_always_inline__ static inline int ompi_convert_abi_error_intern
180180
return error_class;
181181
}
182182
}
183+
184+
__opal_attribute_always_inline__ static inline int ompi_convert_intern_error_abi_error(int error_class)
185+
{
186+
switch (error_class) {
187+
case MPI_SUCCESS:
188+
return MPI_SUCCESS_ABI_INTERNAL;
189+
case MPI_ERR_BUFFER:
190+
return MPI_ERR_BUFFER_ABI_INTERNAL;
191+
case MPI_ERR_COUNT:
192+
return MPI_ERR_COUNT_ABI_INTERNAL;
193+
case MPI_ERR_TYPE:
194+
return MPI_ERR_TYPE_ABI_INTERNAL;
195+
case MPI_ERR_TAG:
196+
return MPI_ERR_TAG_ABI_INTERNAL;
197+
case MPI_ERR_COMM:
198+
return MPI_ERR_COMM_ABI_INTERNAL;
199+
case MPI_ERR_RANK:
200+
return MPI_ERR_RANK_ABI_INTERNAL;
201+
case MPI_ERR_REQUEST:
202+
return MPI_ERR_REQUEST_ABI_INTERNAL;
203+
case MPI_ERR_ROOT:
204+
return MPI_ERR_ROOT_ABI_INTERNAL;
205+
case MPI_ERR_GROUP:
206+
return MPI_ERR_GROUP_ABI_INTERNAL;
207+
case MPI_ERR_OP:
208+
return MPI_ERR_OP_ABI_INTERNAL;
209+
case MPI_ERR_TOPOLOGY:
210+
return MPI_ERR_TOPOLOGY_ABI_INTERNAL;
211+
case MPI_ERR_DIMS:
212+
return MPI_ERR_DIMS_ABI_INTERNAL;
213+
case MPI_ERR_ARG:
214+
return MPI_ERR_ARG_ABI_INTERNAL;
215+
case MPI_ERR_UNKNOWN:
216+
return MPI_ERR_UNKNOWN_ABI_INTERNAL;
217+
case MPI_ERR_TRUNCATE:
218+
return MPI_ERR_TRUNCATE_ABI_INTERNAL;
219+
case MPI_ERR_OTHER:
220+
return MPI_ERR_OTHER_ABI_INTERNAL;
221+
case MPI_ERR_INTERN:
222+
return MPI_ERR_INTERN_ABI_INTERNAL;
223+
case MPI_ERR_PENDING:
224+
return MPI_ERR_PENDING_ABI_INTERNAL;
225+
case MPI_ERR_IN_STATUS:
226+
return MPI_ERR_IN_STATUS_ABI_INTERNAL;
227+
case MPI_ERR_ACCESS:
228+
return MPI_ERR_ACCESS_ABI_INTERNAL;
229+
case MPI_ERR_AMODE:
230+
return MPI_ERR_AMODE_ABI_INTERNAL;
231+
case MPI_ERR_ASSERT:
232+
return MPI_ERR_ASSERT_ABI_INTERNAL;
233+
case MPI_ERR_BAD_FILE:
234+
return MPI_ERR_BAD_FILE_ABI_INTERNAL;
235+
case MPI_ERR_BASE:
236+
return MPI_ERR_BASE_ABI_INTERNAL;
237+
case MPI_ERR_CONVERSION:
238+
return MPI_ERR_CONVERSION_ABI_INTERNAL;
239+
case MPI_ERR_DISP:
240+
return MPI_ERR_DISP_ABI_INTERNAL;
241+
case MPI_ERR_DUP_DATAREP:
242+
return MPI_ERR_DUP_DATAREP_ABI_INTERNAL;
243+
case MPI_ERR_FILE_EXISTS:
244+
return MPI_ERR_FILE_EXISTS_ABI_INTERNAL;
245+
case MPI_ERR_FILE_IN_USE:
246+
return MPI_ERR_FILE_IN_USE_ABI_INTERNAL;
247+
case MPI_ERR_FILE:
248+
return MPI_ERR_FILE_ABI_INTERNAL;
249+
case MPI_ERR_INFO_KEY:
250+
return MPI_ERR_INFO_KEY_ABI_INTERNAL;
251+
case MPI_ERR_INFO_NOKEY:
252+
return MPI_ERR_INFO_NOKEY_ABI_INTERNAL;
253+
case MPI_ERR_INFO_VALUE:
254+
return MPI_ERR_INFO_VALUE_ABI_INTERNAL;
255+
case MPI_ERR_INFO:
256+
return MPI_ERR_INFO_ABI_INTERNAL;
257+
case MPI_ERR_IO:
258+
return MPI_ERR_IO_ABI_INTERNAL;
259+
case MPI_ERR_KEYVAL:
260+
return MPI_ERR_KEYVAL_ABI_INTERNAL;
261+
case MPI_ERR_LOCKTYPE:
262+
return MPI_ERR_LOCKTYPE_ABI_INTERNAL;
263+
case MPI_ERR_NAME:
264+
return MPI_ERR_NAME_ABI_INTERNAL;
265+
case MPI_ERR_NO_MEM:
266+
return MPI_ERR_NO_MEM_ABI_INTERNAL;
267+
case MPI_ERR_NOT_SAME:
268+
return MPI_ERR_NOT_SAME_ABI_INTERNAL;
269+
case MPI_ERR_NO_SPACE:
270+
return MPI_ERR_NO_SPACE_ABI_INTERNAL;
271+
case MPI_ERR_NO_SUCH_FILE:
272+
return MPI_ERR_NO_SUCH_FILE_ABI_INTERNAL;
273+
case MPI_ERR_PORT:
274+
return MPI_ERR_PORT_ABI_INTERNAL;
275+
case MPI_ERR_PROC_ABORTED:
276+
return MPI_ERR_PROC_ABORTED_ABI_INTERNAL;
277+
case MPI_ERR_QUOTA:
278+
return MPI_ERR_QUOTA_ABI_INTERNAL;
279+
case MPI_ERR_READ_ONLY:
280+
return MPI_ERR_READ_ONLY_ABI_INTERNAL;
281+
case MPI_ERR_RMA_ATTACH:
282+
return MPI_ERR_RMA_ATTACH_ABI_INTERNAL;
283+
case MPI_ERR_RMA_CONFLICT:
284+
return MPI_ERR_RMA_CONFLICT_ABI_INTERNAL;
285+
case MPI_ERR_RMA_RANGE:
286+
return MPI_ERR_RMA_RANGE_ABI_INTERNAL;
287+
case MPI_ERR_RMA_SHARED:
288+
return MPI_ERR_RMA_SHARED_ABI_INTERNAL;
289+
case MPI_ERR_RMA_SYNC:
290+
return MPI_ERR_RMA_SYNC_ABI_INTERNAL;
291+
case MPI_ERR_RMA_FLAVOR:
292+
return MPI_ERR_RMA_FLAVOR_ABI_INTERNAL;
293+
case MPI_ERR_SERVICE:
294+
return MPI_ERR_SERVICE_ABI_INTERNAL;
295+
case MPI_ERR_SESSION:
296+
return MPI_ERR_SESSION_ABI_INTERNAL;
297+
case MPI_ERR_SIZE:
298+
return MPI_ERR_SIZE_ABI_INTERNAL;
299+
case MPI_ERR_SPAWN:
300+
return MPI_ERR_SPAWN_ABI_INTERNAL;
301+
case MPI_ERR_UNSUPPORTED_DATAREP:
302+
return MPI_ERR_UNSUPPORTED_DATAREP_ABI_INTERNAL;
303+
case MPI_ERR_UNSUPPORTED_OPERATION:
304+
return MPI_ERR_UNSUPPORTED_OPERATION_ABI_INTERNAL;
305+
case MPI_ERR_WIN:
306+
return MPI_ERR_WIN_ABI_INTERNAL;
307+
case MPI_T_ERR_CANNOT_INIT:
308+
return MPI_T_ERR_CANNOT_INIT_ABI_INTERNAL;
309+
case MPI_T_ERR_NOT_INITIALIZED:
310+
return MPI_T_ERR_NOT_INITIALIZED_ABI_INTERNAL;
311+
case MPI_T_ERR_MEMORY:
312+
return MPI_T_ERR_MEMORY_ABI_INTERNAL;
313+
case MPI_T_ERR_INVALID:
314+
return MPI_T_ERR_INVALID_ABI_INTERNAL;
315+
case MPI_T_ERR_INVALID_INDEX:
316+
return MPI_T_ERR_INVALID_INDEX_ABI_INTERNAL;
317+
case MPI_T_ERR_INVALID_ITEM:
318+
return MPI_T_ERR_INVALID_ITEM_ABI_INTERNAL;
319+
case MPI_T_ERR_INVALID_SESSION:
320+
return MPI_T_ERR_INVALID_SESSION_ABI_INTERNAL;
321+
case MPI_T_ERR_INVALID_HANDLE:
322+
return MPI_T_ERR_INVALID_HANDLE_ABI_INTERNAL;
323+
case MPI_T_ERR_INVALID_NAME:
324+
return MPI_T_ERR_INVALID_NAME_ABI_INTERNAL;
325+
case MPI_T_ERR_OUT_OF_HANDLES:
326+
return MPI_T_ERR_OUT_OF_HANDLES_ABI_INTERNAL;
327+
case MPI_T_ERR_OUT_OF_SESSIONS:
328+
return MPI_T_ERR_OUT_OF_SESSIONS_ABI_INTERNAL;
329+
case MPI_T_ERR_CVAR_SET_NOT_NOW:
330+
return MPI_T_ERR_CVAR_SET_NOT_NOW_ABI_INTERNAL;
331+
case MPI_T_ERR_CVAR_SET_NEVER:
332+
return MPI_T_ERR_CVAR_SET_NEVER_ABI_INTERNAL;
333+
case MPI_T_ERR_PVAR_NO_WRITE:
334+
return MPI_T_ERR_PVAR_NO_WRITE_ABI_INTERNAL;
335+
case MPI_T_ERR_PVAR_NO_STARTSTOP:
336+
return MPI_T_ERR_PVAR_NO_STARTSTOP_ABI_INTERNAL;
337+
case MPI_T_ERR_PVAR_NO_ATOMIC:
338+
return MPI_T_ERR_PVAR_NO_ATOMIC_ABI_INTERNAL;
339+
case MPI_ERR_LASTCODE:
340+
return MPI_ERR_LASTCODE_ABI_INTERNAL;
341+
default:
342+
return error_class;
343+
}
344+
}
345+
183346
__opal_attribute_always_inline__ static inline MPI_Comm ompi_convert_abi_comm_intern_comm(MPI_Comm_ABI_INTERNAL comm)
184347
{
185348
if (MPI_COMM_NULL_ABI_INTERNAL == comm) {

0 commit comments

Comments
 (0)