Compiling FDS with GNU Fortran in Debian Linux - firemodels/fds GitHub Wiki

This tutorial should help the advanced users who are interested in compiling the FDS source code using the latest GNU Fortran (9.x) distribution, Open MPI and linking to the Intel Performance Libraries.

If you are a Debian Stretch 9.X user, you can follow the simplified instructions presented here to deploy the OS provided GNU Fortran 6.3 and OpenMPI 2.0 on your system.

Installing GNU Fortran 9.1 in Debian

Assuming you use Debian Stretch 9.9, in your command window type

$ sudo apt-get install software-properties-common

With your favorite text editor add at the end of the sources.list of repositories that can be found in /etc/apt/sources.list

deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main 
deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main

On terminal add the following key

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 60C317803A41BA51845E371A1E9377A2BA9EF27F

Install build-essential & Update

$ sudo apt-get install build-essential
$ sudo apt update
$ sudo apt install gfortran-9

After installation your gcc and gfortran compilers version 9.1 should come as gcc-9, gfortran-9 on your prompt. Try locating them by typing for example:

$ gfortran-9
gfortran-9: fatal error: no input files
compilation terminated.

This means you have gfortran-9 (and therefore gcc-9). In order to get the correct compiler version on FDS printouts you may want to link gfortran to gfortran-9. To do this type:

$ sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-9 60
$ yes '' | sudo update-alternatives --force --all
$ gfortran --version 

you should see GNU Fortran 9.1.

Compiling and Installing Open MPI

Download the latest version of Open MPI from the site https://www.open-mpi.org , and unzip to a compilation folder of your choice. In my case I downloaded openmpi-4.0.1.tar.gz and unzipped it to:

$ tar -xvf openmpi-4.0.1.tar.gz
$ cd openmpi-4.0.1

Configure Open MPI typing:

$ ./configure FC=gfortran-9 CC=gcc-9 --prefix=/shared/openmpi_64 --enable-mpirun-prefix-by-default --enable-mpi-fortran --enable-static --disable-shared

Then make and install:

$ make -j 2
$ sudo make install

Your mpifort and mpirun executables will be located in /shared/openmpi_64/bin, and the associated libraries to link FDS to will be located in /shared/openmpi_64/lib. Make these directories available to your environment by adding to your ~/.bashrc startup file:

# MPI Library:
export MPIDIST=/shared/openmpi_64
export PATH=$MPIDIST/bin:$PATH
export LD_LIBRARY_PATH=$MPIDIST/lib:$LD_LIBRARY_PATH

Finally, either log out and log in, or open a new terminal to apply your environment changes. Check you are locating these executables:

$ which mpirun
/shared/openmpi_64/bin/mpirun

Installing Intel Math Kernel Library

Follow the instructions provided on this wiki for Linux users.

Compiling and running the code

Go to your updated repo for FDS, you should be able to build the mpi_gnu_linux_64 and mpi_gnu_linux_64_db typing:

$ cd Build/mpi_gnu_linux_64
$ ./make_fds.sh