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

Matthew Knepley knepley at gmail.com
Tue May 31 07:43:21 CDT 2022


On Tue, May 31, 2022 at 1:02 AM 冯宏磊 <12132391 at mail.sustech.edu.cn> wrote:

> 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)
>

If you want parallel HDF5, the package has to be compiled for parallelism.
One way to do this is to have PETSc build it for you:

   --download-hdf5

in configure.

  Thanks,

     Matt


> 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.
>
>
>
>
>
> 冯宏磊
>
> 南方科技大学/研究生/研究生2021级
>
> 广东省深圳市南山区学苑大道1088号
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220531/fc8e44f4/attachment.html>


More information about the petsc-users mailing list