Compile FDS with GNU Fortran & Open MPI on Debian Stretch - firemodels/fds GitHub Wiki
Compile FDS with GNU Fortran & Open MPI on Debian Stretch
This tutorial was created in order to address an issue with compiling FDS on a Debian Stretch installation. For ease of use the author recommends explicitly using a compiler toolchain available from official package repositories as much as possible.
Debian Stretch GNU Fortran/Open MPI toolchain to compile and link MPI applications
The order of installation steps is important.
Installing Intel MKL library from APT repo is not covered yet, but documented in detail by linked Intel docs. The author did successfully use these APT repos with Ubuntu Linux 14.04 while investigating towards an automated approach to provision build infrastructure for continuous integration.
Install Open MPI
Install package libopenmpi-dev
.
vagrant@debian-9:~$ sudo apt install libopenmpi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
autotools-dev libfabric1 libhwloc-dev libhwloc-plugins libhwloc5
libibverbs-dev libibverbs1 libltdl-dev libltdl7 libnl-3-200
libnl-route-3-200 libnuma-dev libnuma1 libopenmpi2 libpciaccess0
libpsm-infinipath1 librdmacm1 libtool ocl-icd-libopencl1 openmpi-bin
openmpi-common
...
Setting up libopenmpi2:amd64 (2.0.2-2) ...
Setting up libopenmpi-dev (2.0.2-2) ...
update-alternatives: using /usr/lib/x86_64-linux-gnu/openmpi/include to provide /usr/include/mpi (mpi) in auto mode
Setting up openmpi-bin (2.0.2-2) ...
update-alternatives: using /usr/bin/mpirun.openmpi to provide /usr/bin/mpirun (mpirun) in auto mode
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Install GNU Fortran compiler
Install package gfortran
.
vagrant@debian-9:~$ sudo apt install gfortran
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
gfortran-6 libgfortran-6-dev
...
Setting up gfortran-6 (6.3.0-18+deb9u1) ...
Setting up gfortran (4:6.3.0-4) ...
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode
Verify installation
Verify gfortran
installation.
vagrant@debian-9:~$ gfortran --version
GNU Fortran (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Verify mpifort
compiler wrapper.
vagrant@debian-9:~$ mpifort --version
GNU Fortran (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
mpifort
is a compiler wrapper used in FDS Makefile
for the underlying GNU Fortran compiler.
vagrant@debian-9:~$ mpifort --showme
gfortran -I/usr/lib/x86_64-linux-gnu/openmpi/include -pthread -I/usr/lib/x86_64-linux-gnu/openmpi/lib -L/usr//lib -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi
Get FDS source code from GitHub
Cloning a specific version (git tag) is more lightweight than cloning the whole repository. Which versions/tags are available?
Get a specific version
$ git clone --branch FDS6.6.0 https://github.com/firemodels/fds.git
Get current master branch (whole repository)
$ git clone https://github.com/firemodels/fds.git
Compile a release build from FDS sources
FDS Makefile
contains two targets supporting builds with GNU Fortran & Open MPI
- mpi_gnu_linux_64 (Release)
- mpi_gnu_linux_64_db (Debug)
To build a release change into folder mpi_gnu_linux_64
.
$ cd fds
$ cd Build/mpi_gnu_linux_64
$ ./make_fds.sh
Run MPI application
Create a new working directory and change current working directory. Adjust paths to your particular file system layout.
$ export OMP_NUM_THREADS=1
$ mpirun ../../Build/mpi_gnu_linux_64/fds_mpi_gnu_linux_64 ../../Verification/Pressure_Solver/duct_flow.fds
Fire Dynamics Simulator
Current Date : May 15, 2018 06:41:17
Revision : -
Revision Date :
Compiler : unknown
Compilation Date : May 15, 2018 06:37:33
MPI Enabled; Number of MPI Processes: 4
OpenMP Enabled; Number of OpenMP Threads: 1
MPI version: 3.1
MPI library version: Open MPI v2.0.2, package: Open MPI pbuilder@sid Distribution, ident: 2.0.2, repo rev: v2.0.1-348-ge291d0e, Jan 31, 2017
Job TITLE : Flow through a duct
Job ID string : duct_flow
Time Step: 1, Simulation Time: 0.13 s
Time Step: 2, Simulation Time: 0.25 s
Time Step: 3, Simulation Time: 0.38 s
Time Step: 4, Simulation Time: 0.50 s
Time Step: 5, Simulation Time: 0.63 s
Time Step: 6, Simulation Time: 0.75 s
Time Step: 7, Simulation Time: 0.88 s
Time Step: 8, Simulation Time: 1.00 s
Time Step: 9, Simulation Time: 1.13 s
Time Step: 10, Simulation Time: 1.25 s
Time Step: 20, Simulation Time: 2.49 s
Time Step: 30, Simulation Time: 3.55 s
Time Step: 40, Simulation Time: 4.48 s
Time Step: 50, Simulation Time: 5.37 s
Time Step: 60, Simulation Time: 6.26 s
Time Step: 70, Simulation Time: 7.15 s
Time Step: 80, Simulation Time: 8.03 s
Time Step: 90, Simulation Time: 8.92 s
Time Step: 100, Simulation Time: 9.81 s
Time Step: 200, Simulation Time: 18.69 s
Time Step: 300, Simulation Time: 27.58 s
Time Step: 400, Simulation Time: 36.46 s
Time Step: 500, Simulation Time: 44.52 s
Time Step: 600, Simulation Time: 52.43 s
Time Step: 696, Simulation Time: 60.00 s
STOP: FDS completed successfully (CHID: duct_flow)
Notable Facts
The order in which packages are installed is important for ease of use. If you first install explicitly gfortran-6
and afterwards libopenmpi-dev
the compiler wrapper /usr/bin/mpifort
is not configured properly. This can be fixed easily but might be confusing for people going throught step-by-step tutorials.
A misconfigured compiler wrapper mpifort
requires the following command to build a release version of FDS.
$ env OMPI_FC=gfortran-6 ./make_fds.sh
Using
OMPI_FC
we explicitly override the Fortran compiler used by compiler wrapper/usr/bin/mpifort
. There is another compiler wrappermpifort.openmpi
that works as expected. Fixing this smaller issue is left to readers.