2007-12-21 09:02:00 +03:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
2004-06-18 21:41:06 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2011-10-19 07:51:53 +04:00
|
|
|
* Copyright (c) 2004-2011 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-06-18 21:41:06 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "mpi.h"
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/errhandler/errcode-internal.h"
|
2004-06-18 21:41:06 +04:00
|
|
|
|
|
|
|
/* Table holding all error codes */
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_t ompi_errcodes_intern;
|
2004-06-18 21:41:06 +04:00
|
|
|
int ompi_errcode_intern_lastused=0;
|
|
|
|
|
2004-10-20 18:08:27 +04:00
|
|
|
static ompi_errcode_intern_t ompi_success_intern;
|
|
|
|
static ompi_errcode_intern_t ompi_error;
|
|
|
|
static ompi_errcode_intern_t ompi_err_out_of_resource;
|
|
|
|
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_fatal;
|
|
|
|
static ompi_errcode_intern_t ompi_err_not_implemented;
|
|
|
|
static ompi_errcode_intern_t ompi_err_not_supported;
|
|
|
|
static ompi_errcode_intern_t ompi_err_interupted;
|
|
|
|
static ompi_errcode_intern_t ompi_err_would_block;
|
|
|
|
static ompi_errcode_intern_t ompi_err_in_errno;
|
|
|
|
static ompi_errcode_intern_t ompi_err_unreach;
|
|
|
|
static ompi_errcode_intern_t ompi_err_not_found;
|
|
|
|
static ompi_errcode_intern_t ompi_err_request;
|
|
|
|
static ompi_errcode_intern_t ompi_err_buffer;
|
2014-03-12 03:45:23 +04:00
|
|
|
static ompi_errcode_intern_t ompi_err_rma_sync;
|
2004-06-18 21:41:06 +04:00
|
|
|
|
|
|
|
static void ompi_errcode_intern_construct(ompi_errcode_intern_t* errcode);
|
|
|
|
static void ompi_errcode_intern_destruct(ompi_errcode_intern_t* errcode);
|
|
|
|
|
2005-07-03 20:06:07 +04:00
|
|
|
OBJ_CLASS_INSTANCE(ompi_errcode_intern_t,opal_object_t,ompi_errcode_intern_construct, ompi_errcode_intern_destruct);
|
2004-06-18 21:41:06 +04:00
|
|
|
|
|
|
|
int ompi_errcode_intern_init (void)
|
|
|
|
{
|
|
|
|
int pos=0;
|
|
|
|
/* Initialize the pointer array, which will hold the references to
|
|
|
|
the error objects */
|
2007-12-21 09:02:00 +03:00
|
|
|
OBJ_CONSTRUCT(&ompi_errcodes_intern, opal_pointer_array_t);
|
|
|
|
if( OPAL_SUCCESS != opal_pointer_array_init(&ompi_errcodes_intern,
|
2009-06-01 23:02:34 +04:00
|
|
|
0, OMPI_FORTRAN_HANDLE_MAX, 64) ) {
|
2007-12-21 09:02:00 +03:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2004-06-18 21:41:06 +04:00
|
|
|
|
|
|
|
/* Initialize now each predefined error code and register
|
|
|
|
it in the pointer-array. */
|
|
|
|
OBJ_CONSTRUCT(&ompi_success_intern, ompi_errcode_intern_t);
|
|
|
|
ompi_success_intern.code = OMPI_SUCCESS;
|
|
|
|
ompi_success_intern.mpi_code = MPI_SUCCESS;
|
|
|
|
ompi_success_intern.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_success_intern.errstring, "OMPI_SUCCESS", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_success_intern.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_success_intern);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_error, ompi_errcode_intern_t);
|
|
|
|
ompi_error.code = OMPI_ERROR;
|
|
|
|
ompi_error.mpi_code = MPI_ERR_OTHER;
|
|
|
|
ompi_error.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_error.errstring, "OMPI_ERROR", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_error.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_error);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_out_of_resource, ompi_errcode_intern_t);
|
|
|
|
ompi_err_out_of_resource.code = OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
ompi_err_out_of_resource.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_out_of_resource.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_out_of_resource.errstring, "OMPI_ERR_OUT_OF_RESOURCE", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_out_of_resource.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_out_of_resource);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_temp_out_of_resource, ompi_errcode_intern_t);
|
|
|
|
ompi_err_temp_out_of_resource.code = OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
|
|
|
ompi_err_temp_out_of_resource.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_temp_out_of_resource.index = pos++;
|
2012-01-26 08:22:00 +04:00
|
|
|
strncpy(ompi_err_temp_out_of_resource.errstring, "OMPI_ERR_TEMP_OUT_OF_RESOURCE", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_temp_out_of_resource.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_temp_out_of_resource);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_resource_busy, ompi_errcode_intern_t);
|
|
|
|
ompi_err_resource_busy.code = OMPI_ERR_RESOURCE_BUSY;
|
|
|
|
ompi_err_resource_busy.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_resource_busy.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_resource_busy.errstring, "OMPI_ERR_RESOURCE_BUSY", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_resource_busy.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_resource_busy);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_bad_param, ompi_errcode_intern_t);
|
|
|
|
ompi_err_bad_param.code = OMPI_ERR_BAD_PARAM;
|
|
|
|
ompi_err_bad_param.mpi_code = MPI_ERR_ARG;
|
|
|
|
ompi_err_bad_param.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_bad_param.errstring, "OMPI_ERR_BAD_PARAM", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_bad_param.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_bad_param);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_fatal, ompi_errcode_intern_t);
|
|
|
|
ompi_err_fatal.code = OMPI_ERR_FATAL;
|
|
|
|
ompi_err_fatal.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_fatal.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_fatal.errstring, "OMPI_ERR_FATAL", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_fatal.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_fatal);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_not_implemented, ompi_errcode_intern_t);
|
|
|
|
ompi_err_not_implemented.code = OMPI_ERR_NOT_IMPLEMENTED;
|
|
|
|
ompi_err_not_implemented.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_not_implemented.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_not_implemented.errstring, "OMPI_ERR_NOT_IMPLEMENTED", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_not_implemented.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_not_implemented);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_not_supported, ompi_errcode_intern_t);
|
|
|
|
ompi_err_not_supported.code = OMPI_ERR_NOT_SUPPORTED;
|
|
|
|
ompi_err_not_supported.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_not_supported.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_not_supported.errstring, "OMPI_ERR_NOT_SUPPORTED", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_not_supported.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_not_supported);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_interupted, ompi_errcode_intern_t);
|
|
|
|
ompi_err_interupted.code = OMPI_ERR_INTERUPTED;
|
|
|
|
ompi_err_interupted.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_interupted.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_interupted.errstring, "OMPI_ERR_INTERUPTED", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_interupted.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_interupted);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_would_block, ompi_errcode_intern_t);
|
2004-06-25 01:09:55 +04:00
|
|
|
ompi_err_would_block.code = OMPI_ERR_WOULD_BLOCK;
|
2004-06-18 21:41:06 +04:00
|
|
|
ompi_err_would_block.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_would_block.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_would_block.errstring, "OMPI_ERR_WOULD_BLOCK", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_would_block.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_would_block);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_in_errno, ompi_errcode_intern_t);
|
|
|
|
ompi_err_in_errno.code = OMPI_ERR_IN_ERRNO;
|
|
|
|
ompi_err_in_errno.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_in_errno.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_in_errno.errstring, "OMPI_ERR_IN_ERRNO", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_in_errno.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_in_errno);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_unreach, ompi_errcode_intern_t);
|
|
|
|
ompi_err_unreach.code = OMPI_ERR_UNREACH;
|
|
|
|
ompi_err_unreach.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_unreach.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_unreach.errstring, "OMPI_ERR_UNREACH", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_unreach.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_unreach);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_not_found, ompi_errcode_intern_t);
|
|
|
|
ompi_err_not_found.code = OMPI_ERR_NOT_FOUND;
|
|
|
|
ompi_err_not_found.mpi_code = MPI_ERR_INTERN;
|
|
|
|
ompi_err_not_found.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_not_found.errstring, "OMPI_ERR_NOT_FOUND", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_not_found.index,
|
2004-06-18 21:41:06 +04:00
|
|
|
&ompi_err_not_found);
|
|
|
|
|
2004-10-20 02:00:19 +04:00
|
|
|
OBJ_CONSTRUCT(&ompi_err_buffer, ompi_errcode_intern_t);
|
|
|
|
ompi_err_buffer.code = OMPI_ERR_BUFFER;
|
|
|
|
ompi_err_buffer.mpi_code = MPI_ERR_BUFFER;
|
|
|
|
ompi_err_buffer.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_buffer.errstring, "OMPI_ERR_BUFFER", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_buffer.index,
|
2004-10-20 02:00:19 +04:00
|
|
|
&ompi_err_buffer);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_err_request, ompi_errcode_intern_t);
|
|
|
|
ompi_err_request.code = OMPI_ERR_REQUEST;
|
|
|
|
ompi_err_request.mpi_code = MPI_ERR_REQUEST;
|
|
|
|
ompi_err_request.index = pos++;
|
2007-07-30 18:44:37 +04:00
|
|
|
strncpy(ompi_err_request.errstring, "OMPI_ERR_REQUEST", OMPI_MAX_ERROR_STRING);
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_request.index,
|
2004-10-20 02:00:19 +04:00
|
|
|
&ompi_err_request);
|
|
|
|
|
2014-03-12 03:45:23 +04:00
|
|
|
OBJ_CONSTRUCT(&ompi_err_rma_sync, ompi_errcode_intern_t);
|
2014-03-12 04:21:23 +04:00
|
|
|
ompi_err_rma_sync.code = OMPI_ERR_RMA_SYNC;
|
|
|
|
ompi_err_rma_sync.mpi_code = MPI_ERR_RMA_SYNC;
|
|
|
|
ompi_err_rma_sync.index = pos++;
|
|
|
|
strncpy(ompi_err_rma_sync.errstring, "OMPI_ERR_RMA_SYNC", OMPI_MAX_ERROR_STRING);
|
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, ompi_err_rma_sync.index,
|
2014-03-12 03:45:23 +04:00
|
|
|
&ompi_err_rma_sync);
|
|
|
|
|
2004-06-18 21:41:06 +04:00
|
|
|
ompi_errcode_intern_lastused=pos;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ompi_errcode_intern_finalize(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
OBJ_DESTRUCT(&ompi_success_intern);
|
|
|
|
OBJ_DESTRUCT(&ompi_error);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_out_of_resource);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_temp_out_of_resource);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_resource_busy);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_bad_param);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_fatal);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_not_implemented);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_not_supported);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_interupted);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_would_block);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_in_errno);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_unreach);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_not_found);
|
2004-10-20 02:00:19 +04:00
|
|
|
OBJ_DESTRUCT(&ompi_err_buffer);
|
|
|
|
OBJ_DESTRUCT(&ompi_err_request);
|
2014-03-12 03:45:23 +04:00
|
|
|
OBJ_DESTRUCT(&ompi_err_rma_sync);
|
2004-06-18 21:41:06 +04:00
|
|
|
|
|
|
|
OBJ_DESTRUCT(&ompi_errcodes_intern);
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ompi_errcode_intern_construct(ompi_errcode_intern_t *errcode)
|
|
|
|
{
|
|
|
|
errcode->code = MPI_UNDEFINED;
|
|
|
|
errcode->mpi_code = MPI_UNDEFINED;
|
|
|
|
errcode->index = MPI_UNDEFINED;
|
|
|
|
memset ( errcode->errstring, 0, OMPI_MAX_ERROR_STRING);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ompi_errcode_intern_destruct(ompi_errcode_intern_t *errcode)
|
|
|
|
{
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_set_item(&ompi_errcodes_intern, errcode->index, NULL);
|
2004-06-18 21:41:06 +04:00
|
|
|
return;
|
|
|
|
}
|