Skip to content

Eigen example results in HDF5 errors #75

@Svalorzen

Description

@Svalorzen

I've just finished setting up h5cpp and I'm trying the examples on this page.

The basics.cpp example seems to work fine, but I cannot get the eigen3.cpp example to work. I get HDF5 errors unfortunately.

This is what happens if I run the example as-is:

HDF5-DIAG: Error detected in HDF5 (1.10.4) thread 140505354843968:
  #000: ../../../src/H5Dio.c line 336 in H5Dwrite(): can't write data
    major: Dataset
    minor: Write failed
  #001: ../../../src/H5Dio.c line 683 in H5D__write(): unable to set up type info
    major: Dataset
    minor: Unable to initialize object
  #002: ../../../src/H5Dio.c line 968 in H5D__typeinfo_init(): not a datatype
    major: Invalid arguments to routine
    minor: Inappropriate type
terminate called after throwing an instance of 'h5::error::io::dataset::write'
  what():  /home/svalorzen/Tests/cpp/h5/h5cpp/h5cpp/H5Dwrite.hpp line#  27 : couldn't write dataset...
Aborted (core dumped)

After this the linalg.h5 file is created, but cannot be opened with another tool.

If instead I comment most of the file, and I simply try to run the fixed/compile time examples (replacing H5F_ACC_RDWR with H5F_ACC_TRUNC, I get this:

HDF5-DIAG: Error detected in HDF5 (1.10.4) thread 140167186298688:
  #000: ../../../src/H5F.c line 495 in H5Fopen(): invalid file open flags
    major: Invalid arguments to routine
    minor: Bad value
terminate called after throwing an instance of 'h5::error::io::file::open'
  what():  /home/svalorzen/Tests/cpp/h5/h5cpp/h5cpp/H5Fopen.hpp line#  29 : opening hdf5 container failed...
Aborted (core dumped)

This is my CMake setup:

cmake_minimum_required(VERSION 3.1.0) 
PROJECT (main)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(EIGEN_VERSION_REQUIRED 3.2.92)

find_package(HDF5 REQUIRED)
include_directories(${HDF5_INCLUDE_DIRS})

find_package(Eigen3 ${EIGEN_VERSION_REQUIRED} REQUIRED)
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})

add_subdirectory(./h5cpp)
include_directories(SYSTEM ./h5cpp/)

add_executable( main main.cpp )

target_link_libraries( main ${HDF5_CXX_LIBRARIES} ${HDF5_LIBRARIES})

and CMake output:

-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.4")  
-- H5CPP 1.10.4.6 matches with minimum required HDF5 v1.10.4
-- Found MPI_C: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so (found version "3.1") 
-- Found MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so (found version "3.1") 
-- Found MPI: TRUE (found version "3.1")  
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
-- Install directory: /usr/local/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/svalorzen/Tests/cpp/h5/build

Any ideas what I'm doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions