From 0f4b959b25f2babc558caf16a41c8efb9d07dc77 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@llnl.gov>
Date: Fri, 22 Jul 2005 20:37:05 +0000
Subject: [PATCH] took node use out of srun and such for driver 240

---
 src/common/mpi.c    | 14 ++++++++++++--
 src/srun/allocate.c |  2 --
 src/srun/opt.c      | 34 ----------------------------------
 src/srun/opt.h      |  1 -
 4 files changed, 12 insertions(+), 39 deletions(-)

diff --git a/src/common/mpi.c b/src/common/mpi.c
index 178bc735ceb..c2482a599da 100644
--- a/src/common/mpi.c
+++ b/src/common/mpi.c
@@ -176,14 +176,22 @@ int _mpi_init (char *mpi_type)
 {
 	int retval = SLURM_SUCCESS;
 	char *full_type = NULL;
+	int got_default = 0;
+
 	slurm_mutex_lock( &context_lock );
 
 	if ( g_context )
 		goto done;
 	
-	if (mpi_type == NULL)
+	if (mpi_type == NULL) {
+		mpi_type = slurm_get_mpi_default();
+		got_default = 1;
+	}
+	if (mpi_type == NULL) {
+		error("No MPI default set in slurm.conf using %s.",
+		      MPI_DEFAULT);
 		mpi_type = MPI_DEFAULT;
-	
+	}
 	setenvf (NULL, "SLURM_MPI_TYPE", "%s", mpi_type);
 		
 	full_type = xmalloc(sizeof(char) * (strlen(mpi_type)+5));
@@ -206,6 +214,8 @@ int _mpi_init (char *mpi_type)
 	
 		
 done:
+	if(got_default)
+		xfree(mpi_type);
 	slurm_mutex_unlock( &context_lock );
 	return retval;
 }
diff --git a/src/srun/allocate.c b/src/srun/allocate.c
index 91fbf5cb74b..7fc9b283fc0 100644
--- a/src/srun/allocate.c
+++ b/src/srun/allocate.c
@@ -393,8 +393,6 @@ job_desc_msg_create_from_opts (char *script)
 
 	if (opt.conn_type > -1)
 		j->conn_type = opt.conn_type;
-	if (opt.node_use > -1)
-		j->node_use = opt.node_use;
 	if (opt.no_rotate)
 		j->rotate = 0;
 
diff --git a/src/srun/opt.c b/src/srun/opt.c
index 9c2191823cd..704f9bcee4a 100644
--- a/src/srun/opt.c
+++ b/src/srun/opt.c
@@ -77,7 +77,6 @@
 #define OPT_OVERCOMMIT  0x06
 #define OPT_CORE        0x07
 #define OPT_CONN_TYPE	0x08
-#define OPT_NODE_USE	0x09
 #define OPT_NO_ROTATE	0x0a
 #define OPT_GEOMETRY	0x0b
 #define OPT_MPI         0x0c
@@ -100,7 +99,6 @@
 #define LONG_OPT_NOSHELL  0x10f
 #define LONG_OPT_DEBUG_TS 0x110
 #define LONG_OPT_CONNTYPE 0x111
-#define LONG_OPT_NODE_USE 0x112
 #define LONG_OPT_TEST_ONLY 0x113
 #define LONG_OPT_NETWORK  0x114
 #define LONG_OPT_EXCLUSIVE 0x115
@@ -153,7 +151,6 @@ static enum  distribution_t _verify_dist_type(const char *arg);
 static bool  _verify_node_count(const char *arg, int *min, int *max);
 static int   _verify_geometry(const char *arg, int *geometry);
 static int   _verify_conn_type(const char *arg);
-static int   _verify_node_use(const char *arg);
 
 /*---[ end forward declarations of static functions ]---------------------*/
 
@@ -256,25 +253,6 @@ static int _verify_conn_type(const char *arg)
 	return -1;
 }
 
-/*
- * verify that a node usage type in arg is of known form
- * returns the node_use_type or -1 if not recognized
- */
-static int _verify_node_use(const char *arg)
-{
-	int len = strlen(arg);
-
-	if (!strncasecmp(arg, "VIRTUAL", len))
-		return SELECT_VIRTUAL_NODE_MODE;
-	else if (!strncasecmp(arg, "COPROCESSOR", len))
-		return SELECT_COPROCESSOR_MODE;
-	else if (!strncasecmp(arg, "NAV", len))
-		return SELECT_NAV_MODE;
-
-	error("invalid --node-use argument %s ignored.", arg);
-	return -1;
-}
-
 /*
  * verify geometry arguments, must have proper count
  * returns -1 on error, 0 otherwise
@@ -525,7 +503,6 @@ static void _opt_default()
 		opt.geometry[i]	    = -1;
 	opt.no_rotate	    = false;
 	opt.conn_type	    = -1;
-	opt.node_use        = -1;
 
 	opt.euid	    = (uid_t) -1;
 	opt.egid	    = (gid_t) -1;
@@ -578,7 +555,6 @@ env_vars_t env_vars[] = {
   {"SLURM_LABELIO",       OPT_INT,        &opt.labelio,       NULL           },
   {"SLURM_NNODES",        OPT_NODES,      NULL,               NULL           },
   {"SLURM_NO_ROTATE",     OPT_NO_ROTATE,  NULL,               NULL           },
-  {"SLURM_NODE_USE",      OPT_NODE_USE,   NULL,               NULL           },
   {"SLURM_NPROCS",        OPT_INT,        &opt.nprocs,        &opt.nprocs_set},
   {"SLURM_OVERCOMMIT",    OPT_OVERCOMMIT, NULL,               NULL           },
   {"SLURM_PARTITION",     OPT_STRING,     &opt.partition,     NULL           },
@@ -675,10 +651,6 @@ _process_env_var(env_vars_t *e, const char *val)
 		opt.conn_type = _verify_conn_type(val);
 		break;
 	
-	case OPT_NODE_USE:
-		opt.node_use = _verify_node_use(val);
-		break;
-
 	case OPT_NO_ROTATE:
 		opt.no_rotate = true;
 		break;
@@ -795,7 +767,6 @@ static void _opt_args(int argc, char **argv)
 		{"help",             no_argument,       0, LONG_OPT_HELP},
 		{"usage",            no_argument,       0, LONG_OPT_USAGE},
 		{"conn-type",        required_argument, 0, LONG_OPT_CONNTYPE},
-		{"node-use",         required_argument, 0, LONG_OPT_NODE_USE},
 		{"test-only",        no_argument,       0, LONG_OPT_TEST_ONLY},
 		{"network",          required_argument, 0, LONG_OPT_NETWORK},
 		{"propagate",        optional_argument, 0, LONG_OPT_PROPAGATE},
@@ -1081,9 +1052,6 @@ static void _opt_args(int argc, char **argv)
 		case LONG_OPT_CONNTYPE:
 			opt.conn_type = _verify_conn_type(optarg);
 			break;
-		case LONG_OPT_NODE_USE:
-			opt.node_use = _verify_node_use(optarg);
-			break;
 		case LONG_OPT_TEST_ONLY:
 			opt.test_only = true;
 			break;
@@ -1492,8 +1460,6 @@ static void _opt_list()
 	str = print_geometry();
 	info("geometry       : %s", str);
 	xfree(str);
-	if (opt.node_use >= 0)
-		info("node_use       : %u", opt.node_use);
 	if (opt.no_rotate)
 		info("rotate         : no");
 	else
diff --git a/src/srun/opt.h b/src/srun/opt.h
index cbbf9dc43d3..660136ad13d 100644
--- a/src/srun/opt.h
+++ b/src/srun/opt.h
@@ -157,7 +157,6 @@ typedef struct srun_options {
 	int geometry[SYSTEM_DIMENSIONS]; /* --geometry, -g	*/
 	bool no_rotate;		/* --no_rotate, -R		*/
 	int conn_type;		/* --conn-type 			*/
-	int node_use;		/* --node-use			*/
 } opt_t;
 
 opt_t opt;
-- 
GitLab