Skip to content

Commit bded362

Browse files
authored
update documentation about SLURM usage and customization (#207)
* update `usage.md` * update reference.md * update `setting-up-bm5.md`
1 parent 05ef2ae commit bded362

3 files changed

Lines changed: 70 additions & 1 deletion

File tree

docs/src/reference.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ The `general` section contains global settings that apply to all scenarios and t
3030
| `ncores` | integer | Yes | Number of CPU cores to allocate per job. |
3131
| `execution` | string | Yes | Execution backend. Valid values: `local`, `slurm`. |
3232
| `partition` | string | No | SLURM partition to submit jobs to when `execution: slurm`. If omitted, the cluster default partition is used. |
33+
| `slurm_header` | mapping | No | Arbitrary `#SBATCH` directives for `execution: slurm`, as `key: value` pairs using canonical `sbatch` long-option names (e.g. `partition`, `nodes`, `account`, `time`, `qos`, `mem-per-cpu`). `true` renders a bare flag (e.g. `exclusive: true``#SBATCH --exclusive`); `false`, `null`, or an empty string drops the entry. `cpus-per-task` is always derived from `ncores` and cannot be overridden. Unknown keys fail validation. |
34+
| `slurm_prologue` | string | No | Shell commands (e.g. `module load ...`) run before the haddock3 execution line when `execution: slurm`. Do not include `cd <path>` or the `haddock3 ...` invocation — those are always generated automatically. When set, a version-check step is automatically added to the job script after the prologue to detect if it altered the haddock3 version in use. |
3335
| `mol_suffixes` | array of strings | Yes | File suffixes used to identify molecule files. Must contain at least 2 suffixes (typically receptor and ligand). |
3436
| `input_list` | string | Yes | Path to the input list file containing file paths for all targets. |
3537
| `work_dir` | string | Yes | Directory where benchmark results will be stored. Created automatically if it doesn't exist. |
@@ -49,6 +51,29 @@ general:
4951
work_dir: ./results
5052
```
5153
54+
**SLURM example**, using `slurm_header` and `slurm_prologue`:
55+
56+
```yaml
57+
general:
58+
max_concurrent: 4
59+
ncores: 96
60+
execution: slurm
61+
slurm_header:
62+
partition: small
63+
nodes: 1
64+
account: project_XXXXXX
65+
mem-per-cpu: 1500
66+
time: "24:00:00"
67+
qos: standard
68+
exclusive: true
69+
slurm_prologue: |
70+
module load some-module
71+
module load another-module
72+
mol_suffixes: [_r_u, _l_u, _x_u]
73+
input_list: docking/input_list.txt
74+
work_dir: ./results
75+
```
76+
5277
### Notes
5378

5479
- **Local execution**: When using `execution: local`, the total number of CPU cores required is `max_concurrent * ncores`. Ensure your system has enough cores.
@@ -339,6 +364,7 @@ When `execution: local`:
339364
When `execution: slurm`:
340365

341366
- The `sbatch` and `sacct` commands must be available in the system PATH.
367+
- **`slurm_header`**: Keys must be recognized `sbatch` long-option names; an unknown key fails validation. `cpus-per-task` is always derived from `ncores` and cannot be overridden.
342368

343369
---
344370

docs/src/setting-up-bm5.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,13 @@ For SLURM clusters, modify your config:
165165
general:
166166
execution: slurm
167167
ncores: 4
168-
partition: long
168+
slurm_header:
169+
partition: long
170+
account: project_XXXXXX
169171
```
170172
173+
See [Step 3.1: Using SLURM](./usage.md#step-31-using-slurm) for the full `slurm_header`/`slurm_prologue` reference.
174+
171175
## Step 6: Monitor and Manage the Benchmark
172176

173177
### Monitoring Progress

docs/src/usage.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,45 @@ scenarios:
104104
105105
See [Configuration Reference](./reference.md) for complete configuration options.
106106
107+
### Step 3.1: Using SLURM
108+
109+
Set `execution: slurm` in `general` to submit jobs via `sbatch` instead of running them locally. `sbatch` and `sacct` must be available in `PATH`.
110+
111+
> IMPORTANT: `haddock-runner` expects to be executed in the LOGIN node. It will take care of the SLURM submission itself. Do not submit a job with `haddock-runner` to the queue.
112+
113+
**Customizing the `#SBATCH` header**: use `slurm_header` to pass any `sbatch` long option as a YAML mapping:
114+
115+
```yaml
116+
general:
117+
execution: slurm
118+
ncores: 96
119+
slurm_header:
120+
partition: small
121+
nodes: 1
122+
account: project_XXXXXX
123+
mem-per-cpu: 1500
124+
time: "24:00:00"
125+
qos: standard
126+
exclusive: true # renders as a bare `#SBATCH --exclusive` flag
127+
```
128+
129+
- Keys must be recognized `sbatch` long-option names (e.g. `partition`, `nodes`, `account`, `time`, `qos`, `mem-per-cpu`); an unknown key fails validation.
130+
- `cpus-per-task` is always derived from `ncores` and cannot be overridden here.
131+
- `true` renders a bare flag (no value); `false`, `null`, or an empty string drops the entry and lets SLURM's own default apply.
132+
- If `slurm_header` is omitted entirely, SLURM's cluster defaults are used — these vary by system.
133+
134+
**Running setup commands before the job**: use `slurm_prologue` for shell commands (e.g. loading environment modules) that must run before haddock3 executes:
135+
136+
```yaml
137+
general:
138+
slurm_prologue: |
139+
module load some-module
140+
module load another-module
141+
```
142+
143+
- Do **not** add `cd <path>` or the `haddock3 ...` invocation yourself, those lines are always generated automatically and appended after your prologue.
144+
- Because `slurm_prologue` can change the shell environment it might swap the version of `haddock3` you are using. There is an extra (automatic) check directly in the produced job script to double-check the version and avoid any surprises.
145+
107146
### Step 4: Run the Benchmark
108147

109148
Execute `haddock-runner` with your configuration:

0 commit comments

Comments
 (0)