From 457974f4f417abae1c4f11dcf786f99029086a43 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Wed, 10 Oct 2007 19:39:59 +0000
Subject: [PATCH] svn merge -r12475:12483
 https://eris.llnl.gov/svn/slurm/branches/slurm-1.2

---
 NEWS                               |  2 ++
 doc/man/man1/srun.1                |  7 +++++--
 src/plugins/sched/wiki/get_jobs.c  | 13 +++++++++++--
 src/plugins/sched/wiki2/get_jobs.c | 13 +++++++++++--
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index 07705f8741f..70b03228f71 100644
--- a/NEWS
+++ b/NEWS
@@ -78,6 +78,8 @@ documents those changes that are of interest to users and admins.
 =========================
  -- Print warning if non-privileged user requests negative "--nice" value on
     job submission (srun, salloc, and sbatch commands).
+ -- In sched/wiki and sched/wiki2,, add support for srun's 
+    --ntasks-per-node option.
 
 * Changes in SLURM 1.2.18
 =========================
diff --git a/doc/man/man1/srun.1 b/doc/man/man1/srun.1
index 02df4c6aef5..02461ac6523 100644
--- a/doc/man/man1/srun.1
+++ b/doc/man/man1/srun.1
@@ -995,9 +995,10 @@ stdout and/or stderr are redirected from only the task with relative
 id equal to \fItaskid\fR, where 0 <= \fItaskid\fR <= \fIntasks\fR,
 where \fIntasks\fR is the total number of tasks in the current job step.
 stdin is redirected from the stdin of \fBsrun\fR to this same task.
+This file will be written on the node executing the task.
 .TP
 \fIfilename\fR
-fBsrun\fR will redirect stdout and/or stderr to the named file from 
+\fBsrun\fR will redirect stdout and/or stderr to the named file from 
 all tasks.
 stdin will be redirected from the named file and broadcast to all
 tasks in the job.  \fIfilename\fR refers to a path on the host
@@ -1012,7 +1013,9 @@ described above. The following list of format specifiers may be
 used in the format string to generate a filename that will be
 unique to a given jobid, stepid, node, or task. In each case, 
 the appropriate number of files are opened and associated with
-the corresponding tasks.
+the corresponding tasks. Note that any format string containing 
+%t, %n, and/or %N will be written on the node executing the task 
+rather than the node where \fBsrun\fR executes.
 .RS 10
 .TP
 %J
diff --git a/src/plugins/sched/wiki/get_jobs.c b/src/plugins/sched/wiki/get_jobs.c
index 8592fcf34c8..df478987d4c 100644
--- a/src/plugins/sched/wiki/get_jobs.c
+++ b/src/plugins/sched/wiki/get_jobs.c
@@ -326,9 +326,18 @@ static uint32_t _get_job_submit_time(struct job_record *job_ptr)
 
 static uint32_t _get_job_tasks(struct job_record *job_ptr)
 {
+	uint32_t task_cnt = 1;
+
 	if (job_ptr->num_procs)
-		return job_ptr->num_procs;
-	return (uint32_t) 1;
+		task_cnt = job_ptr->num_procs;
+
+	if (job_ptr->details) {
+		task_cnt = MAX(task_cnt,
+			       (_get_job_min_nodes(job_ptr) * 
+			        job_ptr->details->ntasks_per_node));
+	}
+
+	return task_cnt;
 }
 
 static uint32_t	_get_job_time_limit(struct job_record *job_ptr)
diff --git a/src/plugins/sched/wiki2/get_jobs.c b/src/plugins/sched/wiki2/get_jobs.c
index 4fa6b5d3bdf..690d9ac899b 100644
--- a/src/plugins/sched/wiki2/get_jobs.c
+++ b/src/plugins/sched/wiki2/get_jobs.c
@@ -454,9 +454,18 @@ static uint32_t _get_job_submit_time(struct job_record *job_ptr)
 
 static uint32_t _get_job_tasks(struct job_record *job_ptr)
 {
+	uint32_t task_cnt = 1;
+
 	if (job_ptr->num_procs)
-		return job_ptr->num_procs;
-	return (uint32_t) 1;
+		task_cnt = job_ptr->num_procs;
+
+	if (job_ptr->details) {
+		task_cnt = MAX(task_cnt,
+			       (_get_job_min_nodes(job_ptr) * 
+			        job_ptr->details->ntasks_per_node));
+	}
+
+	return task_cnt;
 }
 
 static uint32_t	_get_job_time_limit(struct job_record *job_ptr)
-- 
GitLab