## 9.2.2. Closing a File

Up: File Manipulation Next: Deleting a File Previous: Opening a File

MPI_FILE_CLOSE(fh)
INOUT fh | file handle (handle)

`int MPI_File_close(MPI_File *fh)
` `MPI_FILE_CLOSE(FH, IERROR)
INTEGER FH, IERROR
` `void MPI::File::Close()
`

MPI_FILE_CLOSE first synchronizes file state (equivalent to performing an MPI_FILE_SYNC), then closes the file associated with fh. The file is deleted if it was opened with access mode MPI_MODE_DELETE_ON_CLOSE (equivalent to performing an MPI_FILE_DELETE). MPI_FILE_CLOSE is a collective routine.

Advice to users.

If the file is deleted on close, and there are other processes currently accessing the file, the status of the file and the behavior of future accesses by these processes are implementation dependent. ( End of advice to users.)
The user is responsible for ensuring that all outstanding nonblocking requests and split collective operations associated with fh made by a process have completed before that process calls MPI_FILE_CLOSE.

The MPI_FILE_CLOSE routine deallocates the file handle object and sets fh to MPI_FILE_NULL.

Up: File Manipulation Next: Deleting a File Previous: Opening a File

Return to MPI-2 Standard Index
Return to MPI 1.1 Standard Index
Return to MPI Forum Home Page

MPI-2.0 of July 18, 1997
HTML Generated on September 10, 2001