Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] [OMPI svn] svn:open-mpi r25323
From: Ralph Castain (rhc_at_[hidden])
Date: 2011-10-19 13:32:27


I've been wrestling with something from this commit, and I'm unsure of the right answer. So please consider this a general design question for the community.

This commit removes all the OMPI <-> ORTE equivalent constants - i.e., we used to declare OMPI-prefixed equivalents to every ORTE-prefixed constant. I understand the thinking (or at least, what I suspect was the thought), but it creates an issue.

Suppose I have an ompi-level function (A) that calls another ompi-level function (B). Invisible to A is that B calls an orte-level function. B dutifully checks the error return from the orte-level function against an ORTE-prefixed constant.

However, if that return isn't "success", what does B return up to A? It cannot return the OMPI equivalent to the orte error constant because it no longer exists. It could return the orte error code, but A has no way of knowing it is going to get a non-OMPI constant, and therefore won't be able to understand it - it will be an "unrecognized error".

I guess one option is to require that B "translate" the return code and pass some OMPI error up the chain, but this prevents anything upwards from understanding the nature of the problem and potentially taking corrective and/or alternative action. Seems awfully limiting, as most of the time the only option will be the vanilla "OMPI_ERROR".

Thoughts?

On Oct 18, 2011, at 9:51 PM, bosilca_at_[hidden] wrote:

> Author: bosilca
> Date: 2011-10-18 23:51:53 EDT (Tue, 18 Oct 2011)
> New Revision: 25323
> URL: https://svn.open-mpi.org/trac/ompi/changeset/25323
>
> Log:
> Cleanup the error codes. Get rid of all the useless ones, and
> mark the distinction between ORTE and OMPI errors.
>
> Text files modified:
> trunk/ompi/errhandler/errcode-internal.c | 32 ---------------
> trunk/ompi/include/ompi/constants.h | 80 +++++++++++++++++-----------------------
> trunk/ompi/mca/common/sm/common_sm_rml.c | 6 +-
> trunk/ompi/mca/pml/dr/pml_dr_sendreq.c | 5 --
> trunk/ompi/mpiext/cr/c/quiesce_start.c | 5 ++
> 5 files changed, 43 insertions(+), 85 deletions(-)
>
> Modified: trunk/ompi/errhandler/errcode-internal.c
> ==============================================================================
> --- trunk/ompi/errhandler/errcode-internal.c (original)
> +++ trunk/ompi/errhandler/errcode-internal.c 2011-10-18 23:51:53 EDT (Tue, 18 Oct 2011)
> @@ -3,7 +3,7 @@
> * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
> * University Research and Technology
> * Corporation. All rights reserved.
> - * Copyright (c) 2004-2007 The University of Tennessee and The University
> + * Copyright (c) 2004-2011 The University of Tennessee and The University
> * of Tennessee Research Foundation. All rights
> * reserved.
> * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
> @@ -35,9 +35,6 @@
> static ompi_errcode_intern_t ompi_err_temp_out_of_resource;
> static ompi_errcode_intern_t ompi_err_resource_busy;
> static ompi_errcode_intern_t ompi_err_bad_param;
> -static ompi_errcode_intern_t ompi_err_recv_less_than_posted;
> -static ompi_errcode_intern_t ompi_err_recv_more_than_posted;
> -static ompi_errcode_intern_t ompi_err_no_match_yet;
> static ompi_errcode_intern_t ompi_err_fatal;
> static ompi_errcode_intern_t ompi_err_not_implemented;
> static ompi_errcode_intern_t ompi_err_not_supported;
> @@ -115,30 +112,6 @@
> opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_bad_param.index,
> &ompi_err_bad_param);
>
> - OBJ_CONSTRUCT(&ompi_err_recv_less_than_posted, ompi_errcode_intern_t);
> - ompi_err_recv_less_than_posted.code = OMPI_ERR_RECV_LESS_THAN_POSTED;
> - ompi_err_recv_less_than_posted.mpi_code = MPI_SUCCESS;
> - ompi_err_recv_less_than_posted.index = pos++;
> - strncpy(ompi_err_recv_less_than_posted.errstring, "OMPI_ERR_RECV_LESS_THAN_POSTED", OMPI_MAX_ERROR_STRING);
> - opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_recv_less_than_posted.index,
> - &ompi_err_recv_less_than_posted);
> -
> - OBJ_CONSTRUCT(&ompi_err_recv_more_than_posted, ompi_errcode_intern_t);
> - ompi_err_recv_more_than_posted.code = OMPI_ERR_RECV_MORE_THAN_POSTED;
> - ompi_err_recv_more_than_posted.mpi_code = MPI_ERR_TRUNCATE;
> - ompi_err_recv_more_than_posted.index = pos++;
> - strncpy(ompi_err_recv_more_than_posted.errstring, "OMPI_ERR_RECV_MORE_THAN_POSTED", OMPI_MAX_ERROR_STRING);
> - opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_recv_more_than_posted.index,
> - &ompi_err_recv_more_than_posted);
> -
> - OBJ_CONSTRUCT(&ompi_err_no_match_yet, ompi_errcode_intern_t);
> - ompi_err_no_match_yet.code = OMPI_ERR_NO_MATCH_YET;
> - ompi_err_no_match_yet.mpi_code = MPI_ERR_PENDING;
> - ompi_err_no_match_yet.index = pos++;
> - strncpy(ompi_err_no_match_yet.errstring, "OMPI_ERR_NO_MATCH_YET", OMPI_MAX_ERROR_STRING);
> - opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_no_match_yet.index,
> - &ompi_err_no_match_yet);
> -
> OBJ_CONSTRUCT(&ompi_err_fatal, ompi_errcode_intern_t);
> ompi_err_fatal.code = OMPI_ERR_FATAL;
> ompi_err_fatal.mpi_code = MPI_ERR_INTERN;
> @@ -232,9 +205,6 @@
> OBJ_DESTRUCT(&ompi_err_temp_out_of_resource);
> OBJ_DESTRUCT(&ompi_err_resource_busy);
> OBJ_DESTRUCT(&ompi_err_bad_param);
> - OBJ_DESTRUCT(&ompi_err_recv_less_than_posted);
> - OBJ_DESTRUCT(&ompi_err_recv_more_than_posted);
> - OBJ_DESTRUCT(&ompi_err_no_match_yet);
> OBJ_DESTRUCT(&ompi_err_fatal);
> OBJ_DESTRUCT(&ompi_err_not_implemented);
> OBJ_DESTRUCT(&ompi_err_not_supported);
>
> Modified: trunk/ompi/include/ompi/constants.h
> ==============================================================================
> --- trunk/ompi/include/ompi/constants.h (original)
> +++ trunk/ompi/include/ompi/constants.h 2011-10-18 23:51:53 EDT (Tue, 18 Oct 2011)
> @@ -19,61 +19,49 @@
> #ifndef OMPI_CONSTANTS_H
> #define OMPI_CONSTANTS_H
>
> -#include "orte/constants.h"
> +#include "opal/constants.h"
>
> -#define OMPI_ERR_BASE ORTE_ERR_MAX
> +#define OMPI_ERR_BASE OPAL_ERR_MAX
>
> /* error codes */
> enum {
> /* Error codes inherited from ORTE/OPAL. Still enum values so
> that we might get nice debugger help */
> - OMPI_SUCCESS = OPAL_SUCCESS,
> + OMPI_SUCCESS = OPAL_SUCCESS,
> + OMPI_ERROR = OPAL_ERROR,
> + OMPI_ERR_OUT_OF_RESOURCE = OPAL_ERR_OUT_OF_RESOURCE,
> + OMPI_ERR_TEMP_OUT_OF_RESOURCE = OPAL_ERR_TEMP_OUT_OF_RESOURCE,
> + OMPI_ERR_RESOURCE_BUSY = OPAL_ERR_RESOURCE_BUSY,
> + OMPI_ERR_BAD_PARAM = OPAL_ERR_BAD_PARAM,
> + OMPI_ERR_FATAL = OPAL_ERR_FATAL,
> + OMPI_ERR_NOT_IMPLEMENTED = OPAL_ERR_NOT_IMPLEMENTED,
> + OMPI_ERR_NOT_SUPPORTED = OPAL_ERR_NOT_SUPPORTED,
> + OMPI_ERR_INTERUPTED = OPAL_ERR_INTERUPTED,
> + OMPI_ERR_WOULD_BLOCK = OPAL_ERR_WOULD_BLOCK,
> + OMPI_ERR_IN_ERRNO = OPAL_ERR_IN_ERRNO,
> + OMPI_ERR_UNREACH = OPAL_ERR_UNREACH,
> + OMPI_ERR_NOT_FOUND = OPAL_ERR_NOT_FOUND,
> + OMPI_EXISTS = OPAL_EXISTS, /* indicates that the specified object already exists */
> + OMPI_ERR_TIMEOUT = OPAL_ERR_TIMEOUT,
> + OMPI_ERR_NOT_AVAILABLE = OPAL_ERR_NOT_AVAILABLE,
> + OMPI_ERR_PERM = OPAL_ERR_PERM,
> + OMPI_ERR_VALUE_OUT_OF_BOUNDS = OPAL_ERR_VALUE_OUT_OF_BOUNDS,
> + OMPI_ERR_FILE_READ_FAILURE = OPAL_ERR_FILE_READ_FAILURE,
> + OMPI_ERR_FILE_WRITE_FAILURE = OPAL_ERR_FILE_WRITE_FAILURE,
> + OMPI_ERR_FILE_OPEN_FAILURE = OPAL_ERR_FILE_OPEN_FAILURE,
> + OMPI_ERR_PACK_MISMATCH = OPAL_ERR_PACK_MISMATCH,
> + OMPI_ERR_PACK_FAILURE = OPAL_ERR_PACK_FAILURE,
> + OMPI_ERR_UNPACK_FAILURE = OPAL_ERR_UNPACK_FAILURE,
> + OMPI_ERR_TYPE_MISMATCH = OPAL_ERR_TYPE_MISMATCH,
> + OMPI_ERR_UNKNOWN_DATA_TYPE = OPAL_ERR_UNKNOWN_DATA_TYPE,
> + OMPI_ERR_DATA_TYPE_REDEF = OPAL_ERR_DATA_TYPE_REDEF,
> + OMPI_ERR_DATA_OVERWRITE_ATTEMPT = OPAL_ERR_DATA_OVERWRITE_ATTEMPT,
>
> - OMPI_ERROR = OPAL_ERROR,
> - OMPI_ERR_OUT_OF_RESOURCE = OPAL_ERR_OUT_OF_RESOURCE,
> - OMPI_ERR_TEMP_OUT_OF_RESOURCE = OPAL_ERR_TEMP_OUT_OF_RESOURCE,
> - OMPI_ERR_RESOURCE_BUSY = OPAL_ERR_RESOURCE_BUSY,
> - OMPI_ERR_BAD_PARAM = OPAL_ERR_BAD_PARAM,
> - OMPI_ERR_FATAL = OPAL_ERR_FATAL,
> - OMPI_ERR_NOT_IMPLEMENTED = OPAL_ERR_NOT_IMPLEMENTED,
> - OMPI_ERR_NOT_SUPPORTED = OPAL_ERR_NOT_SUPPORTED,
> - OMPI_ERR_INTERUPTED = OPAL_ERR_INTERUPTED,
> - OMPI_ERR_WOULD_BLOCK = OPAL_ERR_WOULD_BLOCK,
> - OMPI_ERR_IN_ERRNO = OPAL_ERR_IN_ERRNO,
> - OMPI_ERR_UNREACH = OPAL_ERR_UNREACH,
> - OMPI_ERR_NOT_FOUND = OPAL_ERR_NOT_FOUND,
> - OMPI_EXISTS = OPAL_EXISTS, /* indicates that the specified object already exists */
> - OMPI_ERR_TIMEOUT = OPAL_ERR_TIMEOUT,
> - OMPI_ERR_NOT_AVAILABLE = OPAL_ERR_NOT_AVAILABLE,
> - OMPI_ERR_PERM = OPAL_ERR_PERM,
> - OMPI_ERR_VALUE_OUT_OF_BOUNDS = OPAL_ERR_VALUE_OUT_OF_BOUNDS,
> - OMPI_ERR_FILE_READ_FAILURE = OPAL_ERR_FILE_READ_FAILURE,
> - OMPI_ERR_FILE_WRITE_FAILURE = OPAL_ERR_FILE_WRITE_FAILURE,
> - OMPI_ERR_FILE_OPEN_FAILURE = OPAL_ERR_FILE_OPEN_FAILURE,
> - OMPI_ERR_PACK_MISMATCH = OPAL_ERR_PACK_MISMATCH,
> - OMPI_ERR_PACK_FAILURE = OPAL_ERR_PACK_FAILURE,
> - OMPI_ERR_UNPACK_FAILURE = OPAL_ERR_UNPACK_FAILURE,
> - OMPI_ERR_UNPACK_INADEQUATE_SPACE = ORTE_ERR_UNPACK_INADEQUATE_SPACE,
> - OMPI_ERR_UNPACK_READ_PAST_END_OF_BUFFER = ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER,
> - OMPI_ERR_TYPE_MISMATCH = OPAL_ERR_TYPE_MISMATCH,
> - OMPI_ERR_UNKNOWN_DATA_TYPE = OPAL_ERR_UNKNOWN_DATA_TYPE,
> - OMPI_ERR_DATA_TYPE_REDEF = OPAL_ERR_DATA_TYPE_REDEF,
> - OMPI_ERR_DATA_OVERWRITE_ATTEMPT = OPAL_ERR_DATA_OVERWRITE_ATTEMPT,
> -
> - OMPI_ERR_RECV_LESS_THAN_POSTED = ORTE_ERR_RECV_LESS_THAN_POSTED,
> - OMPI_ERR_RECV_MORE_THAN_POSTED = ORTE_ERR_RECV_MORE_THAN_POSTED,
> - OMPI_ERR_NO_MATCH_YET = ORTE_ERR_NO_MATCH_YET,
> - OMPI_ERR_BUFFER = OPAL_ERR_BUFFER,
> - OMPI_ERR_REQUEST = ORTE_ERR_REQUEST,
> - OMPI_ERR_NO_CONNECTION_ALLOWED = ORTE_ERR_NO_CONNECTION_ALLOWED,
> - OMPI_ERR_CONNECTION_REFUSED = ORTE_ERR_CONNECTION_REFUSED ,
> - OMPI_ERR_CONNECTION_FAILED = ORTE_ERR_CONNECTION_FAILED,
> - OMPI_ERR_COMM_FAILURE = ORTE_ERR_COMM_FAILURE,
> - OMPI_ERR_COMPARE_FAILURE = ORTE_ERR_COMPARE_FAILURE,
> - OMPI_ERR_COPY_FAILURE = ORTE_ERR_COPY_FAILURE
> + OMPI_ERR_BUFFER = OPAL_ERR_BUFFER,
> + OMPI_ERR_REQUEST = OMPI_ERR_BASE + 1
> };
>
> -#define OMPI_ERR_MAX (OMPI_ERR_BASE - 1)
> +#define OMPI_ERR_MAX (OMPI_ERR_BASE + 2)
>
> #endif /* OMPI_CONSTANTS_H */
>
>
> Modified: trunk/ompi/mca/common/sm/common_sm_rml.c
> ==============================================================================
> --- trunk/ompi/mca/common/sm/common_sm_rml.c (original)
> +++ trunk/ompi/mca/common/sm/common_sm_rml.c 2011-10-18 23:51:53 EDT (Tue, 18 Oct 2011)
> @@ -2,7 +2,7 @@
> * 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
> + * Copyright (c) 2004-2011 The University of Tennessee and The University
> * of Tennessee Research Foundation. All rights
> * reserved.
> * Copyright (c) 2004-2009 High Performance Computing Center Stuttgart,
> @@ -82,7 +82,7 @@
> iovrc = orte_rml.send(&(procs[p]->proc_name), iov,
> MCA_COMMON_SM_RML_MSG_LEN, tag, 0);
> if ((ssize_t)(iov[0].iov_len + iov[1].iov_len) > iovrc) {
> - ORTE_ERROR_LOG(OMPI_ERR_COMM_FAILURE);
> + ORTE_ERROR_LOG(ORTE_ERR_COMM_FAILURE);
> opal_progress_event_users_decrement();
> rc = OMPI_ERROR;
> goto out;
> @@ -123,7 +123,7 @@
> MCA_COMMON_SM_RML_MSG_LEN, tag, 0);
> opal_progress_event_users_decrement();
> if (iovrc < 0) {
> - ORTE_ERROR_LOG(OMPI_ERR_RECV_LESS_THAN_POSTED);
> + ORTE_ERROR_LOG(ORTE_ERR_RECV_LESS_THAN_POSTED);
> rc = OMPI_ERROR;
> goto out;
> }
>
> Modified: trunk/ompi/mca/pml/dr/pml_dr_sendreq.c
> ==============================================================================
> --- trunk/ompi/mca/pml/dr/pml_dr_sendreq.c (original)
> +++ trunk/ompi/mca/pml/dr/pml_dr_sendreq.c 2011-10-18 23:51:53 EDT (Tue, 18 Oct 2011)
> @@ -2,7 +2,7 @@
> * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
> * University Research and Technology
> * Corporation. All rights reserved.
> - * Copyright (c) 2004-2007 The University of Tennessee and The University
> + * Copyright (c) 2004-2011 The University of Tennessee and The University
> * of Tennessee Research Foundation. All rights
> * reserved.
> * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
> @@ -104,8 +104,6 @@
>
> switch(OPAL_SOS_GET_ERROR_CODE(status)) {
> case OMPI_ERR_UNREACH:
> - case OMPI_ERR_CONNECTION_FAILED:
> - case OMPI_ERR_CONNECTION_REFUSED:
> /**
> * peer is no longer reachable through this btl
> */
> @@ -113,7 +111,6 @@
> break;
>
> case OMPI_ERR_FATAL:
> - case OMPI_ERR_COMM_FAILURE:
> /**
> * btl is no longer available
> */
>
> Modified: trunk/ompi/mpiext/cr/c/quiesce_start.c
> ==============================================================================
> --- trunk/ompi/mpiext/cr/c/quiesce_start.c (original)
> +++ trunk/ompi/mpiext/cr/c/quiesce_start.c 2011-10-18 23:51:53 EDT (Tue, 18 Oct 2011)
> @@ -2,6 +2,9 @@
> * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
> * University Research and Technology
> * Corporation. All rights reserved.
> + * Copyright (c) 2011 The University of Tennessee and The University
> + * of Tennessee Research Foundation. All rights
> + * reserved.
> * $COPYRIGHT$
> *
> * Additional copyrights may follow
> @@ -205,6 +208,6 @@
> info_char = NULL;
> }
>
> - return ORTE_SUCCESS;
> + return OMPI_SUCCESS;
> }
> #endif
> _______________________________________________
> svn mailing list
> svn_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/svn