PetscBinarySynchronizedRead#
Reads from a binary file, all MPI processes get the same values
Synopsis#
PetscErrorCode PetscBinarySynchronizedRead(MPI_Comm comm, int fd, void *data, PetscInt num, PetscInt *count, PetscDataType type)
Collective, No Fortran Support
Input Parameters#
comm - the MPI communicator
fd - the file descriptor
num - the maximum number of items to read
type - the type of items to read (
PETSC_INT
,PETSC_REAL
,PETSC_SCALAR
, etc.)
Output Parameters#
data - the buffer, an array of the type that matches the value in
type
count - the number of items read, optional
Notes#
Does a PetscBinaryRead()
followed by an MPI_Bcast()
If count
is not provided and the number of items read is less than
the maximum number of items to read, then this routine errors.
PetscBinarySynchronizedRead()
uses byte swapping to work on all machines.
The files are written using big-endian ordering to the file. On little-endian machines the numbers
are converted to the big-endian format when they are written to disk.
When PETSc is configured using ./configure with --with-64-bit-indices
the integers are written to the
file as 64-bit integers, this means they can only be read back in when the option --with-64-bit-indices
is used.
See Also#
PetscBinaryWrite()
, PetscBinaryOpen()
, PetscBinaryClose()
, PetscBinaryRead()
, PetscBinarySynchronizedWrite()
,
PetscBinarySynchronizedSeek()
Level#
developer
Location#
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages