Skip to content

Commit ea1736c

Browse files
committed
auto set GresTypes
1 parent 98f978f commit ea1736c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ unique set of homogenous nodes:
7373
- `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.
7474
- `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.
7575

76-
Note [GresTypes](https://slurm.schedmd.com/slurm.conf.html#OPT_GresTypes) must be set in `openhpc_config` if this is used.
76+
Note [GresTypes](https://slurm.schedmd.com/slurm.conf.html#OPT_GresTypes) is automatically set from `gres` entries.
7777
* `features`: Optional. List of [Features](https://slurm.schedmd.com/slurm.conf.html#OPT_Features) strings.
7878
* `node_params`: Optional. Mapping of additional parameters and values for
7979
[node configuration](https://slurm.schedmd.com/slurm.conf.html#lbAE).

defaults/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ openhpc_default_config:
4040
PropagateResourceLimitsExcept: MEMLOCK
4141
Epilog: /etc/slurm/slurm.epilog.clean
4242
ReturnToService: 2
43+
GresTypes: "{{ ohpc_nodegroup_gres_types if ohpc_nodegroup_gres_types != '' else 'omit' }}"
4344
openhpc_cgroup_default_config:
4445
ConstrainCores: "yes"
4546
ConstrainDevices: "yes"
@@ -48,6 +49,15 @@ openhpc_cgroup_default_config:
4849

4950
openhpc_config: {}
5051
openhpc_cgroup_config: {}
52+
ohpc_nodegroup_gres_types: >-
53+
{{
54+
openhpc_nodegroups |
55+
community.general.json_query('[].gres[].conf') |
56+
map('split', ':') |
57+
map('first') |
58+
unique |
59+
join(',')
60+
}}
5161
openhpc_gres_template: gres.conf.j2
5262
openhpc_cgroup_template: cgroup.conf.j2
5363

0 commit comments

Comments
 (0)