<div dir="ltr"><div dir="ltr">It turns out there is nothing in the hdf5 file:<div><br></div><div><div>$ h5dump data/matrix3.mat.h5</div><div>HDF5 "data/matrix3.mat.h5" {</div><div>GROUP "/" {</div><div>}</div><div>}</div></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 4, 2022 at 9:19 AM fujisan <<a href="mailto:fujisan43@gmail.com">fujisan43@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi everyone,<div><br></div><div>I have written a matrix in an HDF5 binary file without problem using PetscViewerHDF5Open function like this:</div><div><br></div><div><font face="monospace">! Write</font></div><div><div><font face="monospace">if (ishdf5) then</font></div><div><font face="monospace"> PetscCall(PetscViewerHDF5Open(PETSC_COMM_WORLD,trim(</font><span style="font-family:monospace">filename</span><font face="monospace">),FILE_MODE_WRITE,view,ierr))</font></div><div><font face="monospace">else</font></div><div><font face="monospace"> PetscCall(PetscViewerBinaryOpen(PETSC_COMM_WORLD,trim(</font><span style="font-family:monospace">filename</span><font face="monospace">),FILE_MODE_WRITE,view,ierr))</font></div><div><font face="monospace">endif</font></div><div><span style="font-family:monospace">PetscCall(MatView(A,view,ierr))</span><br></div><div><font face="monospace">PetscCall(PetscViewerDestroy(view,ierr))</font></div></div><div><br></div><div>But when I want to read that HDF5 file like this:</div><div><br></div><div><font face="monospace">! Read</font></div><div><div><font face="monospace">if (ishdf5) then</font></div><div><font face="monospace"> PetscCall(PetscViewerHDF5Open(PETSC_COMM_WORLD,trim(</font><span style="font-family:monospace">filename</span><font face="monospace">),FILE_MODE_READ,view,ierr))</font></div><div><span style="font-family:monospace">else</span><br></div><div><font face="monospace"> PetscCall(PetscViewerBinaryOpen(PETSC_COMM_WORLD,trim(</font><span style="font-family:monospace">filename</span><font face="monospace">),FILE_MODE_READ,view,ierr))</font></div><div><font face="monospace">endif</font></div><div><span style="font-family:monospace">PetscCall(MatCreate(PETSC_COMM_WORLD,A,ierr))</span><br></div><div><font face="monospace">PetscCall(MatSetType(A,MATMPIAIJ,ierr))</font></div><div><font face="monospace">PetscCall(MatLoad(A,view,ierr))</font></div><div><font face="monospace">PetscCall(PetscViewerDestroy(view,ierr))</font><br></div></div><div><br></div><div>I get this kind of error message below.</div><div>I don't have any problem writing / reading using PetscViewerBinaryOpen, and no problem writing / reading a vector using PetscViewerHDF5Open either.</div><div><br></div><div>What am I missing ?</div><div><br></div><div>Fuji</div><div><br></div><div><div><font face="monospace">[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</font></div><div><font face="monospace">[0]PETSC ERROR: Unexpected data in file</font></div><div><font face="monospace">[0]PETSC ERROR: Attribute /Mat_0xc4000016_0/MATLAB_sparse does not exist and default value not provided</font></div><div><font face="monospace">[0]PETSC ERROR: See <a href="https://petsc.org/release/faq/" target="_blank">https://petsc.org/release/faq/</a> for trouble shooting.</font></div><div><font face="monospace">[0]PETSC ERROR: Petsc Release Version 3.18.0, unknown </font></div><div><font face="monospace">[0]PETSC ERROR: ./bin/solve on a x86_64 named master by beauduin Tue Oct 4 08:55:55 2022</font></div><div><font face="monospace">[0]PETSC ERROR: Configure options --with-petsc-arch=x86_64 --COPTFLAGS="-g -O3" --FOPTFLAGS="-g -O3" --CXXOPTFLAGS="-g -O3" --with-debugging=0 --with-cc=mpiicc --with-cxx=mpiicpc --with-fc=mpiifort --with-single-library=1 --with-mpiexec=mpiexec --with-precision=double --with-fortran-interfaces=1 --with-make=1 --with-mpi=1 --with-mpi-compilers=1 --download-fblaslapack=0 --download-hypre=1 --download-cmake=0 --with-cmake=1 --download-metis=1 --download-parmetis=1 --download-ptscotch=0 --download-suitesparse=1 --download-triangle=1 --download-superlu=1 --download-superlu_dist=1 --download-scalapack=1 --download-mumps=1 --download-elemental=1 --download-spai=0 --download-parms=1 --download-moab=1 --download-chaco=0 --download-fftw=1 --with-petsc4py=1 --download-mpi4py=1 --download-saws --download-concurrencykit=1 --download-revolve=1 --download-cams=1 --download-p4est=0 --with-zlib=1 --with-hdf5=1 --download-hdf5=1 --download-mfem=1 --download-glvis=0 --with-opengl=0 --download-libpng=1 --download-libjpeg=1 --download-slepc=1 --download-hpddm=1 --download-bamg=1 --download-mmg=0 --download-parmmg=0 --download-htool=1 --download-egads=0 --download-opencascade=0 PETSC_ARCH=x86_64</font></div><div><font face="monospace">[0]PETSC ERROR: #1 PetscViewerHDF5ReadAttribute() at /data/softs/petsc/src/sys/classes/viewer/impls/hdf5/hdf5v.c:1245</font></div><div><font face="monospace">[0]PETSC ERROR: #2 MatLoad_AIJ_HDF5() at /data/softs/petsc/src/mat/impls/aij/seq/aijhdf5.c:63</font></div><div><font face="monospace">[0]PETSC ERROR: #3 MatLoad_MPIAIJ() at /data/softs/petsc/src/mat/impls/aij/mpi/mpiaij.c:3034</font></div><div><font face="monospace">[0]PETSC ERROR: #4 MatLoad() at /data/softs/petsc/src/mat/interface/matrix.c:1304</font></div><div><font face="monospace">[0]PETSC ERROR: #5 bigmat.F90:62</font></div><div><font face="monospace">[0]PETSC ERROR: #6 MatCreateVecs() at /data/softs/petsc/src/mat/interface/matrix.c:9336</font></div><div><font face="monospace">[0]PETSC ERROR: #7 solve.F90:143</font></div><div><font face="monospace">Abort(73) on node 0 (rank 0 in comm 16): application called MPI_Abort(MPI_COMM_SELF, 73) - process 0</font></div><div><font face="monospace">forrtl: severe (174): SIGSEGV, segmentation fault occurred</font></div><div><font face="monospace">Image PC Routine Line Source </font></div><div><font face="monospace">solve 000000000043258A Unknown Unknown Unknown</font></div><div><font face="monospace">libpthread-2.28.s 00007FCAF0B78C20 Unknown Unknown Unknown</font></div><div><font face="monospace">libmpi.so.12.0.0 00007FCAF17A09D3 Unknown Unknown Unknown</font></div></div><div><font face="monospace">....</font></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>