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

HDF5 I/O crashing

0 votes

Hi

The following code compiles fine but crashes when run. First, I run it without commenting the "OUTPUT" so as to generate the h5 output file; this works fine but it crashes when I try to read in the generated h5 file.

UFL File:

element = FiniteElement("Lagrange", "triangle", 1)

v       = TestFunction( element )
u       = TrialFunction( element )

main.cpp

#include <dolfin.h>
#include "HDF5_TEST.h"

using namespace dolfin;

int main()
{
/*  
    // OUTPUT
    UnitSquareMesh mesh_out(5, 5);
    HDF5_TEST::FunctionSpace V(mesh_out);

    HDF5File f("u.h5", "w");

    Function materials_out(V);
    Constant tmp(11);
    materials_out.interpolate( tmp );

    f.write( mesh_out, "mesh" );
    f.write( materials_out, "materials" );
    //f.close();
*/  

    // INPUT
    HDF5File g( "u.h5", "r" );
    Mesh mesh_in;
    HDF5_TEST::FunctionSpace Vin(mesh_in);
    g.read( mesh_in, "mesh" );

    Function materials_in(Vin);
    g.read( materials_in, "materials" );
    //g.close();

    plot( materials_in );
    interactive();
}

After generating the output h5 file, I comment out the "OUTPUT" section as in the code above and attempt to read it but it crashes with the following error:

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 terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc [shortqt:25078]
*** Process received signal *** [shortqt:25078] Signal: Aborted (6) [shortqt:25078] Signal code: (-6) [shortqt:25078] [ 0]
/lib/x86_64-linux-gnu/libc.so.6(+0x36ff0) [0x2b81df3b3ff0]
[shortqt:25078] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)
[0x2b81df3b3f77] [shortqt:25078] [ 2]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x148) [0x2b81df3b75e8]
[shortqt:25078] [ 3]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZN9gnu_cxx27verbose_terminate_handlerEv+0x155)
[0x2b81deec36e5] [shortqt:25078] [ 4]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x5e856) [0x2b81deec1856]
[shortqt:25078] [ 5]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x5e883) [0x2b81deec1883]
[shortqt:25078] [ 6]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x5eaae) [0x2b81deec1aae]
[shortqt:25078] [ 7]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xafde2) [0x2b81def12de2]
[shortqt:25078] [ 8]
/usr/lib/libdolfin.so.1.3(_ZN6dolfin13HDF5Interface16get_dataset_sizeEiSs+0x159)
[0x2b81de59ee69] [shortqt:25078] [ 9]
/usr/lib/libdolfin.so.1.3(_ZNK6dolfin8HDF5File4readERNS_4MeshESs+0x307)
[0x2b81de541617] [shortqt:25078] [10] ./main(main+0x166) [0x404816]
[shortqt:25078] [11]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)
[0x2b81df39ede5] [shortqt:25078] [12] ./main() [0x404af6]
[shortqt:25078] *** End of error message *** Aborted (core dumped)

asked Feb 4, 2014 by Theodore FEniCS Novice (780 points)
edited Feb 5, 2014 by Theodore

1 Answer

+1 vote
 
Best answer

You have to read in mesh before you initialize function space

g.read( mesh_in, "mesh" );
HDF5_TEST::FunctionSpace Vin(mesh_in);
answered Feb 6, 2014 by Jan Blechta FEniCS Expert (51,420 points)
selected Feb 6, 2014 by Theodore

Thanks Jan.

I've stared at the code over and over again and didn't spot that. It's amazing how such inconspicuous and silly errors go undetected.

...