Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5e37c0d
initial commit coupled dsl
ajocksch Jan 15, 2026
bb73098
Merge branch 'main' into coupled_dsl
ajocksch Jan 20, 2026
1fc39d5
modified hybrid_atm_wrapper.sh
ajocksch Jan 21, 2026
a7d33bd
icon-exclaim repo
ajocksch Jan 21, 2026
f4e63e2
workaround cp spack.yaml
ajocksch Jan 23, 2026
94c0a8c
build-gpu-py-substitute directory
ajocksch Jan 23, 2026
1765df6
bug fix
ajocksch Jan 23, 2026
e866a44
bug fix
ajocksch Jan 23, 2026
b2fae08
corrected README.md
ajocksch Jan 28, 2026
d726b00
Merge remote-tracking branch 'origin/main' into coupled_dsl
n-beech Feb 10, 2026
252dfdf
update runscript with dsl settings
n-beech Feb 10, 2026
6dd5ec4
clarify build settings
n-beech Feb 10, 2026
22d12eb
merge jsbach workaround
n-beech Feb 12, 2026
9be145f
REF: make acc and py-substitute coexist
Feb 27, 2026
ff68992
fix: moved to case specific settings
Feb 27, 2026
c60986e
REF: use GPU_MODE to distinguish builds
Feb 27, 2026
29de641
fix: revert to ~mpi-gpu
Feb 27, 2026
b89535a
FIX: too large wall time for testing
Mar 2, 2026
6d76fed
fix: mimic environment from icon-exclaim repo
Mar 2, 2026
70140dd
ref:add: use new uenv + full build options
Mar 5, 2026
c604d80
ref: example experiment with restart
Mar 5, 2026
62f1b65
upd: new uenv
Mar 5, 2026
132ba4b
ref: remove step by step build instructions
Mar 5, 2026
d984146
add: default cupy-cache dir
Mar 5, 2026
980b126
fix: set spack-c2sm tag to v0.22.2.6
Mar 9, 2026
3fc6492
ref: make GT4PY cache settable
Mar 9, 2026
780c678
use gssr by default
n-beech Mar 10, 2026
4588ce5
add:upd: build timings + latest icon4py/icon-exclaim
Mar 26, 2026
24f0e90
Merge branch 'coupled_dsl' of github.com:C2SM/EXCLAIM_coupled_setup i…
Mar 26, 2026
b06b003
New jsbach naming (#40)
n-beech Mar 26, 2026
c2dc6f3
add:upd: build xpu timings + latest uenv + cupy cache in mem
Mar 26, 2026
52303cf
Merge branch 'coupled_dsl' of github.com:C2SM/EXCLAIM_coupled_setup i…
Mar 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 15 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,23 @@ Collection of utility scripts to build and run the EXCLAIM coupled atmosphere-oc

## Build

### Step by step

To build the coupled setup follow these steps:

```bash
# Start UENV
uenv start --view=default icon/25.2:v3

# Create a base directory
mkdir -p coupled-setup

# Clone this repository in the base directory
cd coupled-setup && git clone git@github.com:C2SM/EXCLAIM_coupled_setup.git

# Copy the build_tools into the base directory
cp EXCLAIM_coupled_setup/build_utils/build_tools.sh .

# Source the build_tools and initialize
source build_tools.sh
cao_init

# Build CPU and GPU with Spack
pushd icon-hybrid/build-cpu && cao_build cpu && popd
pushd icon-hybrid/build-gpu && cao_build gpu && popd
```

Otherwise, if you want to build without Spack, but using our custom build scripts you can run the following instead:

```bash
# Build CPU and GPU without Spack
pushd icon-hybrid/build-cpu && cao_build cpu_nospack && popd
pushd icon-hybrid/build-gpu && cao_build gpu_nospack && popd
```

If you only want to rebuild (e.g. after you made some changes in the code), enter the build directories and run
`cao_rebuild`.

```bash
# Make sure your UENV is active first
uenv status

# Rebuild CPU and GPU executables
cd build-cpu && cao_rebuild && cd ..
cd build-gpu && cao_rebuild && cd ..
```

> Note that to have the build utilities (e.g. `cao_init`, `cao_build`, `cao_rebuild`, ...) available you should source
*build_tools.sh* in all new shells.

### Full build script

To directly do a clean build of the cpu and gpu executables, just execute
To directly do a clean build of the cpu and gpu executables, just execute from the repository root
``` bash
BUILD_TYPE="SPACK" sbatch ./build_utils/full_build.sh
sbatch ./build_utils/full_build.sh
```
from the repository root. You can also use `BUILD_TYPE="NOSPACK"`.
By default:
- the script will compile the `cpu` and `gpu` targets. `--cpu-only` or `--gpu-only` can be used if needed.
- the gpu variant is `GPU_MODE="py-substitute"` (compiling with `icon4py` granules). It can be otherwise set with to `GPU_MODE="acc"` for pure fortran OpenACC implementation.
- the build type is set to `BUILD_TYPE="SPACK"`. A `BUILD_TYPE="NOSPACK"` option is also available but not with `GPU_MODE="py-substitute"`.

`BUILD_TYPE` and `GPU_MODE` can be exported or set on the same line as the `sbatch` command.

You can monitor the build with `tail -f full_build.o`. The build happens on `/dev/shm` on the login nodes. The icon clone will be retrieved at the end of the build as `icon-hybrid` containing the 2 `build-cpu` and `build-gpu` subdirectories.
You can monitor the build with `tail -f full_build.<jobid>.o`. The build happens on `/dev/shm` on the compute nodes. The icon repo will be retrieved at the end of the build as `icon-hybrid` containing the 2 `build-cpu` and `build-gpu-${GPU_MODE}` subdirectories.

## Run

### Basic runs

To run the coupled setup follow these steps:

```bash
Expand Down Expand Up @@ -93,3 +49,7 @@ You can add these options at the end of the `sbatch` command in any order. All o
```bash
jid=$(sbatch --parsable exp.EXCLAIM_COUPLED.run hybrid --profile)
```

### Example script

In order to keep a clean git history an example `launch_exp.sh` script is provided. It contains some of the possible settings (case, nodes, walltime, period, restart interval, etc ...). Copy it and modify at will.
34 changes: 26 additions & 8 deletions build_utils/build_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,24 @@

CAO_BASEDIR="$(pwd)"

CAO_ICON_REPO='git@gitlab.dkrz.de:icon/icon-nwp.git'
CAO_ICON_BRANCH='master'
CAO_ICON_COMMIT='bb4e1d8dc67545860e365841fde94be77d91e234'
# nwp case
#CAO_ICON_REPO='git@gitlab.dkrz.de:icon/icon-nwp.git'
#CAO_ICON_BRANCH='master'
#CAO_ICON_COMMIT='bb4e1d8dc67545860e365841fde94be77d91e234'

# dsl case
CAO_ICON_REPO='git@github.com:C2SM/icon-exclaim.git'
CAO_ICON_BRANCH='icon-dsl'
CAO_ICON_COMMIT='5c5b742a969af2bd491e26cd0a05a35838f121c4'

CAO_BUILD_UTILS_DIR="${CAO_BASEDIR}/EXCLAIM_coupled_setup/build_utils/"
CAO_ICON_DIR="${CAO_BASEDIR}/icon-hybrid"

GPU_MODE="${GPU_MODE:-py-substitute}"

CAO_BUILD_DIRS=(
'build-cpu'
'build-gpu'
'build-gpu-py-substitute'
)

CAO_CONFIG_FILES=(
Expand All @@ -21,8 +29,8 @@ CAO_CONFIG_FILES=(
)

CAO_SPACK_YAML_FILES=(
'spack_cpu.yaml'
'spack_gpu.yaml'
'spack_cpu_double.yaml'
'spack_gpu_double.yaml'
)

CAO_CONFIG_NAMES=()
Expand Down Expand Up @@ -66,6 +74,8 @@ cao_init() {
config_name=${config_name%%.*}
cp ${CAO_BUILD_UTILS_DIR}/${spack_yaml_file} ${CAO_ICON_DIR}/config/cscs/spack/santis_${config_name}_double/spack.yaml
done
cp ${CAO_BASEDIR}/EXCLAIM_coupled_setup/spack/santis_cpu_double/spack.yaml ${CAO_ICON_DIR}/config/cscs/spack/santis_cpu_double/spack.yaml
cp ${CAO_BASEDIR}/EXCLAIM_coupled_setup/spack/santis_gpu_double_py_substitute/spack.yaml ${CAO_ICON_DIR}/config/cscs/spack/santis_gpu_double_py_substitute/spack.yaml

pushd ${CAO_ICON_DIR}
for build_dir in "${CAO_BUILD_DIRS[@]}"; do
Expand All @@ -76,10 +86,18 @@ cao_init() {

cao_build() {
if [[ "$(pwd)" == "${CAO_ICON_DIR}" ]]; then
./config/cscs/santis.${1}.nvhpc
if [[ "${1}" == "cpu" ]]; then
./config/cscs/santis.${1}.nvhpc
else
./config/cscs/santis.${1}.nvhpc.py.substitute
fi
CONFIG_STATUS=$?
else
../config/cscs/santis.${1}.nvhpc
if [[ "${1}" == "cpu" ]]; then
../config/cscs/santis.${1}.nvhpc
else
../config/cscs/santis.${1}.nvhpc.py.substitute
fi
CONFIG_STATUS=$?
fi

Expand Down
1 change: 1 addition & 0 deletions build_utils/config_cscs/SPACK_TAG_SANTIS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tmp_wait_for_compilation
21 changes: 21 additions & 0 deletions build_utils/config_cscs/spack/santis_cpu_double/spack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ICON
#
# ------------------------------------------
# Copyright (C) 2004-2025, DWD, MPI-M, DKRZ, KIT, ETH, MeteoSwiss
# Contact information: icon-model.org
# See AUTHORS.TXT for a list of authors
# See LICENSES/ for license information
# SPDX-License-Identifier: BSD-3-Clause
# ------------------------------------------

spack:
packages:
mpi:
require: [cray-mpich@8.1.30%nvhpc]
specs:
- hdf5%nvhpc +szip +hl +fortran +mpi
- netcdf-c@4.9.2%nvhpc
- icon-exclaim @develop %nvhpc +ecrad ~aes +jsbach +ocean +coupling ~rte-rrtmgp
view: true
concretizer:
unify: true
26 changes: 26 additions & 0 deletions build_utils/config_cscs/spack/santis_gpu_double/spack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ICON
#
# ------------------------------------------
# Copyright (C) 2004-2025, DWD, MPI-M, DKRZ, KIT, ETH, MeteoSwiss
# Contact information: icon-model.org
# See AUTHORS.TXT for a list of authors
# See LICENSES/ for license information
# SPDX-License-Identifier: BSD-3-Clause
# ------------------------------------------

spack:
packages:
all:
variants: +cuda cuda_arch=90
mpi:
require: [cray-mpich@8.1.30%nvhpc]
specs:
- hdf5%nvhpc +szip +hl +fortran +mpi
- netcdf-c@4.9.2%nvhpc
- icon-exclaim @develop %nvhpc
~aes +ecrad +jsbach +ocean +coupling ~rte-rrtmgp
gpu=nvidia-90 ~mpi-gpu +realloc-buf +cuda-graphs +pgi-inlib
fflags="-traceback"
view: true
concretizer:
unify: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ICON
#
# ------------------------------------------
# Copyright (C) 2004-2025, DWD, MPI-M, DKRZ, KIT, ETH, MeteoSwiss
# Contact information: icon-model.org
# See AUTHORS.TXT for a list of authors
# See LICENSES/ for license information
# SPDX-License-Identifier: BSD-3-Clause
# ------------------------------------------

spack:
packages:
all:
variants: +cuda cuda_arch=90
mpi:
require: [cray-mpich@8.1.30%nvhpc]
specs:
- hdf5%nvhpc +szip +hl +fortran +mpi
- netcdf-c@4.9.2%nvhpc
- icon-exclaim @develop %nvhpc
~aes +ecrad +jsbach +ocean +coupling ~rte-rrtmgp
dsl=substitute gpu=nvidia-90 ~mpi-gpu +realloc-buf +cuda-graphs +pgi-inlib
fflags="-traceback"
view: true
concretizer:
unify: true
70 changes: 70 additions & 0 deletions build_utils/config_cscs/spack_install
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/bash

# ICON
#
# ------------------------------------------
# Copyright (C) 2004-2025, DWD, MPI-M, DKRZ, KIT, ETH, MeteoSwiss
# Contact information: icon-model.org
# See AUTHORS.TXT for a list of authors
# See LICENSES/ for license information
# SPDX-License-Identifier: BSD-3-Clause
# ------------------------------------------
set -eu
set -o pipefail


SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)
ICON_DIR=$(cd "${SCRIPT_DIR}/../.."; pwd)
SPACK_VERSION=$1
VARIANT=$2
BUILD_DIR=$3
ENV_TAG=$4
BUILD_THREADS=$5

# Unset positional parameters
# so they are not forwarded to spack-c2sm/setup-env.sh
set --
set +x
set -e

# we allow the script to fail here, as the spack-c2sm repository might already exist in ICON_DIR
if [ -e "$ICON_DIR/spack-c2sm" ]; then
echo "Info: spack-c2sm directory already exists"
echo "Info: In case of spack build issue or if the version is not $SPACK_VERSION, please remove folder $ICON_DIR/spack-c2sm"
else
$ICON_DIR/config/cscs/spack/clean-spack-env.sh # remove spack env if there was any
git clone --depth 1 --recurse-submodules --shallow-submodules -b $SPACK_VERSION https://github.com/C2SM/spack-c2sm.git $ICON_DIR/spack-c2sm
fi

source $ICON_DIR/spack-c2sm/setup-env.sh $ENV_TAG

# The spack spec, i.e. the icon configuration is defined in the enviroment file in the path below
# and is set by the spack activate command
SPACK_ICON_ENV_DIR=$ICON_DIR/config/cscs/spack/$VARIANT
spack env activate -d $SPACK_ICON_ENV_DIR

SPACK_PKG="icon-exclaim@develop"
# if [[ "$VARIANT" == *py* ]]; then
# SPACK_PKG="icon-exclaim@develop"
# else
# SPACK_PKG="icon@develop"
# fi

if [ "$ICON_DIR" != "$BUILD_DIR" ]; then
# out-of-source
spack develop --build-directory $BUILD_DIR --path $ICON_DIR $SPACK_PKG
# # Workaround for spach v0.22 need to concretize once to avoid error
# # ==> Error: build_directory
# if [ ! -d "$SPACK_ICON_ENV_DIR/.spack-env/repos" ]; then
# set +e
# spack concretize > /dev/null 2>&1
# set -e
# fi
else
# in-source
spack develop --path $ICON_DIR $SPACK_PKG
fi

spack install -v -j $BUILD_THREADS

$SCRIPT_DIR/create_sh_env $VARIANT $BUILD_DIR
Loading