HDF5 Installation Guide - UMKC-CPG/olcao GitHub Wiki

Preliminaries:

HDF5 may be set up in a few different ways:

  • You system administrator may have installed it already for you.
  • You may use conda to install HDF5.
  • You may download the HDF5 source code and compile it yourself. (Amazingly, I have often found this option to be the easiest.)

Regardless of which HDF5 set up you have, the OLCAO package requires an installation of HDF5 that is configured to include Fortran interfaces and the "deflate" filter.

System administrator installed:

Check what your computer has installed. If your computer uses the modules program then just type module avail (or module avail hdf) to see if there is an HDF5 module available. Then try module list to see if you have it loaded already. If not, then module load <HDF5> where instead of you type the appropriate name of the module that you saw from module avail.

Now, just because the module is available does not mean that it has all the properties you need. You need to check three things. To check them, after you load the hdf5 module, run h5fc -showconfig. Then look through the output to see (1) if it has Fortran interfaces turned on, (2) what the specific compiler is, and (3) if the "deflate" filter is available. If one of those things is missing (i.e., the compiler that HDF5 was compiled with is not the same as the compiler that you are using) then you should ask your system administrator to install it for you with those features. The agreement between the compiler that HDF5 was compiled with and the compiler that you are using is the most common problem. Using different versions of the same compiler may work, but swapping between gfortran and ifort will not work because their ".mod" files are incompatible.

If your system does not have it and you are having trouble getting it installed by your system administrator, then you can install it yourself using conda or from source as instructed below.

Install using conda:

Assuming that you have already set up an olcao conda environment as described in other pages, you should just need to run conda activate olcao followed by conda install hdf5.

As with the system administrator installed version, just because conda installed it for you does not mean that it has all the properties you need. You need to check three things. Run h5fc -showconfig. Then look through the output to see (1) if it has Fortran interfaces turned on, (2) what the specific compiler is, and (3) if the "deflate" filter is available. If the compiler you want to use and the one used by your conda installed hdf5 do not match (enough), then you may want to run conda install gfortran to get a better match. In this way you will have both hdf5 and gfortran installed in your conda environment and you will not be using anything from the system maintained by your system administrator.

Install from source:

  • Download the latest HDF5 source files (in tar.gz format) from the HDF group's website.
  • Transfer this tar file to the cluster on which you'd like to install, and untar it using the command tar -xvzf <fileName>.tar.gz. This will create a new directory. If you downloaded the bzip2 then use -xvjf options and if you downloaded the plain tar file then use -xvf options.
  • Compiling HDF5 requires a Fortran compiler for the Fortran interface which is necessary for use with OLCAO. You will want to set your environment variable FC to whatever Fortran compiler you plan to use when you compile OLCAO. So you might issues a command like export FC=ifort or export FC=gfortran before continuing.
  • Go to the newly created directory, and issue the following command: ./configure --enable-fortran --enable-static --disable-shared --disable-hl --prefix=$HOME. (Note that this may take quite a while depending on the capabilities of your computer. A long estimate is 30 minutes a short one is 5-10 minutes.)
  • The above command prints a lot of information to the screen. Make sure that towards the very end, it shows that the parameter "deflate" is turned on. If it does not, then you may be missing the compression library zlib (filename: libz.so) (or it can't find it in your library search path). Either way, this is probably something that your system administrator should fix because it is such a basic and expected library for any real compute system.
  • At any rate, after the configure command finishes without any obvious errors at the end, you can make and make install to install HDF5. (Again, this process will take some time. A long estimate is 1 hour and a short one is 15 minutes.)
  • You should now be able to use ls ~/bin/h5* to see many executables starting with h5 in your $HOME/bin directory.
  • Now you will need to modify your environment so that the computer can find the HDF5 programs and libraries you just installed every time you want to use them. So, edit your ~/.bashrc or ~/.bash_profile file and add the line export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib:$HOME/include. You will also probably want to make your h5fc work as your default Fortran compiler by adding export FC=h5fc and export PATH=$HOME/bin:$PATH to the same .bashrc or .bash_profile file.
  • As a side note, beware of the fact that different Fortran compilers produce .mod files that are often incompatible with each other. Therefore you should not compile HDF5 with gfortran and then compile OLCAO with ifort or vice-versa because the HDF5 mod files will not correctly integrate. This is a real pain so watch out for it mostly in the case where the system administrator has installed a binary distribution of HDF5.

That should be it. You can test with which h5fc (it should print "~/bin/h5fc"). Then run h5fc -showconfig to make sure that the settings are correct.

⚠️ **GitHub.com Fallback** ⚠️