Skip to content
Snippets Groups Projects
Commit e2e2396b authored by Christopher J. Morrone's avatar Christopher J. Morrone
Browse files

Rename SLURM_DIST_HOSTFILE to SLURM_DIST_ARBITRARY to better describe the

function of this setting in the slurm protocol.

Eliminate redundant and incorrect "enum distribution_t" in env.h and replace
it with "enum task_dist_states" from slurm.h.  distribution_t was causing
the following inconsistency:

morrone:~$ srun -N3 -n6 -l env |grep SLURM_NODEID |sort
0: SLURM_NODEID=0
1: SLURM_NODEID=0
2: SLURM_NODEID=1
3: SLURM_NODEID=1
4: SLURM_NODEID=2
5: SLURM_NODEID=2
morrone:~$ srun -N3 -n6 -A
morrone:~$ srun -l env |grep SLURM_NODEID |sort
0: SLURM_NODEID=0
1: SLURM_NODEID=1
2: SLURM_NODEID=2
3: SLURM_NODEID=0
4: SLURM_NODEID=1
5: SLURM_NODEID=2
parent 2521aa8f
No related branches found
No related tags found
No related merge requests found
...@@ -208,7 +208,7 @@ enum select_print_mode { ...@@ -208,7 +208,7 @@ enum select_print_mode {
enum task_dist_states { enum task_dist_states {
SLURM_DIST_CYCLIC, /* distribute tasks 1 per node, round robin */ SLURM_DIST_CYCLIC, /* distribute tasks 1 per node, round robin */
SLURM_DIST_BLOCK, /* distribute tasks filling node by node */ SLURM_DIST_BLOCK, /* distribute tasks filling node by node */
SLURM_DIST_HOSTFILE, /* distribute tasks from what hostfile says */ SLURM_DIST_ARBITRARY, /* arbitrary task distribution */
SLURM_DIST_UNKNOWN /* unknown dist */ SLURM_DIST_UNKNOWN /* unknown dist */
}; };
......
...@@ -433,7 +433,7 @@ no_hostfile: ...@@ -433,7 +433,7 @@ no_hostfile:
xfree(req->node_list); xfree(req->node_list);
req->node_list = nodelist; req->node_list = nodelist;
req->num_tasks = count; req->num_tasks = count;
req->task_dist = SLURM_DIST_HOSTFILE; req->task_dist = SLURM_DIST_ARBITRARY;
} }
return count; return count;
} }
...@@ -291,7 +291,7 @@ extern int task_layout(slurm_step_layout_t *step_layout) ...@@ -291,7 +291,7 @@ extern int task_layout(slurm_step_layout_t *step_layout)
if (step_layout->task_dist == SLURM_DIST_CYCLIC) if (step_layout->task_dist == SLURM_DIST_CYCLIC)
return _task_layout_cyclic(step_layout); return _task_layout_cyclic(step_layout);
else if(step_layout->task_dist == SLURM_DIST_HOSTFILE) else if(step_layout->task_dist == SLURM_DIST_ARBITRARY)
return _task_layout_hostfile(step_layout); return _task_layout_hostfile(step_layout);
else else
return _task_layout_block(step_layout); return _task_layout_block(step_layout);
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <slurm/slurm.h>
#include "slurm/slurm.h"
#include "src/common/log.h" #include "src/common/log.h"
#include "src/common/macros.h" #include "src/common/macros.h"
#include "src/common/env.h" #include "src/common/env.h"
...@@ -253,9 +253,20 @@ int setup_env(env_t *env) ...@@ -253,9 +253,20 @@ int setup_env(env_t *env)
} }
if (env->distribution if (env->distribution
&& env->distribution != SRUN_DIST_UNKNOWN) { && env->distribution != SLURM_DIST_UNKNOWN) {
dist = (env->distribution == SRUN_DIST_BLOCK) ? switch(env->distribution) {
"block" : "cyclic"; case SLURM_DIST_CYCLIC:
dist = "cyclic";
break;
case SLURM_DIST_BLOCK:
dist = "block";
break;
case SLURM_DIST_ARBITRARY:
dist = "arbitrary";
break;
default:
dist = "unknown";
}
if (setenvf(&env->env, "SLURM_DISTRIBUTION", "%s", dist)) { if (setenvf(&env->env, "SLURM_DISTRIBUTION", "%s", dist)) {
error("Can't set SLURM_DISTRIBUTION env variable"); error("Can't set SLURM_DISTRIBUTION env variable");
......
...@@ -33,18 +33,12 @@ ...@@ -33,18 +33,12 @@
#include "src/common/macros.h" #include "src/common/macros.h"
enum distribution_t {
SRUN_DIST_BLOCK = 0,
SRUN_DIST_CYCLIC = 1,
SRUN_DIST_UNKNOWN = 2
};
typedef struct env_options { typedef struct env_options {
int nprocs; /* --nprocs=n, -n n */ int nprocs; /* --nprocs=n, -n n */
char *task_count; char *task_count;
bool nprocs_set; /* true if nprocs explicitly set */ bool nprocs_set; /* true if nprocs explicitly set */
bool cpus_set; /* true if cpus_per_task explicitly set */ bool cpus_set; /* true if cpus_per_task explicitly set */
enum distribution_t enum task_dist_states
distribution; /* --distribution=, -m dist */ distribution; /* --distribution=, -m dist */
cpu_bind_type_t cpu_bind_type_t
cpu_bind_type; /* --cpu_bind= */ cpu_bind_type; /* --cpu_bind= */
......
...@@ -415,12 +415,12 @@ try_again: ...@@ -415,12 +415,12 @@ try_again:
step_spec->node_list, job_ptr->job_id); step_spec->node_list, job_ptr->job_id);
goto cleanup; goto cleanup;
} }
if(step_spec->task_dist == SLURM_DIST_HOSTFILE) { if(step_spec->task_dist == SLURM_DIST_ARBITRARY) {
if (!strcmp(slurmctld_conf.switch_type, if (!strcmp(slurmctld_conf.switch_type,
"switch/elan")) { "switch/elan")) {
error("Can't do a HOSTFILE with switch " error("Can't do an ARBITRARY task layout with "
"type elan. Switching DIST type to " "switch type elan. Switching DIST type "
"BLOCK"); "to BLOCK");
xfree(step_spec->node_list); xfree(step_spec->node_list);
step_spec->task_dist == SLURM_DIST_BLOCK; step_spec->task_dist == SLURM_DIST_BLOCK;
FREE_NULL_BITMAP(nodes_picked); FREE_NULL_BITMAP(nodes_picked);
...@@ -593,7 +593,7 @@ step_create ( job_step_create_request_msg_t *step_specs, ...@@ -593,7 +593,7 @@ step_create ( job_step_create_request_msg_t *step_specs,
if ((step_specs->task_dist != SLURM_DIST_CYCLIC) && if ((step_specs->task_dist != SLURM_DIST_CYCLIC) &&
(step_specs->task_dist != SLURM_DIST_BLOCK) && (step_specs->task_dist != SLURM_DIST_BLOCK) &&
(step_specs->task_dist != SLURM_DIST_HOSTFILE)) (step_specs->task_dist != SLURM_DIST_ARBITRARY))
return ESLURM_BAD_DIST; return ESLURM_BAD_DIST;
if (job_ptr->kill_on_step_done) if (job_ptr->kill_on_step_done)
......
...@@ -476,6 +476,8 @@ _step_req_create(srun_job_t *j) ...@@ -476,6 +476,8 @@ _step_req_create(srun_job_t *j)
r->name = xstrdup(opt.job_name); r->name = xstrdup(opt.job_name);
r->relative = false; /* XXX fix this oneday */ r->relative = false; /* XXX fix this oneday */
/* CJM - why are "UNKNOWN" and "default" behaviours different? */
/* why do we even HAVE the SLURM_DIST_UNKNOWN state?? */
switch (opt.distribution) { switch (opt.distribution) {
case SLURM_DIST_UNKNOWN: case SLURM_DIST_UNKNOWN:
r->task_dist = (opt.nprocs <= j->nhosts) ? SLURM_DIST_CYCLIC r->task_dist = (opt.nprocs <= j->nhosts) ? SLURM_DIST_CYCLIC
...@@ -484,10 +486,11 @@ _step_req_create(srun_job_t *j) ...@@ -484,10 +486,11 @@ _step_req_create(srun_job_t *j)
case SLURM_DIST_CYCLIC: case SLURM_DIST_CYCLIC:
r->task_dist = SLURM_DIST_CYCLIC; r->task_dist = SLURM_DIST_CYCLIC;
break; break;
case SLURM_DIST_HOSTFILE: case SLURM_DIST_ARBITRARY:
r->task_dist = SLURM_DIST_HOSTFILE; r->task_dist = SLURM_DIST_ARBITRARY;
break; break;
default: /* (opt.distribution == SLURM_DIST_BLOCK) */ case SLURM_DIST_BLOCK:
default:
r->task_dist = SLURM_DIST_BLOCK; r->task_dist = SLURM_DIST_BLOCK;
break; break;
} }
......
...@@ -245,8 +245,8 @@ static enum task_dist_states _verify_dist_type(const char *arg) ...@@ -245,8 +245,8 @@ static enum task_dist_states _verify_dist_type(const char *arg)
result = SLURM_DIST_CYCLIC; result = SLURM_DIST_CYCLIC;
else if (strncasecmp(arg, "block", len) == 0) else if (strncasecmp(arg, "block", len) == 0)
result = SLURM_DIST_BLOCK; result = SLURM_DIST_BLOCK;
else if (strncasecmp(arg, "hostfile", len) == 0) else if (strncasecmp(arg, "arbitrary", len) == 0)
result = SLURM_DIST_HOSTFILE; result = SLURM_DIST_ARBITRARY;
return result; return result;
} }
......
...@@ -64,7 +64,7 @@ enum modes mode; ...@@ -64,7 +64,7 @@ enum modes mode;
#define format_task_dist_states(t) (t == SLURM_DIST_BLOCK) ? "block" : \ #define format_task_dist_states(t) (t == SLURM_DIST_BLOCK) ? "block" : \
(t == SLURM_DIST_CYCLIC) ? "cyclic" : \ (t == SLURM_DIST_CYCLIC) ? "cyclic" : \
(t == SLURM_DIST_HOSTFILE) ? "hostfile" : \ (t == SLURM_DIST_ARBITRARY) ? "arbitrary" : \
"unknown" "unknown"
enum io_t { enum io_t {
......
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