Skip to content

Compiling

Máté Péntek edited this page May 5, 2023 · 19 revisions

Possible dependencies

For compiling on Linux-based systems you will need the HDF5 libraries for development:

  • OpenMP: sudo apt-get install libhdf5-dev
  • MPI: sudo apt-get install llibhdf5-openmpi-dev

Further dependencies will be prompted for during compilation, if needed. These seem to be the necessary ones in case of a serial (OpenMP) compilation on Ubuntu 18.04 LTS (Linux 4.4.0-91 - accurate as of 30.03.2020). Check and adapt setup in config.mk.

Currently these are known to work with the HDF5 versions:

  • 1.10.0-patch1 (OpenMP)
  • 1.10.7 (OpenMP)
  • 1.10.2 (MPI)
  • 1.12.0 (MPI)

If you are running HDF5 with version greater than 1.10.2, (ex: 1.12.0) you might need to add following flags.

  • CFLAGS += -DH5_USE_110_API -ldl

Check your current version in terminal with h5cc -showconfig.

Steps

  1. Clone the WinGen to your local machine, go into the new library
  2. Necassary make for fftw: make fftw
  3. Make for src and test: make
  4. Navigate into the hdf5_demo folder: cd hdf5_demo
  5. Make the demo: make
  6. Test our your compilation with one of the example setup files (hdf5_demo_2d.wfs or hdf5_demo_3d.wfs): ./hdf5_demo hdf5_demo_3d.wfs
  7. Once done, visualize the resulting file windgen.h5 in an HDF5-viewer (such as HDFCompass)

Here once again all steps once you are in the local folder WindGen:

make fftw
make
cd hdf5_demo
make

And to generate a case

cd hdf5_demo

# for a 3d predefined setup
./hdf5_demo hdf5_demo_3d.wfs

# for a 2d predefined setup
./hdf5_demo hdf5_demo_2d.wfs

Note

You should adapt the config.mk file to fit your necessities and system requirements.

This example serial setup (Ubuntu 22.04.2 LTS - Linux 5.19.0-41-generic & GCC 11.3.0 & HDF5 1.10.7) was done using:

WFS_ROOT              := /<path_to_windgen>/WindGen

# ----------------------------------------------------------------------
#                               NO MPI
# ----------------------------------------------------------------------
CC                    := gcc-11
FFTW_CONFIG_FLAGS     := --prefix=$(WFS_ROOT)/fftw-3.3.10/
CFLAGS                := -O2 -ffast-math -freciprocal-math -I $(WFS_ROOT)/src -I $(WFS_ROOT)/fftw-3.3.10/include
LDFLAGS               := -L $(WFS_ROOT)/src -L $(WFS_ROOT)/fftw-3.3.10/lib
LDFLAGS               += -lwfs -lfftw3
# ----------------------------------------------------------------------
#                               HDF5
# ----------------------------------------------------------------------
HDF5_ROOT              := /usr/lib/x86_64-linux-gnu
ZLIB_ROOT              := /usr/lib/x86_64-linux-gnu
SZIP_ROOT              := /usr/lib/x86_64-linux-gnu
CFLAGS                 += -I/usr/include/hdf5/serial -DHAVE_HDF5
LDFLAGS                += $(HDF5_ROOT)/hdf5/serial/libhdf5.a
# ----------------------------------------------------------------------

LDFLAGS                += -pthread -lsz -lz -ldl -lm

This example parallel setup (Linux 3.13.0-87 & HDF5 1.10.2) (ATTENTION: this needs to be updated for the lates FFTW and GCC!) was done using:

WFS_ROOT              := /<path_to_windgen>/WindGen

# ----------------------------------------------------------------------
#                               MPI
# ----------------------------------------------------------------------
CC                    := mpicc
FFTW_CONFIG_FLAGS     := --enable-mpi --prefix=$(WFS_ROOT)/fftw-3.3.3/
CFLAGS                := -DHAVE_MPI -O0 -I $(WFS_ROOT)/src -I $(WFS_ROOT)/fftw-3.3.3/include
LDFLAGS               := -L $(WFS_ROOT)/src -L $(WFS_ROOT)/fftw-3.3.3/lib
LDFLAGS               += -lwfs -lfftw3_mpi -lfftw3
# ----------------------------------------------------------------------
#                               HDF5
# ----------------------------------------------------------------------
HDF5_ROOT              := /<path_to_hdf5>/hdf5/1.10.2-intel-726msh6
ZLIB_ROOT              := /<path_to_zlib>/zlib-1.2.11-install
SZIP_ROOT              := /<path_to_szip>/szip/2.1
CFLAGS                 += -DHAVE_HDF5 -I $(HDF5_ROOT)/include
LDFLAGS                += $(HDF5_ROOT)/lib/libhdf5.a $(ZLIB_ROOT)/lib/libz.a $(SZIP_ROOT)/lib/libsz.a
# ----------------------------------------------------------------------
LDFLAGS                += -pthread -lsz -lz -ldl -lm

For a proper setup of a considered case refer to the Choice of parameters for a new case.

Project information

Getting started

Clone this wiki locally