IBM Books

MPI Subroutine Reference

MPI_ADD_ERROR_CLASS, MPI_Add_error_class

Purpose

Creates a new error class and returns the value for it.

C synopsis

#include <mpi.h>
int MPI_Add_error_class(int *errorclass);

C++ synopsis

#include mpi.h
int MPI::Add_error_class();

FORTRAN synopsis

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

Parameters

errorclass
is the value for the new error class (integer) (OUT)

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

Description

This subroutine creates a new error class and returns the value for it so that the user classes do not conflict with any existing codes or classes. See Table 1 and Table 2 for a list of the predefined PE MPI error 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:

MPI already finalized

MPI not initialized

Related information

MPI_ADD_ERROR_CODE
MPI_ADD_ERROR_STRING
MPI_ERROR_CLASS
MPI_ERROR_STRING


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