Skip to content
Snippets Groups Projects
Commit 5e87d352 authored by Moe Jette's avatar Moe Jette
Browse files

add support for a GRES numeric suffix of "G" (in addition to "G" and "K"

previously supported).
parent b9cc5969
No related branches found
No related tags found
No related merge requests found
.TH "gres.conf" "5" "July 2010" "gres.conf 2.2" "Slurm configuration file"
.TH "gres.conf" "5" "September 2010" "gres.conf 2.2" "Slurm configuration file"
.SH "NAME"
gres.conf \- Slurm configuration file for generic resource management.
......@@ -24,7 +24,8 @@ The overall configuration parameters available include:
\fBCount\fR
Number of resources of this type available on this node.
The default value is set to the number of \fBFile\fR values specified (if any),
otherwise the default value is one.
otherwise the default value is one. A suffix of "K", "M" or "G" may be used
to mulitply the number by 1024, 1048576 or 1073741824 respectively.
.TP
\fBCPUs\fR
......
......@@ -2129,7 +2129,9 @@ Also see \fBGres\fR.
A comma delimited list of generic resources specifications for a node.
Each resource specification consists of a name followed by an optional
colon with a numeric value (default value is one)
(e.g. "Gres=bandwidth:10000,gpus").
(e.g. "Gres=bandwidth:10000,gpus:2").
A suffix of "K", "M" or "G" may be used to mulitply the number by 1024,
1048576 or 1073741824 respectively (e.g. "Gres=bandwidth:4G,gpus:4")..
By default a node has no generic resources.
Also see \fBFeature\fR.
......
......@@ -674,6 +674,8 @@ static int _parse_gres_config(void **dest, slurm_parser_enum_t type,
tmp_long *= 1024;
else if ((last[0] == 'm') || (last[0] == 'M'))
tmp_long *= (1024 * 1024);
else if ((last[0] == 'g') || (last[0] == 'G'))
tmp_long *= (1024 * 1024 * 1024);
else if (last[0] != '\0') {
fatal("Invalid gres data for %s, Count=%s", p->name,
tmp_str);
......@@ -979,6 +981,8 @@ static uint32_t _get_gres_cnt(char *orig_config, char *gres_name,
gres_config_cnt *= 1024;
else if ((last_num[0] == 'm') || (last_num[0] == 'M'))
gres_config_cnt *= (1024 * 1024);
else if ((last_num[0] == 'g') || (last_num[0] == 'G'))
gres_config_cnt *= (1024 * 1024 * 1024);
break;
}
tok = strtok_r(NULL, ",", &last_tok);
......@@ -1009,6 +1013,10 @@ static void _set_gres_cnt(char *orig_config, char **new_config,
if (strcmp(tok, gres_name) &&
strncmp(tok, gres_name_colon, gres_name_colon_len)) {
xstrcat(new_configured_res, tok);
} else if ((new_cnt % (1024 * 1024 * 1024)) == 0) {
new_cnt /= (1024 * 1024 * 1024);
xstrfmtcat(new_configured_res, "%s:%uG",
gres_name, new_cnt);
} else if ((new_cnt % (1024 * 1024)) == 0) {
new_cnt /= (1024 * 1024);
xstrfmtcat(new_configured_res, "%s:%uM",
......@@ -1902,6 +1910,8 @@ static int _job_config_validate(char *config, uint32_t *gres_cnt,
cnt *= 1024;
else if ((last_num[0] == 'm') || (last_num[0] == 'M'))
cnt *= (1024 * 1024);
else if ((last_num[0] == 'g') || (last_num[0] == 'G'))
cnt *= (1024 * 1024 * 1024);
else
return SLURM_ERROR;
if (cnt < 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment