Building HDF5* with Intel® compilers


Introduction

This guide is intended to help Intel® compiler customers build and use the HDF5 library. HDF5 is the latest generation of the HDF libraries, a general purpose library and associated file formats for storing and sharing scientific data. HDF5 is maintained, promoted, and co-developed along with active community support by The HDF Group (THG). THG is a not-for-profit corporation with the mission to sustain HDF technologies and to provide support to HDF user communities. The homepage for THG and HDF5 can be found at http://www.hdfgroup.org/HDF5/.


Version information

HDF5 1.8.8 and later. Versions through HDF5 1.8.13 were tested.
Intel® C++ Compiler for Linux* or Mac OS* X 13.0 or later
Intel® Fortran Compilers for Linux* or Mac OS* X 13.0 or later


Application Notes

HDF5 is a data format and an associated software library designed to store, access, manage, exchange, and archive diverse, complex data in continuously evolving heterogeneous computing and storage environments. HDF5 is extensively used with scientific research, engineering development, and other data.

This application note demonstrates the framework for building HDF5 with the Intel compilers but does NOT claim to represent all possible configurations and variations of the build for all possible target environments.


Obtaining the Source Code

The HDF5 source files should be obtained from the HDF5 Software downloads page at http://www.hdfgroup.org/HDF5/release/obtain5.htmlPlease note the External Library requirements for SZIP and ZLIB and download those if you do not already have those libraries.


Obtaining the latest version of Intel C++ Compiler and Intel Fortran Compiler

Licensed users of the Intel compilers may download the most recent versions of the compiler from the Intel® Download Center: Intel® Registration Center. Other users can download the evaluation copy from https://software.intel.com/en-us/articles/try-buy-tools.


Prerequisites

Software: As mentioned on the HDF5 software downloads page, either SZIP-2.1 or ZLIB libraries can be used for file compression/decompression. Precompiled binaries or sources are available from the HDF5 Software Downloads page for these two libraries.

SZIP: Determine an appropriate location to install SZIP.  Directory /usr/local/szip-2.1 may be a reasonable choice. If you wish to build and install szip from the source files, use the procedure shown below:

export CC=icc
export CXX=icpc
export FC=ifort
export CFLAGS='-O3 -xHost -ip'
export CXXFLAGS='-O3 -xHost -ip'
export FCFLAGS='-O3 -xHost -ip'
tar -zxvf szip-2.1.tar.gz
cd szip-2.1
./configure --prefix=/usr/local/szip-2.1
make
make check
make install

The above example uses the BASH shell syntax for setting environment variables. For other shells, use the appropriate commands to set environment variables CC, CXX, etc. before the make command. Confirm that after the 'make check' command, the result of the tests return the result "All test passed."

Check the directory specified by your --prefix= setting. This directory should contain lib/ and include/directories. For more information on building szip, consult the file named INSTALL in the source directory.

ZLIB:The information shown is for zlib version 1.2.7. zlib is a general purpose data compression library and is a prerequisite for building HDF5. Determine an appropriate location to install zlib. /usr/local/zlib-1.2.7 may be a reasonable choice. If you wish to build and install zlib from the source files, use the procedure shown below:

export CC=icc
export CFLAGS='-O3 -xHost -ip'
tar -zxvf zlib-1.2.7.tar.gz
cd zlib-1.2.7 
./configure --prefix=/usr/local/zlib-1.2.7 
make
make check
make install

The above example uses the BASH shell syntax for setting environment variables. For other shells, use the appropriate commands to set environment variables CC, CXX, etc. before the make command. Confirm that after the 'make check' command, the result of the tests return the result "test OK".

Check the directory specified by your --prefix= setting. This directory should contain lib/, include/, and share/directories. For more information on building zlib, consult the file named "README" in the source directory.


Configuration andSetup Information for HDF5

HDF5 uses an Autoconf "configure" script to determine the build environment and tools and create the necessary build configuration. The first step is to set environment variables to control which compilers are used for the build. These environment variables select the Intel C++ Compiler and the Intel Fortran Compiler.

export CC=icc
export F9X=ifort
export CXX=icpc

As shown above, the environment CC, CXX and F9X are used to specify which compilers are used to build HDF5. The example shown above uses both the Intel C++ Compiler ( CC=icc CXX=icpc ) and the Intel Fortran Compiler ( F9X=ifort ). Note that the Intel C++ compiler driver is named 'icpc'. Do NOT use 'icc' as the C++ compiler. The Intel compilers are GNU compatible, thus you may mix and match the Intel compilers with GNU compilers for C++ and Fortran. However, the mixing of GNU compilers with Intel compilers has not been tested with this application.

There are environment variables such as CFLAGS to pass compiler options to the C compiler. However, the configuration script will automatically detect the Intel compilers and use the appropriate optimization options. Thus, the user need not specify optimization settings unless one wants to override the default settings set by configure.


To Extract the Source files and to Configure and Build HDF5

tar -zxvf hdf5-1.8.8.tar.gz
cd hdf5-1.8.8
./configure --prefix=/usr/local/hdf5-1.8.8 --enable-fortran --enable-cxx
... output of configure ...
make
... watch for fatal errors ...
make check
... verify that all tests return "PASS"
make install

The configure script has many options. Refer to the help provided in the output of "./configure --help" or read the contents of the file README.


Using HDF5

There is user documentation in the doc/html subdirectory of the source file directory. Look for the file "index.html" and view this file in a browser. This doc/html directory can be copied over to the installation directory.

In general, user program include <hdf5.h> and link with -lhdf5. Additional libraries may be necessary. Please see the user documentation for all the details on the use of HDF5. Users are encouraged to use the compiler helper scripts h5cc, h5fc and h5c++ to build their applications. These helper scripts are installed in the bin/ subdirectory of the installation directory.


Known Issues and Limitations


 

Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.