# GPUs, Constraints & Features

Beyond standard CPU/memory resources, the cluster provides special resources you can request via `--gres` and `--constraint`.

## GPU Jobs

To request a GPU, use the `gpu-general-pool` partition and add `--gres=gpu:1`:

```bash
#!/bin/bash
#SBATCH --job-name=gpu_job
#SBATCH --account=my_account
#SBATCH --partition=gpu-general-pool
#SBATCH --qos=my_qos
#SBATCH --time=02:00:00
#SBATCH --ntasks=1
#SBATCH --nodes=1
#SBATCH --cpus-per-task=10
#SBATCH --gres=gpu:1
#SBATCH --mem-per-cpu=4G
#SBATCH --output=gpu_job_%j.out
#SBATCH --error=gpu_job_%j.err

module purge
module load python/python-3.8

# Your GPU commands here
```

## Constraints

Constraints let you target nodes with specific hardware. Add `--constraint=<feature>` to your job script:

```bash
#SBATCH --constraint=localscratch,amd
```

Multiple constraints are comma-separated — the job will only run on nodes matching all of them.

## Available Features

Run `features` on the login node to see the current list. Current features:

<table id="bkmrk-feature-description-"><thead><tr><th>Feature</th><th>Description</th></tr></thead><tbody><tr><td>`Af3`</td><td>Nodes that can run AlphaFold3</td></tr><tr><td>`AMD`</td><td>Nodes with AMD CPU family</td></tr><tr><td>`avx`</td><td>Nodes with AVX CPU capabilities</td></tr><tr><td>`localscratch`</td><td>Nodes with at least 700GB local `/localscratch`</td></tr><tr><td>`ib_bh`</td><td>Nodes with InfiniBand network #1</td></tr><tr><td>`ib_dj`</td><td>Nodes with InfiniBand network #2</td></tr><tr><td>`Intel`</td><td>Nodes with Intel CPU family</td></tr></tbody></table>

## Using Local Scratch

If your job uses `/localscratch`, you must clean up after yourself — space is shared across all jobs on that node. Add this to your script:

```bash
export CACHEDIR=/localscratch/${USER}_${SLURM_JOB_ID}
mkdir -p $CACHEDIR

cleanup() {
  rm -rf -- "$CACHEDIR" || true
}
trap cleanup EXIT INT TERM HUP
```

The `trap` ensures cleanup runs even if the job fails or is cancelled.

## Available GRES Types

```bash
GresTypes=gpu,amd,af3,intel,localscratch
```