From 6d4fbfa63d3823544565eb06a8cfe9a96b663aa6 Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Tue, 22 Apr 2014 13:08:08 -0700 Subject: [PATCH] Enable gres type without file This enables use of arbitrary gres types without associated files, only an optional count. --- doc/html/gres.shtml | 2 -- doc/man/man5/gres.conf.5 | 2 -- src/common/gres.c | 17 ++++++++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/doc/html/gres.shtml b/doc/html/gres.shtml index 191ace61ade..0fc84e68540 100644 --- a/doc/html/gres.shtml +++ b/doc/html/gres.shtml @@ -91,8 +91,6 @@ file.</LI> <LI><B>Type</B> Optionally specify the device type. For example, this might be used to identify a specific model of GPU, which users can then specify in their job request. -Requires the use of configuration parameter <B>File</B> so that specific -individual devices can be identified by type. NOTE: This is a new capability added in Slurm version 14.11.</LI> </UL> diff --git a/doc/man/man5/gres.conf.5 b/doc/man/man5/gres.conf.5 index d655242c71f..e0f57e78231 100644 --- a/doc/man/man5/gres.conf.5 +++ b/doc/man/man5/gres.conf.5 @@ -100,8 +100,6 @@ the example below. \fBType\fR An arbitrary string identifying the type of device. For example, a particular model of GPU. -Requires the use of configuration parameter \fBFile\fR so that specific -individual devices can be identified by type. .SH "EXAMPLES" .LP diff --git a/src/common/gres.c b/src/common/gres.c index 278e214e2f1..e15ac527b55 100644 --- a/src/common/gres.c +++ b/src/common/gres.c @@ -702,7 +702,10 @@ static int _parse_gres_config(void **dest, slurm_parser_enum_t type, p->has_file = 1; } - (void) s_p_get_string(&p->type, "Type", tbl); + if (s_p_get_string(&p->type, "Type", tbl) && !p->file) { + p->file = xstrdup("/dev/null"); + p->has_file = 1; + } if (s_p_get_string(&tmp_str, "Count", tbl)) { tmp_long = strtol(tmp_str, &last, 10); @@ -785,7 +788,7 @@ static void _validate_config(slurm_gres_context_t *context_ptr) { ListIterator iter; gres_slurmd_conf_t *gres_slurmd_conf; - int has_file = -1, rec_count = 0; + int has_file = -1, has_type = -1, rec_count = 0; iter = list_iterator_create(gres_conf_list); while ((gres_slurmd_conf = (gres_slurmd_conf_t *) list_next(iter))) { @@ -800,7 +803,15 @@ static void _validate_config(slurm_gres_context_t *context_ptr) "specification while others do not", context_ptr->gres_name); } - if ((has_file == 0) && (rec_count > 1)) { + if (has_type == -1) { + has_type = (int) (gres_slurmd_conf->type != NULL); + } else if (( has_type && !gres_slurmd_conf->type) || + (!has_type && gres_slurmd_conf->type)) { + fatal("gres.conf for %s, some records have Type " + "specification while others do not", + context_ptr->gres_name); + } + if ((has_file == 0) && (has_type == 0) && (rec_count > 1)) { fatal("gres.conf duplicate records for %s", context_ptr->gres_name); } -- GitLab