Skip to content

Setting up Linux environment

Chandan Paul edited this page Dec 12, 2024 · 12 revisions

Table of Contents:

  1. Setting up environment using Intel oneAPI toolkit
  2. Setting up environment using GNU compiler

1. Setting up environment using Intel oneAPI toolkit

Ensure that git and CMake is installed. If not, depending on your linux distribution execute the git and CMake installation commands from the next section.

To build FDS with the Intel oneAPI compilers, download and install the Base and HPC toolkits at the links below. Install the base toolkit first, then the HPC toolkit.

Add intel compiler to your environment by adding the following lines to your .bash_profile file (replace the path with your intel installation path):

# oneAPI setup
source /opt/intel/oneapi/setvars.sh >& /dev/null

Now check if mpirun and mpiifx executable exist in your environment.

$ which mpirun
/opt/intel/oneapi/mpi/2021.14/bin/mpirun

$ mpiifx -show
ifx -I"/opt/intel/oneapi/mpi/2021.14/include/mpi" -I"/opt/intel/oneapi/mpi/2021.14/include" -I"/opt/intel/oneapi/mpi/2021.14/include/mpi" -L"/opt/intel/oneapi/mpi/2021.14/lib" -L"/opt/intel/oneapi/mpi/2021.14/lib" -Xlinker --enable-new-dtags -Xlinker -rpath -Xlinker "/opt/intel/oneapi/mpi/2021.14/lib" -Xlinker -rpath -Xlinker "/opt/intel/oneapi/mpi/2021.14/lib" -lmpifort -lmpi -ldl -lrt -lpthread

2. Setting up environment using GNU compiler

If you already have git and CMake installed, skip the git and CMake installation step.

2.1 Set up environment Ubuntu (Debian distros)

  • To install git and CMake:
sudo apt update -y
sudo apt install git -y
sudo apt install cmake -y
  • To install gcc and openmpi:
sudo apt update -y
sudo apt install build-essential -y
sudo apt install gfortran -y
sudo apt install openmpi-bin openmpi-common libopenmpi-dev -y

2.2 Set up environment CentOS (RedHat-based distros)

  • To install git and CMake:
sudo dnf update -y
sudo dnf install git -y
sudo dnf install cmake -y
  • To install GNU compilers and openmpi:
sudo dnf update -y
sudo dnf install gcc-toolset-14
source /opt/rh/gcc-toolset-14/enable
sudo dnf install openmpi openmpi-devel -y

Add following lines to you ~/.bash_profile:

# MPI Library:
export MPIDIST=/usr/lib64/openmpi
export PATH=$MPIDIST/bin:$PATH
export LD_LIBRARY_PATH=$MPIDIST/lib:$LD_LIBRARY_PATH

2.3 Other distros

Check the Linux distribution manual about how to install git, CMake, GNU compilers, and openmpi.

2.4 Linking to Intel MKL library (optional)

In order to use Intel MKL library with GNU compilers, export the MKLROOT with Intel MKL installed path:

export MKLROOT=/opt/intel/oneapi/mkl/2023.1.0/

2.5 Check the environment

Now check if mpirun and mpifort executable exist in your environment.

$ which mpirun
/usr/lib64/openmpi/bin/mpirun

$ mpifort -show
gfortran -I/usr/include/openmpi-x86_64 -pthread -I/usr/lib64/openmpi/lib -Wl,-rpath -Wl,/usr/lib64/openmpi/lib -Wl,--enable-new-dtags -L/usr/lib64/openmpi/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi
Clone this wiki locally