Skip to content

Commit a551b52

Browse files
committed
Merge remote-tracking branch 'origin/feat/nodegroups' into HEAD
2 parents 51001ed + f5d0698 commit a551b52

File tree

25 files changed

+180
-81
lines changed

25 files changed

+180
-81
lines changed

README.md

Lines changed: 122 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ unique set of homogenous nodes:
6464
- `conf`: A string with the [resource specification](https://slurm.schedmd.com/slurm.conf.html#OPT_Gres_1) but requiring the format `<name>:<type>:<number>`, e.g. `gpu:A100:2`. Note the `type` is an arbitrary string.
6565
- `file`: Omit if `gres_autodetect` is set. A string with the [File](https://slurm.schedmd.com/gres.conf.html#OPT_File) (path to device(s)) for this resource, e.g. `/dev/nvidia[0-1]` for the above example.
6666
Note [GresTypes](https://slurm.schedmd.com/slurm.conf.html#OPT_GresTypes) must be set in `openhpc_config` if this is used.
67+
* `features`: Optional. List of [Features](https://slurm.schedmd.com/slurm.conf.html#OPT_Features) strings.
6768
* `node_params`: Optional. Mapping of additional parameters and values for
6869
[node configuration](https://slurm.schedmd.com/slurm.conf.html#lbAE).
70+
**NB:** Parameters which can be set via the keys above must not be included here.
6971

7072
Each nodegroup will contain hosts from an Ansible inventory group named
7173
`{{ openhpc_cluster_name }}_{{ group_name}}`. Note that:
@@ -79,18 +81,23 @@ unique set of homogenous nodes:
7981
This is used to set `Sockets`, `CoresPerSocket`, `ThreadsPerCore` and
8082
optionally `RealMemory` for the nodegroup.
8183

82-
`openhpc_partitions`: Optional, default `[]`. List of mappings, each defining a
84+
`openhpc_partitions`: Optional. List of mappings, each defining a
8385
partition. Each partition mapping may contain:
8486
* `name`: Required. Name of partition.
85-
* `groups`: Optional. List of nodegroup names. If omitted, the partition name
86-
is assumed to match a nodegroup name.
87+
* `groups`: Optional. List of node group names. If omitted, the node group
88+
with the same name as the partition is used.
8789
* `default`: Optional. A boolean flag for whether this partion is the default. Valid settings are `YES` and `NO`.
88-
* `maxtime`: Optional. A partition-specific time limit following the format of [slurm.conf](https://slurm.schedmd.com/slurm.conf.html) parameter `MaxTime`. The default value is
89-
given by `openhpc_job_maxtime`. The value should be quoted to avoid Ansible conversions.
90+
* `maxtime`: Optional. A partition-specific time limit overriding `openhpc_job_maxtime`.
9091
* `partition_params`: Optional. Mapping of additional parameters and values for
9192
[partition configuration](https://slurm.schedmd.com/slurm.conf.html#SECTION_PARTITION-CONFIGURATION).
93+
**NB:** Parameters which can be set via the keys above must not be included here.
9294

93-
`openhpc_job_maxtime`: Maximum job time limit, default `'60-0'` (60 days). See [slurm.conf](https://slurm.schedmd.com/slurm.conf.html) parameter `MaxTime` for format. The default is 60 days. The value should be quoted to avoid Ansible conversions.
95+
If this variable is not set one partition per nodegroup is created, with default
96+
partition configuration for each.
97+
98+
`openhpc_job_maxtime`: Maximum job time limit, default `'60-0'` (60 days), see
99+
[slurm.conf:MaxTime](https://slurm.schedmd.com/slurm.conf.html#OPT_MaxTime).
100+
**NB:** This should be quoted to avoid Ansible conversions.
94101

95102
`openhpc_cluster_name`: name of the cluster.
96103

@@ -159,50 +166,121 @@ accessed (with facts gathering enabled) using `ansible_local.slurm`. As per the
159166
in mixed case are from from config files. Note the facts are only refreshed
160167
when this role is run.
161168

162-
## Example Inventory
163-
164-
And an Ansible inventory as this:
165-
166-
[openhpc_login]
167-
openhpc-login-0 ansible_host=10.60.253.40 ansible_user=centos
169+
## Example
168170

169-
[openhpc_compute]
170-
openhpc-compute-0 ansible_host=10.60.253.31 ansible_user=centos
171-
openhpc-compute-1 ansible_host=10.60.253.32 ansible_user=centos
171+
### Simple
172172

173-
[cluster_login:children]
174-
openhpc_login
173+
The following creates a cluster with a a single partition `compute`
174+
containing two nodes:
175175

176-
[cluster_control:children]
177-
openhpc_login
176+
```ini
177+
# inventory/hosts:
178+
[hpc_login]
179+
cluster-login-0
178180

179-
[cluster_batch:children]
180-
openhpc_compute
181+
[hpc_compute]
182+
cluster-compute-0
183+
cluster-compute-1
181184

182-
## Example Playbooks
183-
184-
To deploy, create a playbook which looks like this:
185-
186-
---
187-
- hosts:
188-
- cluster_login
189-
- cluster_control
190-
- cluster_batch
191-
become: yes
192-
roles:
193-
- role: openhpc
194-
openhpc_enable:
195-
control: "{{ inventory_hostname in groups['cluster_control'] }}"
196-
batch: "{{ inventory_hostname in groups['cluster_batch'] }}"
197-
runtime: true
198-
openhpc_slurm_service_enabled: true
199-
openhpc_slurm_control_host: "{{ groups['cluster_control'] | first }}"
200-
openhpc_slurm_partitions:
201-
- name: "compute"
202-
openhpc_cluster_name: openhpc
203-
openhpc_packages: []
204-
...
185+
[hpc_control]
186+
cluster-control
187+
```
205188

189+
```yaml
190+
#playbook.yml
191+
---
192+
- hosts: all
193+
become: yes
194+
tasks:
195+
- import_role:
196+
name: stackhpc.openhpc
197+
vars:
198+
openhpc_cluster_name: hpc
199+
openhpc_enable:
200+
control: "{{ inventory_hostname in groups['cluster_control'] }}"
201+
batch: "{{ inventory_hostname in groups['cluster_compute'] }}"
202+
runtime: true
203+
openhpc_slurm_control_host: "{{ groups['cluster_control'] | first }}"
204+
openhpc_nodegroups:
205+
- name: compute
206+
openhpc_partitions:
207+
- name: compute
206208
---
209+
```
210+
211+
### Multiple nodegroups
212+
213+
This example shows how partitions can span multiple types of compute node.
214+
215+
This example inventory describes three types of compute node (login and
216+
control nodes are omitted for brevity):
217+
218+
```ini
219+
# inventory/hosts:
220+
...
221+
[hpc_general]
222+
# standard compute nodes
223+
cluster-general-0
224+
cluster-general-1
225+
226+
[hpc_large]
227+
# large memory nodes
228+
cluster-largemem-0
229+
cluster-largemem-1
230+
231+
[hpc_gpu]
232+
# GPU nodes
233+
cluster-a100-0
234+
cluster-a100-1
235+
...
236+
```
237+
238+
Firstly the `openhpc_nodegroups` is set to capture these inventory groups and
239+
apply any node-level parameters - in this case the `largemem` nodes have
240+
2x cores reserved for some reason, and GRES is configured for the GPU nodes:
241+
242+
```yaml
243+
openhpc_cluster_name: hpc
244+
openhpc_nodegroups:
245+
- name: general
246+
- name: large
247+
node_params:
248+
CoreSpecCount: 2
249+
- name: gpu
250+
gres:
251+
- conf: gpu:A100:2
252+
file: /dev/nvidia[0-1]
253+
```
254+
255+
Now two partitions can be configured - a default one with a short timelimit and
256+
no large memory nodes for testing jobs, and another with all hardware and longer
257+
job runtime for "production" jobs:
258+
259+
```yaml
260+
openhpc_partitions:
261+
- name: test
262+
groups:
263+
- general
264+
- gpu
265+
maxtime: '1:0:0' # 1 hour
266+
default: 'YES'
267+
- name: general
268+
groups:
269+
- general
270+
- large
271+
- gpu
272+
maxtime: '2-0' # 2 days
273+
default: 'NO'
274+
```
275+
Users will select the partition using `--partition` argument and request nodes
276+
with appropriate memory or GPUs using the `--mem` and `--gres` or `--gpus*`
277+
options for `sbatch` or `srun`.
278+
279+
Finally here some additional configuration must be provided for GRES:
280+
```yaml
281+
openhpc_config:
282+
GresTypes:
283+
-gpu
284+
```
207285

208286
<b id="slurm_ver_footnote">1</b> Slurm 20.11 removed `accounting_storage/filetxt` as an option. This version of Slurm was introduced in OpenHPC v2.1 but the OpenHPC repos are common to all OpenHPC v2.x releases. [↩](#accounting_storage)

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ openhpc_slurm_service_started: "{{ openhpc_slurm_service_enabled }}"
44
openhpc_slurm_service:
55
openhpc_slurm_control_host: "{{ inventory_hostname }}"
66
#openhpc_slurm_control_host_address:
7-
openhpc_partitions: []
7+
openhpc_partitions: "{{ openhpc_nodegroups }}"
88
openhpc_nodegroups: []
99
openhpc_cluster_name:
1010
openhpc_packages:

molecule/test1/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
88
runtime: true
99
openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}"
10-
openhpc_slurm_partitions:
10+
openhpc_nodegroups:
1111
- name: "compute"
1212
openhpc_cluster_name: testohpc
1313
tasks:

molecule/test10/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
88
runtime: true
99
openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}"
10-
openhpc_slurm_partitions:
10+
openhpc_nodegroups:
1111
- name: "compute"
1212
openhpc_cluster_name: testohpc
1313
openhpc_slurm_configless: true

molecule/test10/verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
3030
runtime: true
3131
openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}"
32-
openhpc_slurm_partitions:
32+
openhpc_nodegroups:
3333
- name: "compute"
3434
openhpc_cluster_name: testohpc
3535
openhpc_slurm_configless: true

molecule/test11/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
1212
runtime: true
1313
openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}"
14-
openhpc_slurm_partitions:
14+
openhpc_nodegroups:
1515
- name: "compute_orig"
1616
openhpc_cluster_name: testohpc
1717
openhpc_slurm_configless: true

molecule/test11/verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
2727
runtime: true
2828
openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}"
29-
openhpc_slurm_partitions:
29+
openhpc_nodegroups:
3030
- name: "compute_new"
3131
openhpc_cluster_name: testohpc
3232
openhpc_slurm_configless: true

molecule/test12/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
1212
runtime: true
1313
openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}"
14-
openhpc_slurm_partitions:
14+
openhpc_nodegroups:
1515
- name: "compute"
1616
openhpc_cluster_name: testohpc
1717
openhpc_slurm_configless: true

molecule/test13/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
88
runtime: true
99
openhpc_slurm_control_host: "{{ groups['testohpc_control'] | first }}"
10-
openhpc_slurm_partitions:
10+
openhpc_nodegroups:
1111
- name: "compute"
1212
openhpc_cluster_name: testohpc
1313
openhpc_slurm_configless: true

molecule/test14/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
batch: "{{ inventory_hostname in groups['testohpc_compute'] }}"
88
runtime: true
99
openhpc_slurm_control_host: "{{ groups['testohpc_login'] | first }}"
10-
openhpc_slurm_partitions:
10+
openhpc_nodegroups:
1111
- name: "compute"
1212
extra_nodes:
1313
# Need to specify IPs for the non-existent State=DOWN nodes, because otherwise even in this state slurmctld will exclude a node with no lookup information from the config.

0 commit comments

Comments
 (0)