[petsc-users] How to read and write HDF5 in parallel withPETSc

冯宏磊 12132391 at mail.sustech.edu.cn
Tue May 31 00:01:49 CDT 2022

my code is below:
ierr = PetscViewerCreate(PETSC_COMM_WORLD,&h5);CHKERRQ(ierr);
ierr = PetscViewerHDF5Open(PETSC_COMM_WORLD,"explicit.h5", FILE_MODE_WRITE, &h5);CHKERRQ(ierr); 
ierr = PetscObjectSetName((PetscObject) z, "explicit-vector");CHKERRQ(ierr); 
ierr = PetscObjectSetName((PetscObject) tem, "explicit-necess-data");CHKERRQ(ierr); 
ierr = VecView(tem, h5);CHKERRQ(ierr); 
ierr = VecView(z, h5);CHKERRQ(ierr); 
ierr = PetscViewerDestroy(&h5);CHKERRQ(ierr);

when I use 1 core run this, it can save the right answer.

when I use 3 cores run this, it prints that :
[0]PETSC ERROR: No support for this operation for this object type
[0]PETSC ERROR: Cannot use parallel HDF5 viewer since the given HDF5 does not support parallel I/O (H5_HAVE_PARALLEL is unset)

I don't know how to solve this problem.

By the way, I use PETSc-3.16.6, HDF5-1.12.1, C for programming.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220531/37e5731a/attachment.html>

More information about the petsc-users mailing list