[petsc-users] Saving Multiple DMPlexes to a single HDF5 File

Brandon Denton bldenton at buffalo.edu
Fri Jan 5 10:04:50 CST 2024


Happy New Year!

I'm attempting to save multiple DMPlexes to a single HDF5 file. During my solution, I make modification to the DMPlex and would like to track and store these changes as the solution progresses. Currently, I the program writes the DMPlex to the HDF5 file the first time I call DMView() but throws an error the 2nd time I call DMView() to save the modified DMPlex. In my program, I would like to save more than 2  modfied DMPlexes to the same file. My current attempt at this process is outlined below with the error message copied at the end.

Any help you could give to get me over this hump is appreciated.

Thank you.
Brandon


​--- Relevant Current Code Segments ----

/*  Command Line Variable */
-dm_view_test hdf5:mesh_test_all.h5

/* Create initial DMPlex from file and Name it */
PetscCall(DMPlexCreateFromFile(comm, ctx.filename, "EGADS", PETSC_TRUE, &dmNozzle));
PetscCall(PetscObjectSetName((PetscObject)dmNozzle, "nozzle_mesh"));

/* Get viewer from command line options. If found, then get and check ViewerType and ViewerFormat */
/* Change ViewerFormat to PETSC_VIEWER_HDF5_PETSC per DMView() documation for saving multiple DMPlexes */
/* to a single file. Note: ViewerFormat Defaults to PETSC_VIEWER_DEFAULT when PetscOPtionsGetViewer() called */
PetscCall(PetscOptionsGetViewer(PETSC_COMM_WORLD, NULL, NULL, "-dm_view_test", &viewer, &format, &flg));
if (flg) {
    PetscCall(PetscPrintf(PETSC_COMM_SELF, "  flg = TRUE \n"));
    PetscCall(PetscViewerGetType(viewer, &viewType));
    PetscCall(PetscViewerPushFormat(viewer, PETSC_VIEWER_HDF5_PETSC));      // PetscOptionsGetViewer returns &format as PETSC_VIEWER_DEFAULT need PETSC_VIEWER_HDF5_PETSC to save multiple DMPlexes in a single .h5 file.
    PetscCall(PetscViewerGetFormat(viewer, &viewFormat));
    PetscCall(PetscPrintf(PETSC_COMM_SELF, "  viewer type = %s \n", viewType));
    PetscCall(PetscPrintf(PETSC_COMM_SELF, "  viewer format = %d \n", viewFormat));
  }

/* Save Initial DMPlex to HDF5 file */
PetscCall(DMView(dmNozzle, viewer));

/* Code makes modifications to DMPlex not shown here */

/* Set new name for modified DMPlex and attempt to write to HDF5 file - Fails */
PetscCall(PetscObjectSetName((PetscObject)dmNozzle, "nozzle_meshes_1"));
PetscCall(DMView(dmNozzle, viewer));  // <-- Fails here

---- End of Relevant Code Segments ----

----- ERROR MESSAGE -----
HDF5-DIAG: Error detected in HDF5 (1.12.1) thread 0:
  #000: H5D.c line 779 in H5Dset_extent(): unable to set dataset extent
    major: Dataset
    minor: Can't set value
  #001: H5VLcallback.c line 2326 in H5VL_dataset_specific(): unable to execute dataset specific callback
    major: Virtual Object Layer
    minor: Can't operate on object
  #002: H5VLcallback.c line 2289 in H5VL__dataset_specific(): unable to execute dataset specific callback
    major: Virtual Object Layer
    minor: Can't operate on object
  #003: H5VLnative_dataset.c line 325 in H5VL__native_dataset_specific(): unable to set extent of dataset
    major: Dataset
    minor: Unable to initialize object
  #004: H5Dint.c line 3045 in H5D__set_extent(): unable to modify size of dataspace
    major: Dataset
    minor: Unable to initialize object
  #005: H5S.c line 1847 in H5S_set_extent(): dimension cannot exceed the existing maximal size (new: 386 max: 98)
    major: Dataspace
    minor: Bad value
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Error in external library
[0]PETSC ERROR: Error in HDF5 call H5Dset_extent() Status -1
[0]PETSC ERROR: WARNING! There are unused option(s) set! Could be the program crashed before usage or a spelling mistake, etc!
[0]PETSC ERROR:   Option left: name:-dm_plex_geom_without_snap_to_geom value: 0 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view1 value: hdf5:mesh_minSA_vol_abstract.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view10 value: hdf5:mesh_minSA_itr5.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view11 value: hdf5:mesh_minSA_itr20.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view12 value: hdf5:mesh_minSA_itr50.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view13 value: hdf5:mesh_minSA_itr100.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view14 value: hdf5:mesh_minSA_itr150.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view15 value: hdf5:mesh_minSA_itr200.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view2 value: hdf5:mesh_minSA_vol_abstract_inflated.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view22 value: hdf5:mesh_minSA_itr200r1.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view23 value: hdf5:mesh_minSA_itr200r2.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view3 value: hdf5:mesh_minSA_vol_abstract_Refine.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view4 value: hdf5:mesh_minSA_vol_abstract_Refine2.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view5 value: hdf5:mesh_minSA_vol_abstract_Refine3.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view6 value: hdf5:mesh_minSA_vol_abstract_Refine4.h5 source: command line
[0]PETSC ERROR:   Option left: name:-dm_view8 value: hdf5:mesh_minSA_itr2.h5 source: command line
[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
[0]PETSC ERROR: Petsc Development GIT revision: v3.18.5-3061-g8635db7762a  GIT Date: 2023-10-22 20:49:54 -0400
[0]PETSC ERROR: ./ex17 on a  named XPS. by bdenton Fri Jan  5 10:02:19 2024
[0]PETSC ERROR: Configure options --with-make-np=16 --prefix=/mnt/c/Users/Brandon/software/libs/petsc/3.20.0-gitlab/gcc/11.2.0/mpich/3.4.2/openblas/0.3.17/opt --with-debugging=false --COPTFLAGS="-O3 -mavx" --CXXOPTFLAGS="-O3 -mavx" --FOPTFLAGS=-O3 --with-shared-libraries=1 --with-mpi-dir=/mnt/c/Users/Brandon/software/libs/mpich/3.4.2/gcc/11.2.0 --with-mumps=true --download-mumps=1 --with-metis=true --download-metis=1 --with-parmetis=true --download-parmetis=1 --with-superlu=true --download-superlu=1 --with-superludir=true --download-superlu_dist=1 --with-blacs=true --download-blacs=1 --with-scalapack=true --download-scalapack=1 --with-hypre=true --download-hypre=1 --with-hdf5-dir=/mnt/c/Users/Brandon/software/libs/hdf5/1.12.1/gcc/11.2.0 --with-valgrind-dir=/mnt/c/Users/Brandon/software/apps/valgrind/3.14.0 --with-blas-lib="[/mnt/c/Users/Brandon/software/libs/openblas/0.3.17/gcc/11.2.0/lib/libopenblas.so]" --with-lapack-lib="[/mnt/c/Users/Brandon/software/libs/openblas/0.3.17/gcc/11.2.0/lib/libopenblas.so]" --LDFLAGS= --with-tetgen=true --download-tetgen=1 --download-ctetgen=1 --download-opencascade=1 --download-egads
[0]PETSC ERROR: #1 VecView_MPI_HDF5() at /mnt/c/Users/Brandon/software/builddir/petsc-3.20.0-gitlab/src/vec/vec/impls/mpi/pdvec.c:664
[0]PETSC ERROR: #2 VecView_Seq() at /mnt/c/Users/Brandon/software/builddir/petsc-3.20.0-gitlab/src/vec/vec/impls/seq/bvec2.c:559
[0]PETSC ERROR: #3 VecView() at /mnt/c/Users/Brandon/software/builddir/petsc-3.20.0-gitlab/src/vec/vec/interface/vector.c:803
[0]PETSC ERROR: #4 DMPlexCoordinatesView_HDF5_Legacy_Private() at /mnt/c/Users/Brandon/software/builddir/petsc-3.20.0-gitlab/src/dm/impls/plex/plexhdf5.c:1022
[0]PETSC ERROR: #5 DMPlexCoordinatesView_HDF5_Internal() at /mnt/c/Users/Brandon/software/builddir/petsc-3.20.0-gitlab/src/dm/impls/plex/plexhdf5.c:1045
[0]PETSC ERROR: #6 DMPlexView_HDF5_Internal() at /mnt/c/Users/Brandon/software/builddir/petsc-3.20.0-gitlab/src/dm/impls/plex/plexhdf5.c:1301
[0]PETSC ERROR: #7 DMView_Plex() at /mnt/c/Users/Brandon/software/builddir/petsc-3.20.0-gitlab/src/dm/impls/plex/plex.c:1878
[0]PETSC ERROR: #8 DMView() at /mnt/c/Users/Brandon/software/builddir/petsc-3.20.0-gitlab/src/dm/interface/dm.c:982
[0]PETSC ERROR: #9 main() at /mnt/c/Users/Brandon/Documents/School/Dissertation/Software/EGADS-dev/ex17/ex17.c:374
[0]PETSC ERROR: PETSc Option Table entries:
[0]PETSC ERROR: -dm_plex_geom_print_model 1 (source: command line)
[0]PETSC ERROR: -dm_plex_geom_shape_opt 1 (source: command line)
[0]PETSC ERROR: -dm_plex_geom_tess_model 0 (source: command line)
[0]PETSC ERROR: -dm_plex_geom_without_snap_to_geom 0 (source: command line)
[0]PETSC ERROR: -dm_refine 1 (source: command line)
[0]PETSC ERROR: -dm_view hdf5:mesh_minSA_abstract.h5 (source: command line)
[0]PETSC ERROR: -dm_view1 hdf5:mesh_minSA_vol_abstract.h5 (source: command line)
[0]PETSC ERROR: -dm_view10 hdf5:mesh_minSA_itr5.h5 (source: command line)
[0]PETSC ERROR: -dm_view11 hdf5:mesh_minSA_itr20.h5 (source: command line)
[0]PETSC ERROR: -dm_view12 hdf5:mesh_minSA_itr50.h5 (source: command line)
[0]PETSC ERROR: -dm_view13 hdf5:mesh_minSA_itr100.h5 (source: command line)
[0]PETSC ERROR: -dm_view14 hdf5:mesh_minSA_itr150.h5 (source: command line)
[0]PETSC ERROR: -dm_view15 hdf5:mesh_minSA_itr200.h5 (source: command line)
[0]PETSC ERROR: -dm_view2 hdf5:mesh_minSA_vol_abstract_inflated.h5 (source: command line)
[0]PETSC ERROR: -dm_view22 hdf5:mesh_minSA_itr200r1.h5 (source: command line)
[0]PETSC ERROR: -dm_view23 hdf5:mesh_minSA_itr200r2.h5 (source: command line)
[0]PETSC ERROR: -dm_view3 hdf5:mesh_minSA_vol_abstract_Refine.h5 (source: command line)
[0]PETSC ERROR: -dm_view4 hdf5:mesh_minSA_vol_abstract_Refine2.h5 (source: command line)
[0]PETSC ERROR: -dm_view5 hdf5:mesh_minSA_vol_abstract_Refine3.h5 (source: command line)
[0]PETSC ERROR: -dm_view6 hdf5:mesh_minSA_vol_abstract_Refine4.h5 (source: command line)
[0]PETSC ERROR: -dm_view7 hdf5:mesh_minSA_itr1.h5 (source: command line)
[0]PETSC ERROR: -dm_view8 hdf5:mesh_minSA_itr2.h5 (source: command line)
[0]PETSC ERROR: -dm_view_test hdf5:mesh_test_all.h5 (source: command line)
[0]PETSC ERROR: -filename ../examples/abstract_minSA.stp (source: command line)
[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint at mcs.anl.gov----------
application called MPI_Abort(MPI_COMM_SELF, 76) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=76
:
system msg for write_line failure : Bad file descriptor

--- END OF ERROR MESSAGE ---


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240105/857f751f/attachment-0001.html>


More information about the petsc-users mailing list