Install Yambo with external HDF5 and NetCDF libraries
In the major part of supercomputing centre HDF5 and NetCDF libraries are already installed.
Here we will show how to configure Yambo to use the installed libraries instead of the internal ones.
HFD5 libraries
First of all you have to load the corresponding modules, if available, with something like:
module load hdf5_1.12.0
then you should have in your PATH the executable h5pfc that is a fortran compiler that
automatically link the HDF5 libraries. Now we will extract from this compiler all information to configure Yambo.
Just type:
h5pfc -show
the compiler will show the command line to compiler codes with HDF5, it will look something like (we added the colors):
mpiifort -assume bscc -O3 -g -ip -I/home/netcdf/hdf5-1.12.0_rosa/include -L/home/netcdf/hdf5-1.12.0_rosa/lib /home/netcdf/hdf5-1.12.0_rosa/lib/libhdf5hl_fortran.a /home/netcdf/hdf5-1.12.0_rosa/lib/libhdf5_hl.a /home/netcdf/hdf5-1.12.0_rosa/lib/libhdf5_fortran.a /home/netcdf/hdf5-1.12.0_rosa/lib/libhdf5.a -lz -ldl -lm -Wl,-rpath -Wl,/home/netcdf/hdf5-1.12.0_rosa/lib
from this line we can extract different information the include path in red (/home/netcdf/hdf5-1.12.0_rosa/include), the lib path(/home/netcdf/hdf5-1.12.0_rosa/lib) in green and the list of libraries. The simplest way to use this HDF5 is to pass the installation path to Yambo (remove include or lib at the end):
./configure --enable-hdf5-par-io --with-hdf5-path=/home/netcdf/hdf5-1.12.0_rosa/
if this does not work you can pass separately includedir, libdir and the list of libraries with the command:
./configure --enable-hdf5-par-io --with-hdf5-includedir=/home/netcdf/hdf5-1.12.0_rosa/include \ --with-hdf5-libdir=/home/netcdf/hdf5-1.12.0_rosa/lib \ --with-hdf5-libs="/home/netcdf/hdf5-1.12.0_rosa/lib/libhdf5hl_fortran.a /home/netcdf/hdf5-1.12.0_rosa/lib/libhdf5_hl.a /home/netcdf/hdf5-1.12.0_rosa/lib/libhdf5_fortran.a /home/netcdf/hdf5-1.12.0_rosa/lib/libhdf5.a -lz -ldl -lm"
NetCDF libraries
The story is similar for NetCDF. After you loaded the corresponding module, you can type
nc-config --prefix
you will get the installation path, something like:
/home/netcdf/4.1.3
then add them to Yambo with the line:
./configure --with-netcdf-path=/home/netcdf/4.1.3/ --with-netcdff-path=/home/netcdf/4.1.3/ --with-hdf5-path=/home/netcdf/hdf5-1.12.0_rosa/
notice that your NetCDF libraries should have been compiled with the same HDF5 library you link in Yambo.
If the previous line does not work you can type nc-config --fflags for the includedir, nc-config --flibs
for the libdir and the libraries list, and then add them to the Yambo configure in the same way of the HDF5 libraries.