Skip to content

Commit 4137b2b

Browse files
committed
Add support for autodetection of gres resources
1 parent e5897b7 commit 4137b2b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ each list element:
5858
* `extra_nodes`: Optional. A list of additional node definitions, e.g. for nodes in this group/partition not controlled by this role. Each item should be a dict, with keys/values as per the ["NODE CONFIGURATION"](https://slurm.schedmd.com/slurm.conf.html#lbAE) docs for slurm.conf. Note the key `NodeName` must be first.
5959
* `ram_mb`: Optional. The physical RAM available in each node of this group ([slurm.conf](https://slurm.schedmd.com/slurm.conf.html) parameter `RealMemory`) in MiB. This is set using ansible facts if not defined, equivalent to `free --mebi` total * `openhpc_ram_multiplier`.
6060
* `ram_multiplier`: Optional. An override for the top-level definition `openhpc_ram_multiplier`. Has no effect if `ram_mb` is set.
61-
* `gres`: Optional. List of dicts defining [generic resources](https://slurm.schedmd.com/gres.html). Each dict must define:
61+
* `gres`: Optional. List of dicts defining [generic resources](https://slurm.schedmd.com/gres.html). Each dict should define:
6262
- `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.
63-
- `file`: 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.
64-
63+
- `file`: Optional if `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.
64+
- `autodetect`: Optional if `file` is set, The [auto detection mechanism](https://slurm.schedmd.com/gres.conf.html#OPT_AutoDetect) to use for the resource.
6565
Note [GresTypes](https://slurm.schedmd.com/slurm.conf.html#OPT_GresTypes) must be set in `openhpc_config` if this is used.
6666

6767
* `default`: Optional. A boolean flag for whether this partion is the default. Valid settings are `YES` and `NO`.

templates/gres.conf.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ AutoDetect=off
88
{% set group_name = group.cluster_name|default(openhpc_cluster_name) ~ '_' ~ group.name %}
99
{% set inventory_group_hosts = groups.get(group_name, []) %}
1010
{% for hostlist in (inventory_group_hosts | hostlist_expression) %}
11-
NodeName={{ hostlist }} Name={{ gres_name }} Type={{ gres_type }} File={{ gres.file }}
11+
set file = gres.file | default('')
12+
set autodetect = gres.autodetect | default('')
13+
NodeName={{ hostlist }} Name={{ gres_name }} Type={{ gres_type }}{% if gres.file is truthy %} File={{ gres.file }}{% endif %}{% if gres.autodetect is truthy %} AutoDetect={{ gres.autodetect }}{%endif%}
14+
1215
{% endfor %}
1316
{% endfor %}
1417
{% endif %}

0 commit comments

Comments
 (0)