Turns a plain shell script (*.sw) into a complete SLURM batch script and submits it.
Adds the #SBATCH preamble, ICON4Py environment variables, start/end timestamps and a
sacct job summary — so the template only contains the actual work.
swrap SCRIPT [--backend=...] [--precision=...] [--dry_run] [--save] [-f/--force]| Option | Values | Default |
|---|---|---|
--backend |
dace_cpu, dace_gpu, gtfn_cpu, gtfn_gpu |
dace_cpu |
--precision |
single, mixed, double |
double |
--dry_run |
show generated script instead of submitting | off |
--save |
write the script as <job-name>.slurm |
off |
--force |
skip confirmation prompts | off |
The swrap wrapper runs swrap.py inside the uenv given by SBATCH_UENV and
SBATCH_UENV_VIEW, with the Python of $ICON4PY_PATH/.venv. Each variable is taken, in
decreasing priority, from the calling environment, from machines/$CLUSTER_NAME.env, or from the
generic default in swrap (ICON4PY_PATH=$SCRATCH/icon4py, icon/26.7:rc1, view none).
To support a new machine, add machines/<cluster>.env. A template that needs another icon4py
checkout sets export ICON4PY_PATH=... in its body; that applies to the job, not to the Python
that runs swrap.py.
Any line starting with #SBATCH or #SWRAP_ is treated as preamble and moved to the top of
the generated script; everything else is kept verbatim as the job body.
#SBATCH --key=value— overrides a default (see below).#SWRAP_NO_BACKEND— do not emitBACKEND*variables.#SWRAP_NO_PRECISION— do not emitICON4PY_FLOAT_PRECISION.
Filled in only if not given in the template:
| Key | Default |
|---|---|
uenv / view |
$SBATCH_UENV / $SBATCH_UENV_VIEW (none disables view) |
job-name |
<script stem>_<precision>_<backend> |
output / error |
<job-name>_%j.out / .err |
time |
00:30:00 |
nodes / ntasks |
1 / 1 |
cpus-per-task |
16 (gpu) / 64 (cpu) |
partition |
per host (santis, balfrin, linard) and cpu/gpu |
gres |
gpu:1 for gpu backends |
account |
cwd01 on santis |
In decreasing priority: --precision argument → existing ICON4PY_FLOAT_PRECISION env var →
ICON4PY_FLOAT_PRECISION=... line in the template (which is removed from the body) →
double.
All ICON4PY_* environment variables of the calling shell are exported into the job, together
with BACKEND, BACKEND_NAME and BACKEND_XPU.
swrap nox.sw --backend=dace_cpu --precision=single --save -fgenerates and submits nox_single_dace_cpu.slurm.
swrap nox.sw --backend=dace_cpu --precision=single --save --dry_runshows a preview of the slurm script and asks before saving the slurm script.