15.7. I/O Error Handling

PreviousUpNext
Up: I/O Next: I/O Error Classes Previous: Asynchronous I/O

By default, communication errors are fatal--- MPI_ERRORS_ARE_FATAL is the default error handler associated with MPI_COMM_WORLD. I/O errors are usually less catastrophic (e.g., ``file not found'') than communication errors, and common practice is to catch these errors and continue executing. For this reason, MPI provides additional error facilities for I/O.


Advice to users.

MPI does not specify the state of a computation after an erroneous MPI call has occurred. A high-quality implementation will support the I/O error handling facilities, allowing users to write programs using common practice for I/O. ( End of advice to users.)
Like communicators, each file handle has an error handler associated with it. The MPI I/O error handling routines are defined in Section Error Handling.

When MPI calls a user-defined error handler resulting from an error on a particular file handle, the first two arguments passed to the file error handler are the file handle and the error code. For I/O errors that are not associated with a valid file handle (e.g., in MPI_FILE_OPEN or MPI_FILE_DELETE), the first argument passed to the error handler is MPI_FILE_NULL.

I/O error handling differs from communication error handling in another important aspect. By default, the predefined error handler for file handles is MPI_ERRORS_RETURN. The default file error handler has two purposes: when a new file handle is created (by MPI_FILE_OPEN), the error handler for the new file handle is initially set to the default file error handler, and I/O routines that have no valid file handle on which to raise an error (e.g., MPI_FILE_OPEN or MPI_FILE_DELETE) use the default file error handler. The default file error handler can be changed by specifying MPI_FILE_NULL as the fh argument
to MPI_FILE_SET_ERRHANDLER. The current value of the default file error handler can be determined by passing MPI_FILE_NULL as the fh argument to MPI_FILE_GET_ERRHANDLER.


Rationale.

For communication, the default error handler is inherited from MPI_COMM_WORLD when using the World Model. In I/O, there is no analogous ``root'' file handle from which default properties can be inherited. Rather than invent a new global file handle, the default file error handler is manipulated as if it were attached to MPI_FILE_NULL. ( End of rationale.)


PreviousUpNext
Up: I/O Next: I/O Error Classes Previous: Asynchronous I/O


Return to MPI-4.1 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-4.1 of November 2, 2023
HTML Generated on November 19, 2023