dealii / dealii

The development repository for the deal.II finite element library
https://www.dealii.org
Other
1.39k stars 751 forks source link

deal.II does not see the HDF5 package on Ubuntu 18.04 #8957

Closed agrayver closed 2 years ago

agrayver commented 5 years ago

I'm on master. I did (Ubuntu 18.04)

sudo apt-get install libhdf5-mpich-dev

It installed the library to /usr/lib/x86_64-linux-gnu/ and the include to ./include/hdf5/mpich/hdf5.h

Now I have added -DDEAL_WITH_HDF5=ON, but deal.II did not find the library. Adding HDF5_DIR also didn't help because include and lib paths are different.

Eventually I compiled it by specifying everything myself, i.e.:

cmake -DDEAL_II_WITH_HDF5=ON -DHDF5_DIR=/usr/include/hdf5/mpich -DHDF5_LIBRARY=/usr/lib/x86_64-linux-gnu/libhdf5_mpich.so -DHDF5_HL_LIBRARY=/usr/lib/x86_64-linux-gnu/libhdf5_mpich_hl.so -DDEAL_II_WITH_MPI=ON ../

However, this is difficult for users. Can we make deal.II search for HDF5 in standard paths?

tjhei commented 5 years ago

but deal.II did not find the library.

  1. Can you look at the output when running cmake to see if anything is reported about the search?
  2. Here is the code that finds hdf5: https://github.com/dealii/dealii/blob/master/cmake/modules/FindHDF5.cmake You could try adding the relative path hdf5/mpich to the PATH_SUFFIXES to make deal.II find it. Pull request welcome. :-)
masterleinad commented 5 years ago

We could also try if CMake's FindHDF5 (https://cmake.org/cmake/help/v3.16/module/FindHDF5.html) works better.

agrayver commented 5 years ago

Well, adding relative path will only work for include. The lib path depends on the architecture (returned by the ${CMAKE_LIBRARY_ARCHITECTURE}). Additionally, one needs to distinguish between serial/parallel (the latter depends on the MPI installed).

The best way is to get all this from the package-config, which, I believe, CMake's FindHDF5 does.

tamiko commented 5 years ago

The current PPA [1] for 18.04 uses the stock debian package and picks up HDF5. In it, I set the relevant paths simply via CMAKE_PREFIX_PATH:

cmake [...] -DCMAKE_PREFIX_PATH="/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/openmpi;/usr/include/hdf5/openmpi" [...]

I am not sure whether there is really much we can do here - we could of course add mpi-specific hints for the library and include paths - but that's messy at best.

@masterleinad We could look into relaying to CMake's FindHDF5 module (as we do for boost, mpi, etc. as well) - and hoping that the Debian maintainers adjust the module so that it is actually working.

[1] https://launchpad.net/~ginggs/+archive/ubuntu/deal.ii-backports

agrayver commented 5 years ago

I am not sure whether there is really much we can do here - we could of course add mpi-specific hints for the library and include paths - but that's messy at best.

I agree, manual tweaking is a messy path...

At the same time, it worries me more and more than each dependency I add to my software requires a user to be an expert so she knows where the libraries are installed and how to tell CMake about it...

tamiko commented 5 years ago

At the same time, it worries me more and more than each dependency I add to my software requires a user to be an expert so she knows where the libraries are installed and how to tell CMake about it...

Honest question: We put quite some effort into packaging deal.II in Debian and Ubuntu, why not using the packaged version? :-) It is fairly feature complete [1].

On that line, we could try to also package the library for mpich - but that would already be quite a bit more advanced use case.

That said, it is a bit of a personal agenda for me to make configuration as easy as possible. Would you mind sending me your final configuration line? I would be happy to revisit some configuration defaults to make manual configuration on Ubuntu easier.

[1] Current configuration for Debian/Ubuntu:

 10     dh_auto_configure -- \                                                       
 11     -DDEAL_II_CXX_FLAGS="-Wno-nonnull-compare -Wno-address" \                    
 12     -DCMAKE_PREFIX_PATH="/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/openmpi;/usr/include/hdf5/openmpi" \
 13     -DCMAKE_BUILD_TYPE=DebugRelease \                                            
 14     -DDEAL_II_ALLOW_AUTODETECTION=OFF \                                          
 15     -DDEAL_II_ALLOW_BUNDLED=OFF \                                                
 16     -DDEAL_II_ALLOW_PLATFORM_INTROSPECTION=OFF \                                 
 17     -DDEAL_II_HAVE_FP_EXCEPTIONS=FALSE \                                         
 18     -DDEAL_II_COMPONENT_DOCUMENTATION=ON \                                       
 19     -DDEAL_II_WITH_ARPACK=ON \                                                   
 20     -DDEAL_II_WITH_ASSIMP=ON \                                                   
 21     -DDEAL_II_WITH_BOOST=ON \                                                    
 22     -DDEAL_II_WITH_BZIP2=ON \                                                    
 23     -DDEAL_II_WITH_GMSH=ON \                                                     
 24     -DDEAL_II_WITH_GSL=ON \                                                      
 25     -DDEAL_II_WITH_HDF5=ON \                                                     
 26     -DDEAL_II_WITH_LAPACK=ON \                                                   
 27     -DDEAL_II_WITH_MPI=ON \                                                      
 28     -DDEAL_II_WITH_MUPARSER=ON \                                                 
 29     -DDEAL_II_WITH_NETCDF=ON \                                                   
 30     -DDEAL_II_WITH_OPENCASCADE=ON \                                              
 31     -DDEAL_II_WITH_P4EST=ON \                                                    
 32     -DDEAL_II_WITH_PETSC=ON \                                                    
 33     -DDEAL_II_WITH_SCALAPACK=ON \                                                
 34     -DDEAL_II_WITH_SLEPC=ON \                                                    
 35     -DDEAL_II_WITH_SUNDIALS=ON \                                                 
 36     -DDEAL_II_WITH_THREADS=ON \                                                  
 37     -DDEAL_II_WITH_TRILINOS=ON \                                                 
 38     -DDEAL_II_WITH_UMFPACK=ON \                                                  
 39     -DDEAL_II_WITH_ZLIB=ON \                                                     
 40     -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF \                                    
 41     -DDEAL_II_BASE_NAME="deal.ii" \                                              
 42     -DDEAL_II_DOCHTML_RELDIR=share/doc/libdeal.ii-doc/html \                     
 43     -DDEAL_II_DOCREADME_RELDIR=share/doc/libdeal.ii-doc \                        
 44     -DDEAL_II_EXAMPLES_RELDIR=share/doc/libdeal.ii-doc/examples \                
 45     -DDEAL_II_LIBRARY_RELDIR=lib/$(DEB_HOST_MULTIARCH) \                         
 46     -DDEAL_II_PROJECT_CONFIG_RELDIR=share/cmake/deal.II \                        
 47     -DDEAL_II_SHARE_RELDIR=share/deal.ii/         
agrayver commented 5 years ago

Honest question: We put quite some effort into packaging deal.II in Debian and Ubuntu, why not using the packaged version? :-) It is fairly feature complete [1].

I would like to experiment with some master-only features. Besides, all my tool-chain is built for MPICH.

That said, it is a bit of a personal agenda for me to make configuration as easy as possible. Would you mind sending me your final configuration line? I would be happy to revisit some configuration defaults to make manual configuration on Ubuntu easier.

Here is the line: cmake -DDEAL_II_WITH_HDF5=ON -DHDF5_DIR=/usr/include/hdf5/mpich -DHDF5_LIBRARY=/usr/lib/x86_64-linux-gnu/libhdf5_mpich.so -DHDF5_HL_LIBRARY=/usr/lib/x86_64-linux-gnu/libhdf5_mpich_hl.so -DDEAL_II_WITH_MPI=ON ../

Out of interest, why don't you invoke CMake's FindHDF5? I would have thought this is the easiest way.