From 1359ba9b134a516e96d0db7d45677b94b6eb855f Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 5 Dec 2006 19:07:02 +0000 Subject: [PATCH] Rewriting much of the errorcode and errorclass code, since - we have to be able to attach a string to an error class, not just to an error code - according to MPI-2 the attribute MPI_LASTUSEDCODE has to be updated everytime you add a new code or a new class. Thus, you have to have single list for both. Thus, we got rid of the error_class structure. In the error-code structure, we can distinguish whether we are dealing with an error code or an error class by looking at the err->code element of the structure. In case its value is MPI_UNDEFINED, the according entry is a class, else it is an error code. All predefined error codes have the code and the class field set to the same value. The test MPI_Add_error_class1 passes now. Fixes trac:418 This commit was SVN r12764. The following Trac tickets were found above: Ticket 418 --> https://svn.open-mpi.org/trac/ompi/ticket/418 --- ompi/attribute/attribute_predefined.c | 8 +- ompi/errhandler/Makefile.am | 2 - ompi/errhandler/errclass.c | 427 ------------------------ ompi/errhandler/errclass.h | 93 ------ ompi/errhandler/errcode.c | 19 +- ompi/errhandler/errcode.h | 36 +- ompi/errhandler/errhandler_predefined.c | 3 +- ompi/mpi/c/add_error_class.c | 5 +- ompi/mpi/c/add_error_code.c | 4 +- ompi/mpi/c/add_error_string.c | 3 +- ompi/mpi/c/error_string.c | 3 +- ompi/runtime/ompi_mpi_finalize.c | 7 +- ompi/runtime/ompi_mpi_init.c | 8 +- 13 files changed, 62 insertions(+), 556 deletions(-) delete mode 100644 ompi/errhandler/errclass.c delete mode 100644 ompi/errhandler/errclass.h diff --git a/ompi/attribute/attribute_predefined.c b/ompi/attribute/attribute_predefined.c index dec1d3f743..ca55525d98 100644 --- a/ompi/attribute/attribute_predefined.c +++ b/ompi/attribute/attribute_predefined.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,7 +51,8 @@ * MPI_APPNUM is set as the result of a GPR subscription. * * MPI_LASTUSEDCODE is set to an initial value and is reset every time - * MPI_ADD_ERROR_CLASS is invoked. Its copy function is set to + * MPI_ADD_ERROR_CLASS or MPI_ADD_ERROR_CODE is invoked. + * Its copy function is set to * MPI_COMM_NULL_COPY_FN, meaning that *only* MPI_COMM_WORLD will have * this attribute value. As such, we only have to update * MPI_COMM_WORLD when this value changes (i.e., since this is an @@ -82,7 +84,7 @@ #include "ompi/attribute/attribute.h" -#include "ompi/errhandler/errclass.h" +#include "ompi/errhandler/errcode.h" #include "ompi/communicator/communicator.h" #include "orte/util/proc_info.h" #include "ompi/mca/pml/pml.h" @@ -151,7 +153,7 @@ int ompi_attr_create_predefined(void) OMPI_SUCCESS != (ret = set_f(MPI_IO, MPI_ANY_SOURCE)) || OMPI_SUCCESS != (ret = set_f(MPI_WTIME_IS_GLOBAL, 0)) || OMPI_SUCCESS != (ret = set_f(MPI_LASTUSEDCODE, - ompi_errclass_lastused)) || + ompi_mpi_errcode_lastused)) || OMPI_SUCCESS != (ret = set_f(MPI_UNIVERSE_SIZE, ompi_comm_size(MPI_COMM_WORLD))) || #if 0 diff --git a/ompi/errhandler/Makefile.am b/ompi/errhandler/Makefile.am index 1288f8eec6..db155d3ece 100644 --- a/ompi/errhandler/Makefile.am +++ b/ompi/errhandler/Makefile.am @@ -20,7 +20,6 @@ # This makefile.am does not stand on its own - it is included from ompi/Makefile.am headers += \ - errhandler/errclass.h \ errhandler/errcode.h \ errhandler/errcode-internal.h \ errhandler/errhandler.h \ @@ -31,5 +30,4 @@ libmpi_la_SOURCES += \ errhandler/errhandler_invoke.c \ errhandler/errhandler_predefined.c \ errhandler/errcode.c \ - errhandler/errclass.c \ errhandler/errcode-internal.c diff --git a/ompi/errhandler/errclass.c b/ompi/errhandler/errclass.c deleted file mode 100644 index 07561e35e6..0000000000 --- a/ompi/errhandler/errclass.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include -#include "mpi.h" - -#include "ompi/errhandler/errclass.h" -#include "ompi/constants.h" - -/* Table holding all error codes */ -ompi_pointer_array_t ompi_errclasses; -int ompi_errclass_lastused=0; -int ompi_errclass_lastpredefined=0; - -ompi_errclass_t ompi_errclass_success; -ompi_errclass_t ompi_errclass_buffer; -ompi_errclass_t ompi_errclass_count; -ompi_errclass_t ompi_errclass_type; -ompi_errclass_t ompi_errclass_tag; -ompi_errclass_t ompi_errclass_comm; -ompi_errclass_t ompi_errclass_rank; -ompi_errclass_t ompi_errclass_request; -ompi_errclass_t ompi_errclass_root; -ompi_errclass_t ompi_errclass_group; -ompi_errclass_t ompi_errclass_op; -ompi_errclass_t ompi_errclass_topology; -ompi_errclass_t ompi_errclass_dims; -ompi_errclass_t ompi_errclass_arg; -ompi_errclass_t ompi_errclass_unknown; -ompi_errclass_t ompi_errclass_truncate; -ompi_errclass_t ompi_errclass_other; -ompi_errclass_t ompi_errclass_intern; -ompi_errclass_t ompi_errclass_in_status; -ompi_errclass_t ompi_errclass_pending; - -ompi_errclass_t ompi_errclass_access; -ompi_errclass_t ompi_errclass_amode; -ompi_errclass_t ompi_errclass_assert; -ompi_errclass_t ompi_errclass_bad_file; -ompi_errclass_t ompi_errclass_base; -ompi_errclass_t ompi_errclass_conversion; -ompi_errclass_t ompi_errclass_disp; -ompi_errclass_t ompi_errclass_dup_datarep; -ompi_errclass_t ompi_errclass_file_exists; -ompi_errclass_t ompi_errclass_file_in_use; -ompi_errclass_t ompi_errclass_file; -ompi_errclass_t ompi_errclass_info_key; -ompi_errclass_t ompi_errclass_info_nokey; -ompi_errclass_t ompi_errclass_info_value; -ompi_errclass_t ompi_errclass_info; -ompi_errclass_t ompi_errclass_io; -ompi_errclass_t ompi_errclass_keyval; -ompi_errclass_t ompi_errclass_locktype; -ompi_errclass_t ompi_errclass_name; -ompi_errclass_t ompi_errclass_no_mem; -ompi_errclass_t ompi_errclass_not_same; -ompi_errclass_t ompi_errclass_no_space; -ompi_errclass_t ompi_errclass_no_such_file; -ompi_errclass_t ompi_errclass_port; -ompi_errclass_t ompi_errclass_quota; -ompi_errclass_t ompi_errclass_read_only; -ompi_errclass_t ompi_errclass_rma_conflict; -ompi_errclass_t ompi_errclass_rma_sync; -ompi_errclass_t ompi_errclass_service; -ompi_errclass_t ompi_errclass_size; -ompi_errclass_t ompi_errclass_spawn; -ompi_errclass_t ompi_errclass_unsupported_datarep; -ompi_errclass_t ompi_errclass_unsupported_operation; -ompi_errclass_t ompi_errclass_win; - -static void ompi_errclass_construct(ompi_errclass_t* errcode); -static void ompi_errclass_destruct(ompi_errclass_t* errcode); - -OBJ_CLASS_INSTANCE(ompi_errclass_t,opal_object_t,ompi_errclass_construct, ompi_errclass_destruct); - -int ompi_errclass_init (void) -{ - /* - * Initialize the pointer array, which will hold the references to - * the error objects - */ - OBJ_CONSTRUCT(&ompi_errclasses, ompi_pointer_array_t); - - /* - * Initialize now each predefined error class and register - * it in the pointer-array. - */ - OBJ_CONSTRUCT(&ompi_errclass_success, ompi_errclass_t); - ompi_errclass_success.cls = MPI_SUCCESS; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_SUCCESS, &ompi_errclass_success); - - OBJ_CONSTRUCT(&ompi_errclass_buffer, ompi_errclass_t); - ompi_errclass_buffer.cls = MPI_ERR_BUFFER; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_BUFFER, &ompi_errclass_buffer); - - OBJ_CONSTRUCT(&ompi_errclass_count, ompi_errclass_t); - ompi_errclass_count.cls = MPI_ERR_COUNT; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_COUNT, &ompi_errclass_count); - - OBJ_CONSTRUCT(&ompi_errclass_type, ompi_errclass_t); - ompi_errclass_type.cls = MPI_ERR_TYPE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_TYPE, &ompi_errclass_type); - - OBJ_CONSTRUCT(&ompi_errclass_tag, ompi_errclass_t); - ompi_errclass_tag.cls = MPI_ERR_TAG; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_TAG, &ompi_errclass_tag); - - OBJ_CONSTRUCT(&ompi_errclass_comm, ompi_errclass_t); - ompi_errclass_comm.cls = MPI_ERR_COMM; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_COMM, &ompi_errclass_comm); - - OBJ_CONSTRUCT(&ompi_errclass_rank, ompi_errclass_t); - ompi_errclass_rank.cls = MPI_ERR_RANK; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_RANK, &ompi_errclass_rank); - - OBJ_CONSTRUCT(&ompi_errclass_request, ompi_errclass_t); - ompi_errclass_request.cls = MPI_ERR_REQUEST; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_REQUEST, &ompi_errclass_request); - - OBJ_CONSTRUCT(&ompi_errclass_root, ompi_errclass_t); - ompi_errclass_root.cls = MPI_ERR_ROOT; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_ROOT, &ompi_errclass_root); - - OBJ_CONSTRUCT(&ompi_errclass_group, ompi_errclass_t); - ompi_errclass_group.cls = MPI_ERR_GROUP; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_GROUP, &ompi_errclass_group); - - OBJ_CONSTRUCT(&ompi_errclass_op, ompi_errclass_t); - ompi_errclass_op.cls = MPI_ERR_OP; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_OP, &ompi_errclass_op); - - OBJ_CONSTRUCT(&ompi_errclass_topology, ompi_errclass_t); - ompi_errclass_topology.cls = MPI_ERR_TOPOLOGY; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_TOPOLOGY, &ompi_errclass_topology); - - OBJ_CONSTRUCT(&ompi_errclass_dims, ompi_errclass_t); - ompi_errclass_dims.cls = MPI_ERR_DIMS; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_DIMS, &ompi_errclass_dims); - - OBJ_CONSTRUCT(&ompi_errclass_arg, ompi_errclass_t); - ompi_errclass_arg.cls = MPI_ERR_ARG; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_ARG, &ompi_errclass_arg); - - OBJ_CONSTRUCT(&ompi_errclass_unknown, ompi_errclass_t); - ompi_errclass_unknown.cls = MPI_ERR_UNKNOWN; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_UNKNOWN, &ompi_errclass_unknown); - - OBJ_CONSTRUCT(&ompi_errclass_truncate, ompi_errclass_t); - ompi_errclass_truncate.cls = MPI_ERR_TRUNCATE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_TRUNCATE, &ompi_errclass_truncate); - - OBJ_CONSTRUCT(&ompi_errclass_other, ompi_errclass_t); - ompi_errclass_other.cls = MPI_ERR_OTHER; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_OTHER, &ompi_errclass_other); - - OBJ_CONSTRUCT(&ompi_errclass_intern, ompi_errclass_t); - ompi_errclass_intern.cls = MPI_ERR_INTERN; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_INTERN, &ompi_errclass_intern); - - OBJ_CONSTRUCT(&ompi_errclass_in_status, ompi_errclass_t); - ompi_errclass_in_status.cls = MPI_ERR_IN_STATUS; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_IN_STATUS, &ompi_errclass_in_status); - - OBJ_CONSTRUCT(&ompi_errclass_pending, ompi_errclass_t); - ompi_errclass_pending.cls = MPI_ERR_PENDING; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_PENDING, &ompi_errclass_pending); - - OBJ_CONSTRUCT(&ompi_errclass_access, ompi_errclass_t); - ompi_errclass_access.cls = MPI_ERR_ACCESS; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_ACCESS, &ompi_errclass_access); - - OBJ_CONSTRUCT(&ompi_errclass_amode, ompi_errclass_t); - ompi_errclass_amode.cls = MPI_ERR_AMODE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_AMODE, &ompi_errclass_amode); - - OBJ_CONSTRUCT(&ompi_errclass_assert, ompi_errclass_t); - ompi_errclass_assert.cls = MPI_ERR_ASSERT; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_ASSERT, &ompi_errclass_assert); - - OBJ_CONSTRUCT(&ompi_errclass_bad_file, ompi_errclass_t); - ompi_errclass_bad_file.cls = MPI_ERR_BAD_FILE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_BAD_FILE, &ompi_errclass_bad_file); - - OBJ_CONSTRUCT(&ompi_errclass_base, ompi_errclass_t); - ompi_errclass_base.cls = MPI_ERR_BASE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_BASE, &ompi_errclass_base); - - OBJ_CONSTRUCT(&ompi_errclass_conversion, ompi_errclass_t); - ompi_errclass_conversion.cls = MPI_ERR_CONVERSION; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_CONVERSION, &ompi_errclass_conversion); - - OBJ_CONSTRUCT(&ompi_errclass_disp, ompi_errclass_t); - ompi_errclass_disp.cls = MPI_ERR_DISP; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_DISP, &ompi_errclass_disp); - - OBJ_CONSTRUCT(&ompi_errclass_dup_datarep, ompi_errclass_t); - ompi_errclass_dup_datarep.cls = MPI_ERR_DUP_DATAREP; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_DUP_DATAREP, &ompi_errclass_dup_datarep); - - OBJ_CONSTRUCT(&ompi_errclass_file_exists, ompi_errclass_t); - ompi_errclass_file_exists.cls = MPI_ERR_FILE_EXISTS; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_FILE_EXISTS, &ompi_errclass_file_exists); - - OBJ_CONSTRUCT(&ompi_errclass_file_in_use, ompi_errclass_t); - ompi_errclass_file_in_use.cls = MPI_ERR_FILE_IN_USE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_FILE_IN_USE, &ompi_errclass_file_in_use); - - OBJ_CONSTRUCT(&ompi_errclass_file, ompi_errclass_t); - ompi_errclass_file.cls = MPI_ERR_FILE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_FILE, &ompi_errclass_file); - - OBJ_CONSTRUCT(&ompi_errclass_info_key, ompi_errclass_t); - ompi_errclass_info_key.cls = MPI_ERR_INFO_KEY; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_INFO_KEY, &ompi_errclass_info_key); - - OBJ_CONSTRUCT(&ompi_errclass_info_nokey, ompi_errclass_t); - ompi_errclass_info_nokey.cls = MPI_ERR_INFO_NOKEY; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_INFO_NOKEY, &ompi_errclass_info_nokey); - - OBJ_CONSTRUCT(&ompi_errclass_info_value, ompi_errclass_t); - ompi_errclass_info_value.cls = MPI_ERR_INFO_VALUE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_INFO_VALUE, &ompi_errclass_info_value); - - OBJ_CONSTRUCT(&ompi_errclass_info, ompi_errclass_t); - ompi_errclass_info.cls = MPI_ERR_INFO; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_INFO, &ompi_errclass_info); - - OBJ_CONSTRUCT(&ompi_errclass_io, ompi_errclass_t); - ompi_errclass_io.cls = MPI_ERR_IO; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_IO, &ompi_errclass_io); - - OBJ_CONSTRUCT(&ompi_errclass_keyval, ompi_errclass_t); - ompi_errclass_keyval.cls = MPI_ERR_KEYVAL; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_KEYVAL, &ompi_errclass_keyval); - - OBJ_CONSTRUCT(&ompi_errclass_locktype, ompi_errclass_t); - ompi_errclass_locktype.cls = MPI_ERR_LOCKTYPE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_LOCKTYPE, &ompi_errclass_locktype); - - OBJ_CONSTRUCT(&ompi_errclass_name, ompi_errclass_t); - ompi_errclass_name.cls = MPI_ERR_NAME; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_NAME, &ompi_errclass_name); - - OBJ_CONSTRUCT(&ompi_errclass_no_mem, ompi_errclass_t); - ompi_errclass_no_mem.cls = MPI_ERR_NO_MEM; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_NO_MEM, &ompi_errclass_no_mem); - - OBJ_CONSTRUCT(&ompi_errclass_not_same, ompi_errclass_t); - ompi_errclass_not_same.cls = MPI_ERR_NOT_SAME; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_NOT_SAME, &ompi_errclass_not_same); - - OBJ_CONSTRUCT(&ompi_errclass_no_space, ompi_errclass_t); - ompi_errclass_no_space.cls = MPI_ERR_NO_SPACE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_NO_SPACE, &ompi_errclass_no_space); - - OBJ_CONSTRUCT(&ompi_errclass_no_such_file, ompi_errclass_t); - ompi_errclass_no_such_file.cls = MPI_ERR_NO_SUCH_FILE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_NO_SUCH_FILE, &ompi_errclass_no_such_file); - - OBJ_CONSTRUCT(&ompi_errclass_port, ompi_errclass_t); - ompi_errclass_port.cls = MPI_ERR_PORT; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_PORT, &ompi_errclass_port); - - OBJ_CONSTRUCT(&ompi_errclass_quota, ompi_errclass_t); - ompi_errclass_quota.cls = MPI_ERR_QUOTA; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_QUOTA, &ompi_errclass_quota); - - OBJ_CONSTRUCT(&ompi_errclass_read_only, ompi_errclass_t); - ompi_errclass_read_only.cls = MPI_ERR_READ_ONLY; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_READ_ONLY, &ompi_errclass_read_only); - - OBJ_CONSTRUCT(&ompi_errclass_rma_conflict, ompi_errclass_t); - ompi_errclass_rma_conflict.cls = MPI_ERR_RMA_CONFLICT; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_RMA_CONFLICT, &ompi_errclass_rma_conflict); - - OBJ_CONSTRUCT(&ompi_errclass_rma_sync, ompi_errclass_t); - ompi_errclass_rma_sync.cls = MPI_ERR_RMA_SYNC; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_RMA_SYNC, &ompi_errclass_rma_sync); - - OBJ_CONSTRUCT(&ompi_errclass_service, ompi_errclass_t); - ompi_errclass_service.cls = MPI_ERR_SERVICE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_SERVICE, &ompi_errclass_service); - - OBJ_CONSTRUCT(&ompi_errclass_size, ompi_errclass_t); - ompi_errclass_size.cls = MPI_ERR_SIZE; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_SIZE, &ompi_errclass_size); - - OBJ_CONSTRUCT(&ompi_errclass_spawn, ompi_errclass_t); - ompi_errclass_spawn.cls = MPI_ERR_SPAWN; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_SPAWN, &ompi_errclass_spawn); - - OBJ_CONSTRUCT(&ompi_errclass_unsupported_datarep, ompi_errclass_t); - ompi_errclass_unsupported_datarep.cls = MPI_ERR_UNSUPPORTED_DATAREP; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_UNSUPPORTED_DATAREP, - &ompi_errclass_unsupported_datarep); - - OBJ_CONSTRUCT(&ompi_errclass_unsupported_operation, ompi_errclass_t); - ompi_errclass_unsupported_operation.cls = MPI_ERR_UNSUPPORTED_OPERATION; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_UNSUPPORTED_OPERATION, - &ompi_errclass_unsupported_operation); - - OBJ_CONSTRUCT(&ompi_errclass_win, ompi_errclass_t); - ompi_errclass_win.cls = MPI_ERR_WIN; - ompi_pointer_array_set_item(&ompi_errclasses, MPI_ERR_WIN, &ompi_errclass_win); - - ompi_errclass_lastused=MPI_ERR_WIN+1; - ompi_errclass_lastpredefined=MPI_ERR_WIN+1; - return OMPI_SUCCESS; -} - -int ompi_errclass_finalize(void) -{ - int i; - ompi_errclass_t *errc; - - for (i=ompi_errclass_lastpredefined; i < ompi_errclass_lastused; i++) { - /* - * Release user defined error classes - */ - errc = (ompi_errclass_t *)ompi_pointer_array_get_item(&ompi_errclasses, i); - OBJ_RELEASE (errc); - } - - OBJ_DESTRUCT(&ompi_errclass_success); - OBJ_DESTRUCT(&ompi_errclass_buffer); - OBJ_DESTRUCT(&ompi_errclass_count); - OBJ_DESTRUCT(&ompi_errclass_type); - OBJ_DESTRUCT(&ompi_errclass_tag); - OBJ_DESTRUCT(&ompi_errclass_comm); - OBJ_DESTRUCT(&ompi_errclass_rank); - OBJ_DESTRUCT(&ompi_errclass_request); - OBJ_DESTRUCT(&ompi_errclass_root); - OBJ_DESTRUCT(&ompi_errclass_group); - OBJ_DESTRUCT(&ompi_errclass_op); - OBJ_DESTRUCT(&ompi_errclass_topology); - OBJ_DESTRUCT(&ompi_errclass_dims); - OBJ_DESTRUCT(&ompi_errclass_arg); - OBJ_DESTRUCT(&ompi_errclass_unknown); - OBJ_DESTRUCT(&ompi_errclass_truncate); - OBJ_DESTRUCT(&ompi_errclass_other); - OBJ_DESTRUCT(&ompi_errclass_intern); - OBJ_DESTRUCT(&ompi_errclass_in_status); - OBJ_DESTRUCT(&ompi_errclass_pending); - OBJ_DESTRUCT(&ompi_errclass_access); - OBJ_DESTRUCT(&ompi_errclass_amode); - OBJ_DESTRUCT(&ompi_errclass_assert); - OBJ_DESTRUCT(&ompi_errclass_bad_file); - OBJ_DESTRUCT(&ompi_errclass_base); - OBJ_DESTRUCT(&ompi_errclass_conversion); - OBJ_DESTRUCT(&ompi_errclass_disp); - OBJ_DESTRUCT(&ompi_errclass_dup_datarep); - OBJ_DESTRUCT(&ompi_errclass_file_exists); - OBJ_DESTRUCT(&ompi_errclass_file_in_use); - OBJ_DESTRUCT(&ompi_errclass_file); - OBJ_DESTRUCT(&ompi_errclass_info_key); - OBJ_DESTRUCT(&ompi_errclass_info_nokey); - OBJ_DESTRUCT(&ompi_errclass_info_value); - OBJ_DESTRUCT(&ompi_errclass_info); - OBJ_DESTRUCT(&ompi_errclass_io); - OBJ_DESTRUCT(&ompi_errclass_keyval); - OBJ_DESTRUCT(&ompi_errclass_locktype); - OBJ_DESTRUCT(&ompi_errclass_name); - OBJ_DESTRUCT(&ompi_errclass_no_mem); - OBJ_DESTRUCT(&ompi_errclass_not_same); - OBJ_DESTRUCT(&ompi_errclass_no_space); - OBJ_DESTRUCT(&ompi_errclass_no_such_file); - OBJ_DESTRUCT(&ompi_errclass_port); - OBJ_DESTRUCT(&ompi_errclass_quota); - OBJ_DESTRUCT(&ompi_errclass_read_only); - OBJ_DESTRUCT(&ompi_errclass_rma_conflict); - OBJ_DESTRUCT(&ompi_errclass_rma_sync); - OBJ_DESTRUCT(&ompi_errclass_service); - OBJ_DESTRUCT(&ompi_errclass_size); - OBJ_DESTRUCT(&ompi_errclass_spawn); - OBJ_DESTRUCT(&ompi_errclass_unsupported_datarep); - OBJ_DESTRUCT(&ompi_errclass_unsupported_operation); - OBJ_DESTRUCT(&ompi_errclass_win); - - OBJ_DESTRUCT(&ompi_errclasses); - return OMPI_SUCCESS; -} - -int ompi_errclass_add(void) -{ - ompi_errclass_t *newerrclass; - - newerrclass = OBJ_NEW(ompi_errclass_t); - newerrclass->cls = ompi_errclass_lastused; - ompi_errclass_lastused++; - - /* Now need to reset the MPI_LASTUSEDCODE attribute on - MPI_COMM_WORLD */ - - - - ompi_pointer_array_set_item(&ompi_errclasses, newerrclass->cls, newerrclass); - return OMPI_SUCCESS; -} - -static void ompi_errclass_construct(ompi_errclass_t *errclass) -{ - errclass->cls = MPI_UNDEFINED; - return; -} - -static void ompi_errclass_destruct(ompi_errclass_t *errclass) -{ - ompi_pointer_array_set_item(&ompi_errclasses, errclass->cls, NULL); - return; -} diff --git a/ompi/errhandler/errclass.h b/ompi/errhandler/errclass.h deleted file mode 100644 index b289d2ace5..0000000000 --- a/ompi/errhandler/errclass.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** @file **/ - -#ifndef OMPI_ERRCLASS_H -#define OMPI_ERRCLASS_H - -#include "ompi_config.h" - -#include "mpi.h" -#include "opal/class/opal_object.h" -#include "ompi/class/ompi_pointer_array.h" - -#if defined(c_plusplus) || defined(__cplusplus) -extern "C" { -#endif - -/** - * Back-end type for MPI error class. It is close - * to trivial. - */ -struct ompi_errclass_t { - opal_object_t super; - int cls; -}; -typedef struct ompi_errclass_t ompi_errclass_t; - -OMPI_DECLSPEC extern ompi_pointer_array_t ompi_errclasses; -OMPI_DECLSPEC extern int ompi_errclass_lastused; -/** - * Check for a valid error class - */ -static inline bool ompi_errclass_is_invalid(int errclass) -{ - if ( errclass >= 0 && errclass < ompi_errclass_lastused ) - return 0; - else - return 1; -} - - - - /** - * Initialize the error classes - * - * @returns OMPI_SUCCESS Upon success - * @returns OMPI_ERROR Otherwise - * - * Invoked from ompi_mpi_init(); sets up all static MPI error classes, - */ - int ompi_errclass_init(void); - - /** - * Finalize the error classes. - * - * @returns OMPI_SUCCESS Always - * - * Invokes from ompi_mpi_finalize(); tears down the error class array. - */ - int ompi_errclass_finalize(void); - - /** - * Add an error class - * - * @param: error class to which this new error code belongs to - * - * @returns the new error class on SUCCESS (>0) - * @returns OMPI_ERROR otherwise - * - */ - int ompi_errclass_add (void); - -#if defined(c_plusplus) || defined(__cplusplus) -} -#endif - - -#endif /* OMPI_ERRCLASS_H */ diff --git a/ompi/errhandler/errcode.c b/ompi/errhandler/errcode.c index 91411ec8f5..b61dc8adea 100644 --- a/ompi/errhandler/errcode.c +++ b/ompi/errhandler/errcode.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -517,14 +518,26 @@ int ompi_mpi_errcode_add(int errclass ) ompi_pointer_array_set_item(&ompi_mpi_errcodes, newerrcode->code, newerrcode); ompi_mpi_errcode_lastused++; - return OMPI_SUCCESS; + return newerrcode->code; } -int ompi_mpi_errcode_add_string(int errcode, char *errstring, int len) +int ompi_mpi_errclass_add(void) +{ + ompi_mpi_errcode_t *newerrcode; + + newerrcode = OBJ_NEW(ompi_mpi_errcode_t); + newerrcode->cls = ompi_mpi_errcode_lastused; + ompi_pointer_array_set_item(&ompi_mpi_errcodes, newerrcode->cls, newerrcode); + + ompi_mpi_errcode_lastused++; + return newerrcode->cls; +} + +int ompi_mpi_errnum_add_string(int errnum, char *errstring, int len) { ompi_mpi_errcode_t *errcodep; - errcodep = (ompi_mpi_errcode_t *)ompi_pointer_array_get_item(&ompi_mpi_errcodes, errcode); + errcodep = (ompi_mpi_errcode_t *)ompi_pointer_array_get_item(&ompi_mpi_errcodes, errnum); if ( NULL == errcodep ) { return OMPI_ERROR; } diff --git a/ompi/errhandler/errcode.h b/ompi/errhandler/errcode.h index f4ab90fb15..d70a3167d3 100644 --- a/ompi/errhandler/errcode.h +++ b/ompi/errhandler/errcode.h @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,12 +32,19 @@ extern "C" { #endif /** - * Back-end type for MPI error codes + * Back-end type for MPI error codes. + * Please note: + * if code == MPI_UNDEFINED, than the according structure + * represents an error class. + * if cls == MPI_UNDEFINED, than the according structure + * represents an error code. + * For the predefined error codes and classes, code and + * cls are both set to the according value. */ struct ompi_mpi_errcode_t { opal_object_t super; int code; - int cls; + int cls; char errstring[MPI_MAX_ERROR_STRING]; }; typedef struct ompi_mpi_errcode_t ompi_mpi_errcode_t; @@ -67,19 +75,20 @@ static inline int ompi_mpi_errcode_get_class (int errcode) err = (ompi_mpi_errcode_t *)ompi_pointer_array_get_item(&ompi_mpi_errcodes, errcode); /* If we get a bogus errcode, return MPI_ERR_UNKNOWN */ if (NULL != err) { - return err->cls; - } else { - return ompi_err_unknown.cls; + if ( err->code != MPI_UNDEFINED ) { + return err->cls; + } } + return ompi_err_unknown.cls; } /** * Return the error string */ -static inline char* ompi_mpi_errcode_get_string (int errcode) +static inline char* ompi_mpi_errnum_get_string (int errnum) { ompi_mpi_errcode_t *err; - err = (ompi_mpi_errcode_t *)ompi_pointer_array_get_item(&ompi_mpi_errcodes, errcode); + err = (ompi_mpi_errcode_t *)ompi_pointer_array_get_item(&ompi_mpi_errcodes, errnum); /* If we get a bogus errcode, return a string indicating that this truly should not happen */ if (NULL != err) { @@ -120,6 +129,17 @@ static inline char* ompi_mpi_errcode_get_string (int errcode) */ int ompi_mpi_errcode_add (int errclass); + /** + * Add an error class + * + * @param: none + * + * @returns the new error class on SUCCESS (>0) + * @returns OMPI_ERROR otherwise + * + */ + int ompi_mpi_errclass_add (void); + /** * Add an error string to an error code * @@ -130,7 +150,7 @@ static inline char* ompi_mpi_errcode_get_string (int errcode) * @returns OMPI_SUCCESS on success * @returns OMPI_ERROR on error */ - int ompi_mpi_errcode_add_string (int errcode, char* string, int len); + int ompi_mpi_errnum_add_string (int errnum, char* string, int len); #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/ompi/errhandler/errhandler_predefined.c b/ompi/errhandler/errhandler_predefined.c index e2207279b2..a97bab2faa 100644 --- a/ompi/errhandler/errhandler_predefined.c +++ b/ompi/errhandler/errhandler_predefined.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -182,7 +183,7 @@ static void backend_fatal(char *type, struct ompi_communicator_t *comm, } if (NULL != error_code) { - char *tmp = ompi_mpi_errcode_get_string(*error_code); + char *tmp = ompi_mpi_errnum_get_string(*error_code); if (NULL != tmp) { out("*** %s\n", tmp); } else { diff --git a/ompi/mpi/c/add_error_class.c b/ompi/mpi/c/add_error_class.c index 131bbabfa1..a5a98da1a5 100644 --- a/ompi/mpi/c/add_error_class.c +++ b/ompi/mpi/c/add_error_class.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,7 +20,7 @@ #include #include "ompi/mpi/c/bindings.h" -#include "ompi/errhandler/errclass.h" +#include "ompi/errhandler/errcode.h" #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES #pragma weak MPI_Add_error_class = PMPI_Add_error_class @@ -40,7 +41,7 @@ int MPI_Add_error_class(int *errorclass) OMPI_ERR_INIT_FINALIZE(FUNC_NAME); } - err_class = ompi_errclass_add(); + err_class = ompi_mpi_errclass_add(); if ( 0 > err_class ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN, FUNC_NAME); diff --git a/ompi/mpi/c/add_error_code.c b/ompi/mpi/c/add_error_code.c index f0d6c50b90..b9bebb1016 100644 --- a/ompi/mpi/c/add_error_code.c +++ b/ompi/mpi/c/add_error_code.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,7 +21,6 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/errhandler/errcode.h" -#include "ompi/errhandler/errclass.h" #if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES #pragma weak MPI_Add_error_code = PMPI_Add_error_code @@ -40,7 +40,7 @@ int MPI_Add_error_code(int errorclass, int *errorcode) if ( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if ( ompi_errclass_is_invalid(errorclass) ) + if ( ompi_mpi_errcode_is_invalid(errorclass) ) return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); diff --git a/ompi/mpi/c/add_error_string.c b/ompi/mpi/c/add_error_string.c index ff5862564b..cea6dc51cd 100644 --- a/ompi/mpi/c/add_error_string.c +++ b/ompi/mpi/c/add_error_string.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int MPI_Add_error_string(int errorcode, char *string) FUNC_NAME); } - rc = ompi_mpi_errcode_add_string (errorcode, string, (int)(strlen(string)+1)); + rc = ompi_mpi_errnum_add_string (errorcode, string, (int)(strlen(string)+1)); if ( OMPI_SUCCESS != rc ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN, FUNC_NAME); diff --git a/ompi/mpi/c/error_string.c b/ompi/mpi/c/error_string.c index aa12b3cb1f..c1dcce215e 100644 --- a/ompi/mpi/c/error_string.c +++ b/ompi/mpi/c/error_string.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2006 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +46,7 @@ int MPI_Error_string(int errorcode, char *string, int *resultlen) } } - tmpstring = ompi_mpi_errcode_get_string (errorcode); + tmpstring = ompi_mpi_errnum_get_string (errorcode); strcpy(string, tmpstring); *resultlen = (int)strlen(string); diff --git a/ompi/runtime/ompi_mpi_finalize.c b/ompi/runtime/ompi_mpi_finalize.c index bf98a99726..bf4f3948fc 100644 --- a/ompi/runtime/ompi_mpi_finalize.c +++ b/ompi/runtime/ompi_mpi_finalize.c @@ -12,6 +12,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2006 University of Houston. All rights reserved. * * $COPYRIGHT$ * @@ -56,7 +57,6 @@ #include "ompi/constants.h" #include "ompi/group/group.h" #include "ompi/errhandler/errcode.h" -#include "ompi/errhandler/errclass.h" #include "ompi/communicator/communicator.h" #include "ompi/datatype/datatype.h" #include "ompi/op/op.h" @@ -215,11 +215,6 @@ int ompi_mpi_finalize(void) return ret; } - /* free error class resources */ - if (OMPI_SUCCESS != (ret = ompi_errclass_finalize())) { - return ret; - } - /* free error code resources */ if (OMPI_SUCCESS != (ret = ompi_mpi_errcode_finalize())) { return ret; diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index b1d99332a1..e54e0bfd72 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -12,6 +12,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2006 University of Houston. All rights reserved. * * $COPYRIGHT$ * @@ -59,7 +60,6 @@ #include "ompi/group/group.h" #include "ompi/info/info.h" #include "ompi/errhandler/errcode.h" -#include "ompi/errhandler/errclass.h" #include "ompi/request/request.h" #include "ompi/op/op.h" #include "ompi/file/file.h" @@ -438,12 +438,6 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) error = "ompi_mpi_errcode_init() failed"; goto error; } - - /* initialize error classes */ - if (OMPI_SUCCESS != (ret = ompi_errclass_init())) { - error = "ompi_errclass_init() failed"; - goto error; - } /* initialize internal error codes */ if (OMPI_SUCCESS != (ret = ompi_errcode_intern_init())) {