IBM Books

MPI Subroutine Reference

MPI_ADD_ERROR_CODE, MPI_Add_error_code

Purpose

Creates a new error code associated with errorclass and returns its value in errorcode.

C synopsis

#include <mpi.h>
int MPI_Add_error_code(int errorclass, int *errorcode);

C++ synopsis

#include mpi.h
int MPI::Add_error_code(int errorclass);

FORTRAN synopsis

include 'mpif.h' or use mpi
MPI_ADD_ERROR_CODE(INTEGER ERRORCLASS, INTEGER ERRORCODE, INTEGER IERROR)

Parameters

errorclass
is the error class (integer) (IN)

errorcode
is the new error code associated with errorclass (integer) (OUT)

IERROR
is the FORTRAN return code. It is always the last argument.

Description

This subroutine creates a new error code associated with errorclass and returns its value in errorcode so that there are no conflicts with existing codes or classes.

Notes

Because a call to MPI_ADD_ERROR_CLASS is local, the same error class may not be returned on all tasks that make this call. Thus, it is not safe to assume that registering a new error class or code on a set of tasks at the same time will yield the same error class or code on all of the tasks. Only if all calls to create an error class or code occur in the same order on each task of MPI_COMM_WORLD will the values be globally consistent. The value of MPI_ERR_LASTCODE is not affected by new user-defined error codes and classes, as it is a constant value. Instead, a predefined attribute key MPI_LASTUSEDCODE is associated with MPI_COMM_WORLD. The attribute value corresponding to this key is the current maximum error class including the user-defined ones. This is a local value and may be different on different tasks. The value returned by this key is always greater than or equal to MPI_ERR_LASTCODE.

The value returned by the key MPI_LASTUSEDCODE will not change unless the user calls a function to explicitly add an error class or code. In a multi-threaded environment, the user must take extra care in assuming this value has not changed. Note that error codes and error classes are not necessarily dense. A user may not assume that each error class below MPI_LASTUSEDCODE is valid. An error is returned if the user tries to set the predefined MPI_LASTUSEDCODE using MPI_COMM_SET_ATTR.

Errors

Fatal errors:

Invalid error class

MPI already finalized

MPI not initialized

Related information

MPI_ADD_ERROR_CLASS
MPI_ADD_ERROR_STRING
MPI_ERROR_CLASS
MPI_ERROR_STRING


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]