Beispiel #1
0
int MPI_Add_error_string(int errorcode, char *string)
{
    int rc;

    if ( MPI_PARAM_CHECK ) {
        OMPI_ERR_INIT_FINALIZE(FUNC_NAME);

        if ( ompi_mpi_errcode_is_invalid(errorcode) )
            return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
                                          FUNC_NAME);

	if ( ompi_mpi_errcode_is_predefined(errorcode) )
	    return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
					  FUNC_NAME);

	if ( MPI_MAX_ERROR_STRING < (strlen(string)+1) ) 
	    return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
					  FUNC_NAME);
    }

    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);
    }

    return MPI_SUCCESS;
}
Beispiel #2
0
int MPI_Error_class(int errorcode, int *errorclass) 
{
    if ( MPI_PARAM_CHECK ) {
        OMPI_ERR_INIT_FINALIZE(FUNC_NAME);

        if ( ompi_mpi_errcode_is_invalid(errorcode)) {
            return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
                                          FUNC_NAME);
        }
    }
    
    
    *errorclass = ompi_mpi_errcode_get_class(errorcode);
    return MPI_SUCCESS;
}
Beispiel #3
0
int MPI_Add_error_code(int errorclass, int *errorcode)
{
    int code;
    int rc;

    OPAL_CR_NOOP_PROGRESS();

    if ( MPI_PARAM_CHECK ) {
        OMPI_ERR_INIT_FINALIZE(FUNC_NAME);

        if ( ompi_mpi_errcode_is_invalid(errorclass) )
            return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
                                          FUNC_NAME);

	if ( !ompi_mpi_errnum_is_class ( errorclass) )
	    return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
					  FUNC_NAME);

        if (NULL == errorcode) {
            return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
                                          MPI_ERR_ARG, FUNC_NAME);
        }
    }

    code = ompi_mpi_errcode_add ( errorclass);
    if ( 0 > code ) {
        return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
                                      FUNC_NAME);
    }

    /*
    ** Update the attribute value. See the comments
    ** in attribute/attribute.c and attribute/attribute_predefined.c
    ** why we have to call the fortran attr_set function
    */
    rc  = ompi_attr_set_fint (COMM_ATTR,
                              MPI_COMM_WORLD,
                              &MPI_COMM_WORLD->c_keyhash,
                              MPI_LASTUSEDCODE,
                              ompi_mpi_errcode_lastused,
                              true);
    if ( MPI_SUCCESS != rc ) {
	return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, rc, FUNC_NAME);
    }

    *errorcode = code;
    return MPI_SUCCESS;
}