From 9d121d7e25d6c0879aca46f2b447c1e66c4eaff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Palancher?= Date: Thu, 28 May 2026 12:34:01 +0200 Subject: [PATCH] feat(conf): slurm GPU acct storage by default Automatically enable AccountStorageTRES for all gpus in Slurm. --- CHANGELOG.md | 2 ++ conf/roles/slurm/templates/slurm.conf.j2 | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 427830c..e7143ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to - conf: - Add pkgs.rackslab.io packages repositories by default. - Support GPU gres without model in Slurm configuration. + - Set `AccountingStorageTRES` for GPU GRES when Slurm accounting is enabled + and the cluster defines GPUs. - Add SSL/TLS certificate for Slurm-web with internal CA. - Support serving Slurm-web gateway in HTTP server subfolder. - Add support of slurm-quota (#52). diff --git a/conf/roles/slurm/templates/slurm.conf.j2 b/conf/roles/slurm/templates/slurm.conf.j2 index d8af4f5..aa87c95 100644 --- a/conf/roles/slurm/templates/slurm.conf.j2 +++ b/conf/roles/slurm/templates/slurm.conf.j2 @@ -18,6 +18,18 @@ CredType = cred/slurm AccountingStorageType=accounting_storage/slurmdbd # default: accounting_storage/none AccountingStorageHost={{ slurm_server }} # must be specified, as soon as slurmdbd is used AccountingStorageEnforce=qos,limits,associations # default: none +{% if slurm_with_gres_gpu and 'AccountingStorageTRES' not in slurm_params %} +{% set gpu_tres = ['gres/gpu'] %} +{% for node_type in slurm_compute_nodes %} +{% for model in node_type.gpus %} +{% set has_model = (model in slurm_gpus_models_map and slurm_gpus_models_map.get(model) is not none) %} +{% if has_model %} +{% set _ = gpu_tres.append('gres/gpu:' ~ slurm_gpus_models_map.get(model, 'nvidia')) %} +{% endif %} +{% endfor %} +{% endfor %} +AccountingStorageTRES={{ gpu_tres | unique | sort | join(',') }} +{% endif %} {% endif %} {% if slurm_with_jwt %} AuthAltTypes=auth/jwt