#!/bin/bash # #SBATCH --job-name=projections #SBATCH --ntasks=1 #SBATCH --cpus-per-task=32 #SBATCH --time=12:00:00 #SBATCH --output=logs/%x_%A_%a.out # # One chunk of one RGI region. Submitted as an array by submit_projections.sh: # # sbatch --array=0- run_projections.slurm # # The array task id is the chunk index, read by run_projections.py. set -e # A fast, node-local directory, unique to this job. Adapt to your cluster. JOB_DIR="/tmp/$USER/$SLURM_JOB_ID" export OGGM_WORKDIR="$JOB_DIR/wd" export OGGM_OUTDIR="$JOB_DIR/out" mkdir -p "$OGGM_WORKDIR" "$OGGM_OUTDIR" # Where all the chunks gather their output (on shared storage) FINAL_DIR="$SLURM_SUBMIT_DIR/output" CONTAINER=/path/to/oggm_container.sif OGGM_COMMIT=master # better: a commit hash or a tag # The container sees only the job directory (writable) and the submit # directory with run_projections.py (read-only). It does not inherit our # environment: the variables run_projections.py reads are exported below. # See "Isolate the container from your files" in the documentation. srun -n 1 -c "${SLURM_JOB_CPUS_PER_NODE}" apptainer exec \ --containall --no-mount bind-paths \ --bind "$JOB_DIR" \ --bind "$SLURM_SUBMIT_DIR:$SLURM_SUBMIT_DIR:ro" \ "$CONTAINER" bash -s <