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

Error when using HDF5File with dolfin.

0 votes

Hello All,

I compiled dolfin with HDF5 support, yet I cannot write a HDF5 file.

The error is:

*** Error:   Unable to open file.
*** Reason:  Unknown file type (".h5") for file "w.h5".
*** Where:   This error was encountered inside File.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2016.2.0.dev0
*** Git changeset:  b84974e3d89bccf46d165692b5f8c02a9f967c6f

The corresponding lines in my code are:

auto wp = std::make_shared<Function>(V);
...
File w_file("w.h5");
w_file << *w;

Here is the cmake log showing that it was compiled with HD5 support:

-- Boost version: 1.61.0
-- Found the following Boost libraries:
--   filesystem
--   program_options
--   iostreams
--   timer
--   system
--   regex
--   chrono
-- Checking for package 'PETSc'
-- PETSC_DIR is /share/apps/fenics/petsc
-- PETSC_ARCH is empty
-- Found petscconf.h
-- Performing test PETSC_TEST_RUNS - Success
-- Checking for package 'PETSc4Py'
-- PETSc4py could not be found. Be sure to set PYTHONPATH appropriately. (missing:  PETSC4PY_INCLUDE_DIRS PETSC4PY_VERSION) 
-- Checking for package 'SLEPc'
-- SLEPC_DIR is SLEPC_DIR-NOTFOUND
-- SLEPc could not be found. Be sure to set SLEPC_DIR, PETSC_DIR, and PETSC_ARCH. (missing:  SLEPC_LIBRARIES SLEPC_DIR SLEPC_INCLUDE_DIRS SLEPC_TEST_RUNS SLEPC_VERSION SLEPC_VERSION_OK) (Required is at least version "3.6")
-- ParMETIS could not be found/configured. (missing:  PARMETIS_LIBRARIES PARMETIS_TEST_RUNS PARMETIS_INCLUDE_DIRS PARMETIS_VERSION PARMETIS_VERSION_OK) (Required is at least version "4.0.2")
-- Checking for package 'SCOTCH-PT'
-- SCOTCH could not be found. Be sure to set SCOTCH_DIR. (missing:  SCOTCH_LIBRARIES SCOTCH_INCLUDE_DIRS SCOTCH_TEST_RUNS) 
-- Checking for package 'AMD'
-- Checking for package 'UMFPACK'
-- Checking for package 'AMD'
-- Checking for package 'CHOLMOD'
-- Checking for package 'AMD'
-- A library with BLAS API found.
-- UMFPACK could not be found. Be sure to set UMFPACK_DIR. (missing:  UMFPACK_INCLUDE_DIRS AMD_LIBRARIES UMFPACK_TEST_RUNS) 
-- Checking for package 'CHOLMOD'
-- Checking for package 'AMD'
-- A library with BLAS API found.
-- CHOLMOD could not be found. Be sure to set CHOLMOD_DIR. (missing:  CHOLMOD_INCLUDE_DIRS CHOLMOD_TEST_RUNS) 
-- HDF5 has been found, but is missing parallel support. It will not be enabled.
-- Checking for Trilinos
--   Trilinos version 12.9 found. Checking for components
--     Tpetra found
--     Zoltan found
--     MueLu found
--     Amesos2 found
--     Ifpack2 found
--     Belos found
--   All necessary Trilinos components found. Trilinos will be enabled.
-- Checking for package 'Sphinx'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named sphinx
-- Could NOT find Sphinx (missing:  SPHINX_VERSION_OK) (Required is at least version "1.1.0")
-- Found VTK: /share/apps/fenics/vtk/lib/cmake/vtk-7.0 (found version "7.0")
-- 
-- The following features have been enabled:

 * BUILD_SHARED_LIBS , Build DOLFIN with shared libraries.
 * DOLFIN_AUTO_DETECT_MPI , Detect MPI automatically (turn this off to use the MPI compiler wrappers directly via setting CXX, CXX, FC).
 * DOLFIN_WITH_LIBRARY_VERSION , Build with library version information.
 * DOLFIN_ENABLE_GTEST , Enable C++ unit tests with Google Test if DOLFIN_ENABLE_TESTING is true (requires Internet connection to download Google Test when first configured).
 * DOLFIN_ENABLE_DOCS , Enable generation of documentation.
 * CMAKE_INSTALL_RPATH_USE_LINK_PATH , Add paths to linker search and installed rpath.
 * DOLFIN_ENABLE_OPENMP , Compile with support for OpenMP.
 * DOLFIN_ENABLE_MPI , Compile with support for MPI.
 * DOLFIN_ENABLE_PETSC , Compile with support for PETSc.
 * DOLFIN_ENABLE_PETSC4PY , Compile with support for PETSc4py.
 * DOLFIN_ENABLE_SLEPC , Compile with support for SLEPc.
 * DOLFIN_ENABLE_SLEPC4PY , Compile with support for SLEPc4py.
 * DOLFIN_ENABLE_TRILINOS , Compile with support for Trilinos.
 * DOLFIN_ENABLE_UMFPACK , Compile with support for UMFPACK.
 * DOLFIN_ENABLE_CHOLMOD , Compile with support for CHOLMOD.
 * DOLFIN_ENABLE_SCOTCH , Compile with support for SCOTCH.
 * DOLFIN_ENABLE_PARMETIS , Compile with support for ParMETIS.
 * DOLFIN_ENABLE_ZLIB , Compile with support for zlib.
 * DOLFIN_ENABLE_PYTHON , Compile with support for Python.
 * DOLFIN_ENABLE_SPHINX , Compile with support for Sphinx.
 * DOLFIN_ENABLE_HDF5 , Compile with support for HDF5.
 * DOLFIN_ENABLE_VTK , Compile with support for VTK.

-- The following OPTIONAL packages have been found:

 * MPI , Message Passing Interface (MPI)
   Enables DOLFIN to run in parallel with MPI
 * OpenMP , Open Multi-Processing API
   Enables DOLFIN to run in parallel with OpenMP
 * PETSc (required version >= 3.6) , Portable, Extensible Toolkit for Scientific Computation , <https://www.mcs.anl.gov/petsc/>
   Enables the PETSc linear algebra backend
 * BLAS , Basic Linear Algebra Subprograms , <http://netlib.org/blas/>
 * Threads
 * HDF5 , Hierarchical Data Format 5 (HDF5) , <https://www.hdfgroup.org/HDF5>
 * Trilinos , Object-oriented framework for large-scale problems , <https://trilinos.org>
 * ZLIB , Compression library , <http://www.zlib.net>
 * VTK , The Visualization Toolkit - A high level 3D visualization library , <https://www.vtk.org>
   Enables plotting with VTK as backend
...
...
asked Sep 7, 2016 by wtpot FEniCS Novice (450 points)

1 Answer

+1 vote
 
Best answer

Your answer is in the build log:

-- HDF5 has been found, but is missing parallel support. It will not be enabled.

In case that you have a MPI version of hdf5 installed, check your version of cmake. Version 3.6.1 ships with a broken FindHDF5.cmake module. In this case overwrite the file with the one from the git master branch (https://cmake.org/gitweb?p=cmake.git;a=blob_plain;f=Modules/FindHDF5.cmake;hb=HEAD).

answered Sep 8, 2016 by cevito FEniCS User (5,550 points)
selected Sep 8, 2016 by wtpot

Thanks.
My mistake for not reading the log well.

I recompiled HDF5 with parallel support, and recompiled dolfin. The dolfin cmake output shows that HDF5 is enabled.
I still have the same problem:

" *** Reason:  Unknown file type (".h5") for file "w.h5". "

Any ideas?

The reason is that HDF5File is not supported from the simplistic File interface. In other words, you have to explicitly use the HDF5File interface.

hdf = HDF5File(mpi_comm, 'a.h5','w')
hdf.write(mesh, 'Mesh1')

etc.

Thanks. I did that and am still getting some errors.

Here is my modified code based on your feedback:

MPI_Comm   mpi_comm;
HDF5File fid(mpi_comm, "a.h5", "w");
std::vector<double> d = { 1.0, 2.3} ;
fid.write(d, "testDouble");
fid.close();

The code compiles fine, but there are some execution errors as shown below:

HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) MPI-process 0:
  #000: H5Dio.c line 263 in H5Dwrite(): file selection+offset not within extent
    major: Dataspace
    minor: Out of range

HDF5: infinite loop closing library
      L,T_top,P,P,AC,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD,FD

Hi,

I am having the same HDF5 support issue, but cannot solve it at the time.

Could you point a valid commit for the CMake repository for the FindHDF5.cmake module ?

Is it possible to share your compilation options for HDF5 ?

Thanks

...