15.2.5. Preallocating Space for a File

PreviousUpNext
Up: File Manipulation Next: Querying the Size of a File Previous: Resizing a File

MPI_FILE_PREALLOCATE(fh, size)
INOUT fhfile handle (handle)
IN sizesize to preallocate file (integer)
C binding
int MPI_File_preallocate(MPI_File fh, MPI_Offset size)
Fortran 2008 binding
MPI_File_preallocate(fh, size, ierror)

TYPE(MPI_File), INTENT(IN) :: fh
INTEGER(KIND=MPI_OFFSET_KIND), INTENT(IN) :: size
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_FILE_PREALLOCATE(FH, SIZE, IERROR)

INTEGER FH, IERROR
INTEGER(KIND=MPI_OFFSET_KIND) SIZE

MPI_FILE_PREALLOCATE ensures that storage space is allocated for the first size bytes of the file associated with fh. MPI_FILE_PREALLOCATE is collective; all processes in the group must pass identical values for size. Regions of the file that have previously been written are unaffected. For newly allocated regions of the file, MPI_FILE_PREALLOCATE has the same effect as writing undefined data. If size is larger than the current file size, the file size increases to size. If size is less than or equal to the current file size, the file size is unchanged.

The treatment of file pointers, nonblocking accesses, and file consistency is the same as with MPI_FILE_SET_SIZE. If MPI_MODE_SEQUENTIAL mode was specified when the file was opened, it is erroneous to call this routine.


Advice to users.

In some implementations, file preallocation may be time-consuming. ( End of advice to users.)


PreviousUpNext
Up: File Manipulation Next: Querying the Size of a File Previous: Resizing a File


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