7
$\begingroup$

I've previously installed the Quantum Espresso (QEsp) binaries using "apt install" on an Ubuntu 16.04.7 LTS distro. This has worked fine, except that calculations don't produce .hdf5 output, which I need to transfer the data to Mathematica/Python/etc. So now I'm compiling from source.

According to [1], QEsp needs a special flag at compile time in order for it to have HDF5 support. In other words, someone could run the command

./configure -with-hdf5=yes

However for me, this produces the output:

The following libraries have been found:
  BLAS_LIBS=-L/opt/intel/mkl/lib/intel64 -lmkl_gf_lp64  -lmkl_sequential -lmkl_core
  LAPACK_LIBS=
  FFT_LIBS=
  HDF5_LIBS=

which I'm pretty sure means that HDF5_LIBS were not found. According to [1], if this happens, I need only specify the include and lib locations using the commands

./configure -with-hdf5-libs=<options> -with-hdf5-include=<path>

where "<options>" and "<path>" are placeholders for the necessary directories. If I run the command

h5fc -show

as per the instructions of [1], I get the following output:

x86_64-conda_cos6-linux-gnu-gfortran -I/home/eugenio/miniconda3/include -L/home/eugenio/miniconda3/lib /home/eugenio/miniconda3/lib/libhdf5hl_fortran.a /home/eugenio/miniconda3/lib/libhdf5_hl.a /home/eugenio/miniconda3/lib/libhdf5_fortran.a /home/eugenio/miniconda3/lib/libhdf5.a -L/home/eugenio/miniconda3/lib -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-rpath,/home/eugenio/miniconda3/lib -L/home/eugenio/miniconda3/lib -lrt -lpthread -lz -ldl -lm -Wl,-rpath -Wl,/home/eugenio/miniconda3/lib

How do I properly specify the include and lib directories, given the above output? How will I know that I have done this correctly, and that it will compile with HDF5 support?

I've unsuccessfully tried a number of different rearrangements, and have heeded the warning in [1] that "directories in the list must be separated by spaces"... I'm pretty sure I'm doing this part incorrectly.

Thanks!

Ref [1]: https://www.quantum-espresso.org/Doc/user_guide/node11.html

$\endgroup$
4
  • 3
    $\begingroup$ I am not familiar with QE, but I know that linking HDF5 from such a Fortran program also has certain requirements to the HDF5 library. 1) You have to compile the HDF5 library with exactly the same set of compilers you also use for the other program. 2) When configuring the HDF5 compilation process you have to make sure that Fortran support (--enable-fortran) and probably also parallel usage (--enable-parallel) are activated. Are these preconditions fulfilled in your case? $\endgroup$ Dec 6, 2021 at 17:11
  • $\begingroup$ I agree with @GregorMichalicek. HDF5 should be configured together with the Fortran compiler, enabling parallel usage before compiling Quantum ESPRESSO. You also should put HDF5 in the path. As you mentioned, the absence of a path in the make.sys indicates QE wasn't compiled with support to HDF5. $\endgroup$ Dec 6, 2021 at 17:16
  • $\begingroup$ @GregorMichalicek, thanks for the response. I don't know since HDF5 came pre-installed on this computer. I'll go ahead and download the source files and try to recompile it from scratch with the appropriate flags. $\endgroup$ Dec 6, 2021 at 17:21
  • 2
    $\begingroup$ @PaulEugenio apt install libhdf5-dev. You might also consider filing a bug ticket against the Ubuntu package about the missing HDF5 support. $\endgroup$ Dec 6, 2021 at 20:08

1 Answer 1

8
$\begingroup$

Here are a few things you could try:

  • ./configure --with-hdf5-libs=<options> --with-hdf5-include=<path> (note the double dashes)
  • export HDF5_LIBS='-L/path/to/your/lib -lhdf5 -lhdf5fortran' before you ./configure
  • Use the new cmake route to install QE (see example instructions here) which should be more robust and will likely replace the configure route at some point in the future

For the cherry on top, I just added HDF5 support to the qe conda-forge feedstock, i.e. you can now (in 1-2h)

conda install -c conda-forge qe

on Linux on MacOS to get a HDF5-enabled, pre-compiled Quantum ESPRESSO 7.0.

Cheers!

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .