diff --git a/doc/man/man1/srun.1 b/doc/man/man1/srun.1 index 64a4c9384d0cb8681dbf682bfa677cb340b145b8..c370d8eb18e9feac068750d4c7583f1c1ad6266c 100644 --- a/doc/man/man1/srun.1 +++ b/doc/man/man1/srun.1 @@ -1,6 +1,6 @@ \." $Id$ .\" -.TH SRUN "1" "February 2002" "srun 0.1" "slurm components" +.TH SRUN "1" "October 2002" "srun 0.1" "slurm components" .SH "NAME" srun \- run parallel jobs .SH SYNOPSIS @@ -48,6 +48,9 @@ options. Request resources from partition "\fIpartition\fR." Partitions are created by the slurm administrator. .TP +\fB\-t\fR, \fB\-\-time\fR=\fIminutes\fR +Establish a time limit to terminate the job after the specified number of minutes. +.TP \fB\-\-cddir\fR=\fIpath\fR have the remote processes do a chdir to \fIpath\fR before beginning execution. The default is to chdir to the current working directory @@ -59,6 +62,15 @@ available. By default, \fB\-\-immediate\fR is off, and .B srun will block until resources become available. .TP +\fB\-k\fR, \fB\-\-kill-off\fR +Do not automatically terminate a job of one of the nodes it has been allocated +fails. The job will assume all responsibilities for fault-tolerance. The default +action is to termniate the job upon node failure. +.TP +\fB\-s\fR, \fB\-\-share\fR +The job can share nodes with other running jobs. This may result in faster job +initiation and higher system utilization, but lower application performance. +.TP \fB\-O\fR, \fB\-\-overcommit\fR overcommit resources. Normally, .B srun diff --git a/src/srun/opt.c b/src/srun/opt.c index 28c29e78ed3dd763e0aa9b5f59b8e719f1f9b393..5ae5510f22a9feee1307b9c9312b5f55e673cf6b 100644 --- a/src/srun/opt.c +++ b/src/srun/opt.c @@ -85,6 +85,7 @@ #define OPT_STEAL 0x14 #define OPT_CDDIR 0x15 #define OPT_BATCH 0x16 +#define OPT_TIME 0x17 /* constraint type options */ #define OPT_MINCPUS 0x50 @@ -160,6 +161,9 @@ struct poptOption runTable[] = { {"partition", 'p', POPT_ARG_STRING, &opt.partition, OPT_PARTITION, "partition requested", "partition"}, + {"time", 't', POPT_ARG_INT, &opt.time_limit, OPT_TIME, + "time limit", + "minutes"}, {"cddir", 'D', POPT_ARG_STRING, NULL, OPT_CDDIR, "change current working directory of remote procs", "path"}, @@ -169,6 +173,12 @@ struct poptOption runTable[] = { {"overcommit", 'O', POPT_ARG_NONE, &opt.overcommit, 0, "overcommit resources", }, + {"kill-off", 'k', POPT_ARG_NONE, &opt.fail_kill, 0, + "do not kill job on node failure", + }, + {"share", 's', POPT_ARG_NONE, &opt.share, 0, + "share node with other jobs", + }, {"label", 'l', POPT_ARG_NONE, &opt.labelio, 0, "prepend task number to lines of stdout/err", }, @@ -481,6 +491,7 @@ static void opt_default() opt.nprocs = 1; opt.cpus = 1; opt.nodes = 0; /* nodes need not be set */ + opt.time_limit = -1; opt.partition = NULL; opt.job_name = ""; @@ -499,6 +510,8 @@ static void opt_default() opt.labelio = false; opt.overcommit = false; opt.batch = false; + opt.share = false; + opt.fail_kill = false; opt.immediate = false; diff --git a/src/srun/opt.h b/src/srun/opt.h index aa31e1e0a2259ab3c1eef488635c69eb21f7a68d..d3bbe191d9180a6b3e38c7320c30df3b20a115a0 100644 --- a/src/srun/opt.h +++ b/src/srun/opt.h @@ -94,6 +94,7 @@ typedef struct srun_options { int nprocs; /* --nprocs=n, -n n */ int cpus; /* --cpus_per_task=n, -c n */ int nodes; /* --nodes=n, -N n */ + int time_limit; /* --time, -t */ char *partition; /* --partition=n, -p n */ enum distribution_t distribution; /* --distribution=, -m dist */ @@ -122,6 +123,8 @@ typedef struct srun_options { bool allocate; /* --allocate, -A */ bool overcommit; /* --overcommit, -O */ bool batch; /* --batch, -b */ + bool fail_kill; /* --kill, -k */ + bool share; /* --share, -s */ /* constraint options */ int mincpus; /* --mincpus=n */ diff --git a/src/srun/srun.c b/src/srun/srun.c index 665d8c5786005560724084636b2a23a4746cc413..2a7415a3a81947d308f59ed2586df4e195c38f75 100644 --- a/src/srun/srun.c +++ b/src/srun/srun.c @@ -279,6 +279,13 @@ allocate_nodes(void) job.user_id = opt.uid; + if (opt.fail_kill) + job.kill_on_node_fail = 0; + if (opt.time_limit > -1) + job.time_limit = opt.time_limit; + if (opt.share) + job.shared = 1; + retries = 0; while ((rc = slurm_allocate_resources(&job, &resp, opt.immediate)) == SLURM_FAILURE) { @@ -528,9 +535,13 @@ run_batch_job(void) job.user_id = opt.uid; -/* job.kill_on_node_fail = int; FIXME */ -/* job.time_limit = int; FIXME */ -/* job.shared = int; FIXME */ + if (opt.fail_kill) + job.kill_on_node_fail = 0; + if (opt.time_limit > -1) + job.time_limit = opt.time_limit; + if (opt.share) + job.shared = 1; + job.environment = environ; for (i=0; ; i++) { if (environ[i] == NULL) { @@ -709,6 +720,7 @@ build_script (char *fname, int file_type) shell = get_shell(); strcpy (buffer, "#!"); strcat (buffer, shell); + strcat (buffer, "\n"); buf_used = strlen(buffer); }