Skip to content

Compiling

Alexander Michalek edited this page Aug 18, 2025 · 7 revisions

Makefile

The codebase uses a manually written Makefile located in the top-level directory that has been tested on the Tiger3 HPC system. To build the project, you can use standard make commands. Additionally, make sure that HDF5 and NETCDF modules or paths are defined before building.

Before compiling, it is strongly recommended that you clean any previously built files to ensure a fresh and consistent build:

make clean

Load the required modules:

module load intel/2024.2
module load intel-oneapi/2024.2
module load hdf5/oneapi-2024.2/1.14.4   
module load netcdf/oneapi-2024.2/hdf5-1.14.4/4.9.2

Then compile the project:

make

This will generate the final executable:

bin/routing

Additionally, if compiling on Tiger3 you can directly use the compile script provided:

./compile.sh

Compiler and Flags

The code uses the GNU C++ compiler (g++) and is written in C++17. The Makefile includes optimization flags designed to improve performance on modern hardware:

CXX := icpx
CXXFLAGS := -O3 -ipo -fp-model fast=2 -qopenmp -fma \
            -xSapphireRapids -qopt-report-phase=vec -qopt-prefetch \
            -Rpass=loop-vectorize -Rpass=inline -DNDEBUG -std=c++17

The following libraries are linked during the build:

LDFLAGS := -lboost_system -L${NETCDF_PATH}/lib64 -lnetcdf

Ensure that the NETCDF_PATH environment variable is set correctly and points to a valid NetCDF installation.

Source Organization

The code is organized into several directories, and the Makefile automatically compiles all source files under src/, including nested directories like src/I_O and src/utils.

Object files are stored in a separate build/ directory, and the final binary is placed in the bin/ directory:

src/          → Source files  
build/        → Object files  
bin/          → Final binary  

Compatibility

The code is portable and should compile with any modern C++ compiler that supports:

  • C++17
  • OpenMP
  • Boost
  • NetCDF

The default compiler is icpx, but you may adapt the Makefile for use with:

  • Intel (icpc / icpx)
  • gcc
  • Clang (with OpenMP support)
  • Cray, PGI, or IBM XL C++ compilers

For best results, use the latest version of your compiler, especially if building with OpenMP. Some older versions of Clang may not support OpenMP reliably. Additionally, use what is best for the HPC system at your institution.

Clone this wiki locally