nwukie / ChiDG

A Chimera-based, discontinuous Galerkin solver
Other
31 stars 22 forks source link

Unable to locate custom built HDF5 #16

Open cbcoutinho opened 7 years ago

cbcoutinho commented 7 years ago

First off, thanks for producing such a high-quality library. I think ChiDG is great example of what modern Fortran looks like in practice.


TL;DR: the HDF5_ROOT setting isn't working


I'm trying to build ChiDG, and I'm having an issue with finding the correct version of HDF5 on my system. I have multiple versions of the GNU compilers installed on my machine (gcc-4.8.5, gcc-5, gcc-6, and gcc-7), so I have to be careful to link to the correct libraries when building packages with anything besides the 'default' ones on my system installed through the package manager. If I want to use the newer GNU compilers, I have to use custom built libraries for OpenMPI and HDF5 (in the case of ChiDG). The MPI binaries/libraries are successfully found because they're on my PATH and LD_LIBRARY_PATH, respectively, but I'm having trouble with HDF5.

I cloned the master/1.10 version of HDF5 from a github hosted mirror and built it using cmake along with the following options (To build parallel I had to disable CPP lib for some reason See lines 907-929 of hdf5 CMakeLists.txt):

cmake \
-DHDF5_BUILD_FORTRAN:BOOL=ON \
-DCMAKE_INSTALL_PREFIX:STRING=/home/chris/Software/hdf5/install \
-DHDF5_ENABLE_PARALLEL:BOOL=ON \
-DHDF5_BUILD_CPP_LIB:BOOL=OFF \
../hdf5-src/

Even setting HDF5_ROOT to the install location doesn't help anything:

> cd ~/Projects/ChiDG/build/
> export HDF5_ROOT=/home/chris/Software/hdf5/install/
> /usr/bin/cmake ../
-- The Fortran compiler identification is GNU 7.1.1
-- Check for working Fortran compiler: /home/chris/bin/gfortran
-- Check for working Fortran compiler: /home/chris/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /home/chris/bin/gfortran supports Fortran 90
-- Checking whether /home/chris/bin/gfortran supports Fortran 90 -- yes
--  
-- HDF5 Summary:
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) (found
  version "1.10.1")
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindHDF5.cmake:398 (find_package_handle_standard_args)
  CMakeLists.txt:106 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/chris/Projects/ChiDG/build/CMakeFiles/CMakeOutput.log".

I use openSUSE, so it's possible to just download the hdf5 package from a repository, but those are usually built against an earlier version of gcc/gfortran. See the associated error message when I try to make ChiDG:

> /usr/bin/cmake ../ && make 2>&1 | tee make.log
-- The Fortran compiler identification is GNU 7.1.1
-- Check for working Fortran compiler: /home/chris/bin/gfortran
-- Check for working Fortran compiler: /home/chris/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /home/chris/bin/gfortran supports Fortran 90
-- Checking whether /home/chris/bin/gfortran supports Fortran 90 -- yes
--  
-- HDF5 Summary:
-- Found HDF5: /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5_fortran.so;/usr/lib64/mpi/gcc/openmpi/lib64/libhdf5.so;/usr/lib64/libpthread.so;/usr/lib64/libz.so;/usr/lib64/libdl.so;/usr/lib64/libm.so;/usr/lib64/mpi/gcc/openmpi/lib64/libhdf5_hl.so;/usr/lib64/mpi/gcc/openmpi/lib64/libhdf5.so;/usr/lib64/libpthread.so;/usr/lib64/libz.so;/usr/lib64/libdl.so;/usr/lib64/libm.so;/usr/lib64/mpi/gcc/openmpi/lib64/libhdf5hl_fortran.so;/usr/lib64/mpi/gcc/openmpi/lib64/libhdf5_hl.so;/usr/lib64/mpi/gcc/openmpi/lib64/libhdf5_fortran.so;/usr/lib64/mpi/gcc/openmpi/lib64/libhdf5.so;/usr/lib64/libpthread.so;/usr/lib64/libz.so;/usr/lib64/libdl.so;/usr/lib64/libm.so (found version "1.10.0") 
--     HDF5 Libraries: 
--         /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5_fortran.so
--         /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5.so
--         /usr/lib64/libpthread.so
--         /usr/lib64/libz.so
--         /usr/lib64/libdl.so
--         /usr/lib64/libm.so
--         /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5_hl.so
--         /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5.so
--         /usr/lib64/libpthread.so
--         /usr/lib64/libz.so
--         /usr/lib64/libdl.so
--         /usr/lib64/libm.so
--         /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5hl_fortran.so
--         /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5_hl.so
--         /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5_fortran.so
--         /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5.so
--         /usr/lib64/libpthread.so
--         /usr/lib64/libz.so
--         /usr/lib64/libdl.so
--         /usr/lib64/libm.so
--     HDF5 High-Level Libraries: 
--         /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5_hl.so
--         /usr/lib64/mpi/gcc/openmpi/lib64/libhdf5.so
--         /usr/lib64/libpthread.so
--         /usr/lib64/libz.so
--         /usr/lib64/libdl.so
--         /usr/lib64/libm.so
--  
-- BLAS/LAPACK Summary:
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - found
-- A library with BLAS API found.
-- Looking for Fortran cheev
-- Looking for Fortran cheev - found
-- A library with LAPACK API found.
--     LAPACK Libraries: 
--         /usr/lib64/liblapack.so/usr/lib64/libblas.so
--  
-- MPI Summary:
-- Found MPI_Fortran: /home/chris/Software/openmpi/install/lib64/libmpi_usempif08.so;/home/chris/Software/openmpi/install/lib64/libmpi_usempi_ignore_tkr.so;/home/chris/Software/openmpi/install/lib64/libmpi_mpifh.so;/home/chris/Software/openmpi/install/lib64/libmpi.so  
--     MPI Fortran Libraries: 
--         /home/chris/Software/openmpi/install/lib64/libmpi_usempif08.so
--         /home/chris/Software/openmpi/install/lib64/libmpi_usempi_ignore_tkr.so
--         /home/chris/Software/openmpi/install/lib64/libmpi_mpifh.so
--         /home/chris/Software/openmpi/install/lib64/libmpi.so
--     MPI Include Path: 
--         /home/chris/Software/openmpi/install/include/home/chris/Software/openmpi/install/lib64
--  
-- METIS Summary: 
--     METIS Libraries:
--         /usr/lib64/libmetis.so
--  
-- Tecplot Summary: 
--     Tecplot Libraries: 
--         /home/chris/Projects/ChiDG/tecio/linux/lib/libtecio.astdc++pthread
--  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/chris/Projects/ChiDG/build
Scanning dependencies of target coredg
[  0%] Building Fortran object CMakeFiles/coredg.dir/src/constants/mod_kinds.f90.o
[  1%] Building Fortran object CMakeFiles/coredg.dir/src/constants/mod_constants.f90.o
[  1%] Building Fortran object CMakeFiles/coredg.dir/src/parallel/mod_chidg_mpi.f90.o
.
.
.
[ 64%] Building Fortran object CMakeFiles/coredg.dir/src/chidg/type_chidg_data.f90.o
[ 64%] Building Fortran object CMakeFiles/coredg.dir/src/io/mod_hdf_utilities.f90.o
/home/chris/Projects/ChiDG/src/io/mod_hdf_utilities.f90:16:8:

     use hdf5
        1
Fatal Error: Cannot read module file ‘hdf5.mod’ opened at (1), because it was created by a different version of GNU Fortran
compilation terminated.
CMakeFiles/coredg.dir/build.make:1670: recipe for target 'CMakeFiles/coredg.dir/src/io/mod_hdf_utilities.f90.o' failed
make[3]: *** [CMakeFiles/coredg.dir/src/io/mod_hdf_utilities.f90.o] Error 1
CMakeFiles/coredg.dir/build.make:1686: recipe for target 'CMakeFiles/coredg.dir/src/io/mod_hdf_utilities.f90.o.provides' failed
make[2]: *** [CMakeFiles/coredg.dir/src/io/mod_hdf_utilities.f90.o.provides] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/coredg.dir/all' failed
make[1]: *** [CMakeFiles/coredg.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
nwukie commented 7 years ago

Thanks for your feedback. We have put a lot of effort into software design and infrastructure so you're comments are really appreciated. That said, we are always interested in getting input, perspectives, and contributions to software design/infrastructure. Feel free to reach out any time.

Regarding the HDF5 issue. HDF5 has two different build systems: 'configure' and 'CMake'. Unfortunately, they also seem to have different naming conventions for their libraries/include files/locations that get built/installed. The FindHDF module provided by the cmake installation does not seem to properly handle the HDF5-'CMake' build. I would recommend that you try building HDF5 using the 'configure' system.

./configure --prefix=/usr/local/hdf5 --enable-fortran
make 

I have had issues with CMake properly detecting HDF5 libraries in the past. In particular, Fortran components of the libraries. I have filed a few bugs and they have mostly been addressed in the recent versions, but I was always using the 'configure' build. I will investigate a bit more and will look into filing another bug report with CMake.

Regarding ChiDG, I am really pushing for a version 1.0 release later this year. We plan to add some tutorials and iron out a few remaining convenience quirks, at which point I will update the master branch. In the mean time, I would recommend that you checkout the 'dev' branch. Once you get things built, feel free to reach out again with questions about setup/running ChiDG as the documentation here is in progress leading up to our first major release.

cbcoutinho commented 7 years ago

Just saw your email, thought I'd give you a small update:

Compiling HDF5 using configure ended up working - ChiDG was able to build properly

This peaked my interest, so I built hdf5 again with cmake and configure to see what the difference was in their output. Using the same flags as you stated I came up with the two following install directory trees:

in-cmake.txt in-configure.txt

Some interesting takeaways:

This may give you or the hdf5 developers an idea of how to support both build workflows