From 9771230b679a8ddb0b810fef1d89751c82efc156 Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Mon, 20 Apr 2015 11:01:56 -0700
Subject: [PATCH] switch/cray: set PMI_CRAY_NO_SMP_ENV

This fixes the setting of PMI_CRAY_NO_SMP_ENV for v15.08.
The previous commit (25b03b8cc65a7625e29d033fd8a0c54b40c44fa5)
worked fine with v14.11, but changes were required to function
with v15.08 and commit 54e53857ef2a2c87137605f53404ccf00ec40447,
which gives user control over packing on a job-by-job basis in
order to over-ride system with packing configuration.
See bugs 819 and 1585
---
 src/plugins/switch/cray/util.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/plugins/switch/cray/util.c b/src/plugins/switch/cray/util.c
index 462d635297b..f30dce3dcab 100644
--- a/src/plugins/switch/cray/util.c
+++ b/src/plugins/switch/cray/util.c
@@ -81,6 +81,18 @@ int create_apid_dir(uint64_t apid, uid_t uid, gid_t gid)
 	return SLURM_SUCCESS;
 }
 
+/* Return TRUE if the job is packing tasks onto nodes */
+static bool _pack_node_test(uint16_t task_dist)
+{
+	if (task_dist & SLURM_DIST_PACK_NODES)
+		return true;
+	if (task_dist & SLURM_DIST_NO_PACK_NODES)
+		return false;
+	if (slurm_get_select_type_param() & CR_PACK_NODES)
+		return true;
+	return false;
+}
+
 /*
  * Set job environment variables used by LLI and PMI
  */
@@ -175,8 +187,8 @@ int set_job_env(stepd_step_rec_t *job, slurm_cray_jobinfo_t *sw_job)
 		non_smp = 1;
 		break;
 	}
-	if ((non_smp == 0) &&
-	    (slurm_get_select_type_param() & CR_PACK_NODES)) {
+
+	if ((non_smp == 0) && _pack_node_test(job->task_dist)) {
 		CRAY_INFO("Non-SMP ordering identified; CR_PACK_NODES");
 		non_smp = 1;
 	}
-- 
GitLab