-
Notifications
You must be signed in to change notification settings - Fork 1
Compiling
The codebase uses a manually written Makefile located in the top-level directory that has been tested on the Della 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 cleanLoad the required modules:
module load cudatoolkit/12.9
module load openmpi/gcc/4.1.6
module load hdf5/gcc/openmpi-4.1.6/1.14.4
module load netcdf/gcc/hdf5-1.14.4/openmpi-4.1.6/4.9.2Then compile the project from the root:
makeThis will generate the final executable:
bin/runoffThis project uses NVIDIA’s CUDA Compiler (nvcc) along with the GNU C++17 standard for host code. The build process also integrates MPI for parallel execution and links against NetCDF and Boost libraries.
By default, the Makefile compiles with high optimization and GPU support:
NVCCFLAGS := -std=c++17 -rdc=true \
-gencode arch=compute_90,code=sm_90 \
-O2 $(DEVICE_INCLUDES) -DUSE_MODEL_204 -Wno-deprecated-gpu-targets
HOSTFLAGS := -std=c++17 $(HOST_INCLUDES) -DUSE_MODEL_204 \
-L${NETCDF_PATH}/lib64 -lnetcdfThese flags enable:
-
GPU support with architecture-specific optimizations (
sm_90) -
Link-time device code generation (
-rdc=true) -
Model-specific optimizations via
-DUSE_MODEL_204 - NetCDF linking for I/O functionality
When DEBUG=1 is set, the compiler switches to debugging mode:
NVCCFLAGS += -g -G -O0This disables optimizations, generates debugging symbols, and allows device-level debugging of CUDA kernels.
When VERBOSE=1 is specified, the Makefile prints full compilation and linking commands to the console. Without this flag, command output is suppressed for cleaner logs.
- MPI is automatically detected and its include/link flags are appended (
MPI_INC,MPI_LIB). - The build links against the NetCDF library, and you must ensure
NETCDF_PATHis set correctly to a valid NetCDF installation.
You can combine these options when building:
make # Default optimized build
make DEBUG=1 # Build with CUDA debugging enabled
make VERBOSE=1 # Show all compiler/linker commands
make DEBUG=1 VERBOSE=1 # Debug build with verbose outputThe 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 This project is designed for heterogeneous HPC environments and requires both MPI and CUDA support. It should build successfully on systems that provide:
- C++17 support for host code
-
CUDA Toolkit (with
nvcc) for GPU acceleration - MPI for distributed computation
- NetCDF library for input/output operations
The default build uses nvcc (with GNU g++ as the host compiler).
CUDA compilation requires nvcc or a compiler with full CUDA support.
For MPI + CUDA builds, the following setups are recommended:
-
NVIDIA HPC SDK (
nvc++) – Full support for CUDA and MPI. - GNU g++ with nvcc – Standard and widely tested.
- Use the latest CUDA Toolkit and MPI implementation available on your system.
- Ensure that the target GPU architecture (
sm_90by default) matches your hardware; adjust the-gencodeflags in the Makefile if needed. - The code requires CUDA-enabled hardware; no CPU-only fallback is provided.
Getting Started
User Guide
Programmer Guide