Skip to main content
`Ctrl`+`K`

# PetscViewerHDF5SetCollective

Use collective MPI-IO transfer mode for HDF5 reads and writes.

## Synopsis

    #include "petscviewerhdf5.h"
    PetscErrorCode PetscViewerHDF5SetCollective(PetscViewer viewer, PetscBool flg)

Logically Collective; flg must contain common value

## Input Parameters

- viewer - the `PetscViewer`; if it is not `PETSCVIEWERHDF5` then this command is ignored

- flg - `PETSC_TRUE` for collective mode; `PETSC_FALSE` for independent mode (default)

## Options Database Key

- -viewer_hdf5_collective - turns on (true) or off (false) collective transfers

## Note

Collective mode gives the MPI-IO layer underneath HDF5 a chance to do some additional collective optimizations and hence can perform better. However, this works correctly only since HDF5 1.10.3 and if HDF5 is installed for MPI; hence, we ignore this setting for older versions.

## Developer Notes

In the HDF5 layer, `PETSC_TRUE` / `PETSC_FALSE` means `H5Pset_dxpl_mpio()` is called with `H5FD_MPIO_COLLECTIVE` / `H5FD_MPIO_INDEPENDENT`, respectively. This in turn means use of MPI_File_{read,write}all / MPI_File{read,write} in the MPI-IO layer, respectively. See HDF5 documentation and MPI-IO documentation for details.

## See Also

Viewers: Looking at PETSc Objects, `PETSCVIEWERHDF5`, `PetscViewerHDF5GetCollective()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerHDF5Open()`

## Level

intermediate

## Location

src/sys/classes/viewer/impls/hdf5/hdf5v.c

## Implementations

PetscViewerHDF5SetCollective_HDF5() in src/sys/classes/viewer/impls/hdf5/hdf5v.c

Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages