9.2.5. Preallocating Space for a File


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

MPI_FILE_PREALLOCATE(fh, size)
[ INOUT fh] file handle (handle)
[ IN size] size to preallocate file (integer)

int MPI_File_preallocate(MPI_File fh, MPI_Offset size)
MPI_FILE_PREALLOCATE(FH, SIZE, IERROR)
INTEGER FH, IERROR
INTEGER(KIND=MPI_OFFSET_KIND) SIZE
void MPI::File::Preallocate(MPI::Offset 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, pending 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 expensive. ( End of advice to users.)



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


Return to MPI-2 Standard Index

MPI-2.0 of July 18, 1997
HTML Generated on August 11, 1997