diff --git a/NEWS b/NEWS index 1cc4493226f18824848fb149dcad6d47f7b53454..2fcbebb20f2f78eba21522a2a26b843c4e655b2f 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ documents those changes that are of interest to users and admins. -- In mpi/mpichgm, fix potential problem formatting GMPI_PORT, from Ernest Artiaga, BSC. -- In sched/wiki2 - Report job's account, from Ernest Artiaga, BSC. + -- Add sbatch option "--ntasks-per-node". * Changes in SLURM 1.2.4 ======================== diff --git a/doc/man/man1/sbatch.1 b/doc/man/man1/sbatch.1 index 5ad28155835984b694ea2f66d853e487b8036e91..9888e80478932052a2766886388810d214368c72 100644 --- a/doc/man/man1/sbatch.1 +++ b/doc/man/man1/sbatch.1 @@ -1,4 +1,4 @@ -.TH "sbatch" "1" "SLURM 1.2" "December 2006" "SLURM Commands" +.TH "sbatch" "1" "SLURM 1.2" "April 2007" "SLURM Commands" .SH "NAME" .LP sbatch \- Submit a batch script to SLURM. @@ -247,6 +247,10 @@ Setting this option will prevent system administrators from being able to restart the job (for example, after a scheduled downtime). When a job is requeued, the batch script is initiated from its beginning. +.TP +\fB\-\-ntasks\-per\-node\fR[=]<\fIn\fR> +Specify the number of tasks to be launched per node. + .TP \fB\-o\fR, \fB\-\-output\fR[=]<\fIfilename pattern\fR> Instruct SLURM to connect the batch script's standard output directly to the diff --git a/src/sbatch/opt.c b/src/sbatch/opt.c index ad0beb707a4d1e3f79f6e89dd10390e10c0db75d..bcdf0df6e1c116e4be57f1f122516d3876a7fe57 100644 --- a/src/sbatch/opt.c +++ b/src/sbatch/opt.c @@ -108,6 +108,7 @@ #define LONG_OPT_MLOADER_IMAGE 0x142 #define LONG_OPT_RAMDISK_IMAGE 0x143 #define LONG_OPT_REBOOT 0x144 +#define LONG_OPT_NTASKSPERNODE 0x145 /*---- global variables, defined in opt.h ----*/ opt_t opt; @@ -388,6 +389,7 @@ static void _opt_default() opt.cpus_set = false; opt.min_nodes = 1; opt.max_nodes = 0; + opt.ntasks_per_node = -1; opt.nodes_set = false; opt.time_limit = -1; opt.partition = NULL; @@ -630,6 +632,7 @@ static struct option long_options[] = { {"mloader-image", required_argument, 0, LONG_OPT_MLOADER_IMAGE}, {"ramdisk-image", required_argument, 0, LONG_OPT_RAMDISK_IMAGE}, {"reboot", no_argument, 0, LONG_OPT_REBOOT}, + {"ntasks-per-node", required_argument,0,LONG_OPT_NTASKSPERNODE}, {NULL, 0, 0, 0} }; @@ -1165,6 +1168,9 @@ static void _set_options(int argc, char **argv) case LONG_OPT_REBOOT: opt.reboot = true; break; + case LONG_OPT_NTASKSPERNODE: + opt.ntasks_per_node = _get_int(optarg, "ntasks-per-node"); + break; default: fatal("Unrecognized command line parameter %c", opt_char); @@ -1546,6 +1552,7 @@ static void _opt_list() } info("mail_type : %s", _print_mail_type(opt.mail_type)); info("mail_user : %s", opt.mail_user); + info("ntasks-per-node : %d", opt.ntasks_per_node); str = print_commandline(); info("remote command : `%s'", str); xfree(str); @@ -1570,7 +1577,7 @@ static void _usage(void) " [--mloader-image=path] [--ramdisk-image=path]\n" #endif " [--mail-type=type] [--mail-user=user][--nice[=value]]\n" -" [--no-requeue]\n" +" [--no-requeue] [--ntasks-per-node=n]\n" " [-w hosts...] [-x hosts...] executable [args...]\n"); } @@ -1583,6 +1590,7 @@ static void _help(void) " -n, --ntasks=ntasks number of tasks to run\n" " -N, --nodes=N number of nodes on which to run (N = min[-max])\n" " -c, --cpus-per-task=ncpus number of cpus required per task\n" +" --ntasks-per-node=n number of tasks to invoke on each node\n" " -i, --input=in file for batch script's standard input\n" " -o, --output=out file for batch script's standard output\n" " -e, --error=err file for batch script's standard error\n" diff --git a/src/sbatch/opt.h b/src/sbatch/opt.h index d1b34fcf5277b9cd9bb95d9ea36e36b05d846d43..87f45db211269b2a3638e61e3776eae26d63b65a 100644 --- a/src/sbatch/opt.h +++ b/src/sbatch/opt.h @@ -90,6 +90,7 @@ typedef struct sbatch_options { int minthreads; /* --minthreads=n */ int realmem; /* --mem=n */ long tmpdisk; /* --tmp=n */ + int ntasks_per_node; /* --ntasks-per-node=n */ char *constraints; /* --constraints=, -C constraint*/ bool contiguous; /* --contiguous */ char *nodelist; /* --nodelist=node1,node2,... */ diff --git a/src/sbatch/sbatch.c b/src/sbatch/sbatch.c index 579101b80d3b040993ae2fcb3a7a089b1aeeb332..f1ef0b3d81d7a2b0ef66717c066d29435c1b1075 100644 --- a/src/sbatch/sbatch.c +++ b/src/sbatch/sbatch.c @@ -169,6 +169,8 @@ static int fill_job_desc_from_opts(job_desc_msg_t *desc) if (opt.tmpdisk > -1) desc->job_min_tmp_disk = opt.tmpdisk; desc->num_procs = opt.nprocs * opt.cpus_per_task; + if (opt.ntasks_per_node > -1) + desc->ntasks_per_node = opt.ntasks_per_node; if (opt.nprocs_set) desc->num_tasks = opt.nprocs; if (opt.cpus_set)