This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Errors when loading HDF5 files

0 votes

Hello,

I'm attempting to load a hdf5/xdmf file using the following dolfin commands

from dolfin import *
mesh = Mesh('example.xdmf')

When I do this I get the following error message

HDF5-DIAG: Error detected in HDF5 (1.8.11) MPI-process 0:
#000: ../../../src/H5L.c line 824 in H5Lexists(): unable to get link info
major: Symbol table
minor: Object not found
#001: ../../../src/H5L.c line 2765 in H5L_exists(): path doesn't exist
major: Symbol table
minor: Object already exists
#002: ../../../src/H5Gtraverse.c line 861 in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
#003: ../../../src/H5Gtraverse.c line 755 in H5G_traverse_real(): component not found
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (1.8.11) MPI-process 0:
#000: ../../../src/H5L.c line 824 in H5Lexists(): unable to get link info
major: Symbol table
minor: Object not found
#001: ../../../src/H5L.c line 2765 in H5L_exists(): path doesn't exist
major: Symbol table
minor: Object already exists
#002: ../../../src/H5Gtraverse.c line 861 in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
#003: ../../../src/H5Gtraverse.c line 755 in H5G_traverse_real(): component not found
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (1.8.11) MPI-process 0:
#000: ../../../src/H5D.c line 334 in H5Dopen2(): not found
major: Dataset
minor: Object not found
#001: ../../../src/H5Gloc.c line 430 in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
#002: ../../../src/H5Gtraverse.c line 861 in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
#003: ../../../src/H5Gtraverse.c line 755 in H5G_traverse_real(): component not found
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (1.8.11) MPI-process 0:
#000: ../../../src/H5D.c line 437 in H5Dget_space(): not a dataset
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.11) MPI-process 0:
#000: ../../../src/H5S.c line 794 in H5Sget_simple_extent_ndims(): not a dataspace
major: Invalid arguments to routine
minor: Inappropriate type
Traceback (most recent call last):
File "test2.py", line 3, in
mesh = Mesh('example.xdmf')
File "/home/les/install/fenics/1.4.0/lib/python2.7/site-packages/dolfin/mesh/meshes.py", line 66, in init
cpp.Mesh.cppinit(self, *args, **kwargs)
File "/home/les/install/fenics/1.4.0/lib/python2.7/site-packages/dolfin/cpp/mesh.py", line 1592, in __init__
_mesh.Mesh_swiginit(self,_mesh.new_Mesh(*args))
Exception: std::bad_alloc

When I run the command h5ls -r example.h5 I get the following output

/ Group
/mesh Group
/mesh/coordinates Dataset {284, 3}
/mesh/topology Dataset {1147, 4}
/mesh/values Dataset {1147, 1}

Also when I run h5dump the output looks OK to me. It also looks fine when I open the file in paraview. I've generated both hdf5 and xdmf files using a python script I wrote based on the xml to hdf5 conversion script by Garth - my script converts from exodusII. The hdf5 file and xdmf files I'm using are available at example.hd5 and example.xdmf. Can anyone give me some indication as to what may be wrong?

Kind regards
Les

asked Dec 4, 2014 by lnagy FEniCS Novice (250 points)

The problem may be that you are trying to read from an xdmf file, which is a visualisation front to the associated .h5 file which is really the data container.

How exactly are you writing the h5 file?

When I load a mesh from an h5 file (python) I use:

file_init = HDF5File(mpi_comm_world(), 'initial.h5', 'r')
mesh_init = Mesh()
file_init.read(mesh_init, 'mesh', False)

where my h5ls -r initial.h5 gives:

/mesh                    Group
/mesh/cell_indices       Dataset {1003285}
/mesh/coordinates        Dataset {170864, 3}
/mesh/topology           Dataset {1003285, 4}

Seems like you are missing the 'cell_indicies' dataset.

I tried reading your file the same way and got:

HDF5-DIAG: Error detected in HDF5 (1.8.13) MPI-process 0:
  #000: H5A.c line 559 in H5Aopen(): unable to load attribute info from object header for attribute: 'partition'
    major: Attribute
    minor: Unable to initialize object
  #001: H5Oattribute.c line 537 in H5O_attr_open_by_name(): can't locate attribute: 'partition'
    major: Attribute
    minor: Object not found
HDF5-DIAG: Error detected in HDF5 (1.8.13) MPI-process 0:
  #000: H5A.c line 1278 in H5Aget_type(): not an attribute
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.13) MPI-process 0:
  #000: H5A.c line 1232 in H5Aget_space(): not an attribute
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.13) MPI-process 0:
  #000: H5S.c line 872 in H5Sget_simple_extent_dims(): not a dataspace
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.13) MPI-process 0:
  #000: H5A.c line 1086 in H5Aread(): not an attribute
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.13) MPI-process 0:
  #000: H5S.c line 391 in H5Sclose(): not a dataspace
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.13) MPI-process 0:
  #000: H5T.c line 1766 in H5Tclose(): not a datatype
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.8.13) MPI-process 0:
  #000: H5A.c line 2288 in H5Aclose(): not an attribute
    major: Invalid arguments to routine
    minor: Inappropriate type

Hello,

I also tried loading my hdf5 file using the method you mentioned. I was under the impression that the xdmf file was a metadata file for the hdf5 file to tell the underlying reader what the binary data means.

I think your observation about not having a cell_indices data set may be the thing I'm missing though. Could any one enlighten me as to what this data set means? When I look at a fenics mesh like

from dolfin import *
mesh = UnitCubeMesh(2,2,2)
File('out.xdmf') << mesh

The h5dump command just gives me a straight numbering from 0 to 47 for cell_indices, i.e.

    ...
    DATASET "cell_indices" {
       DATATYPE  H5T_STD_U64LE
       DATASPACE  SIMPLE { ( 48 ) / ( 48 ) }
       DATA {
       (0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
       (17): 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
       (32): 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
       (47): 47
       }
    ...

Is this a special internal numbering that fenics uses? Am I safe to just use 0 .. N for any data set?

Please post a complete example that we can run. Put the XDMF and HDF5 files somewhere they can be downloaded.

...