[mpich2-commits] r4121 - in mpich2/trunk/src/pm/hydra: . bootstrap bootstrap/slurm

balaji at mcs.anl.gov balaji at mcs.anl.gov
Wed Mar 18 14:46:13 CDT 2009


Author: balaji
Date: 2009-03-18 14:46:13 -0500 (Wed, 18 Mar 2009)
New Revision: 4121

Added:
   mpich2/trunk/src/pm/hydra/bootstrap/slurm/
   mpich2/trunk/src/pm/hydra/bootstrap/slurm/Makefile.sm
   mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm.h
   mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm_init.c
   mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm_launch.c
Modified:
   mpich2/trunk/src/pm/hydra/bootstrap/Makefile.sm
   mpich2/trunk/src/pm/hydra/configure.in
Log:
Initial support for slurm (ticket #443).

Modified: mpich2/trunk/src/pm/hydra/bootstrap/Makefile.sm
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/Makefile.sm	2009-03-18 19:14:41 UTC (rev 4120)
+++ mpich2/trunk/src/pm/hydra/bootstrap/Makefile.sm	2009-03-18 19:46:13 UTC (rev 4121)
@@ -4,5 +4,5 @@
 #     See COPYRIGHT in top-level directory.
 #
 
-SUBDIRS_hydra_bss_names = ssh fork
+SUBDIRS_hydra_bss_names = ssh fork slurm
 SUBDIRS = utils src @hydra_bss_names@ .


Property changes on: mpich2/trunk/src/pm/hydra/bootstrap/slurm
___________________________________________________________________
Name: svn:ignore
   + Makefile.in
Makefile


Added: mpich2/trunk/src/pm/hydra/bootstrap/slurm/Makefile.sm
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/slurm/Makefile.sm	                        (rev 0)
+++ mpich2/trunk/src/pm/hydra/bootstrap/slurm/Makefile.sm	2009-03-18 19:46:13 UTC (rev 4121)
@@ -0,0 +1,20 @@
+# -*- Mode: Makefile; -*-
+#
+# (C) 2008 by Argonne National Laboratory.
+#     See COPYRIGHT in top-level directory.
+#
+
+HYDRA_LIB_PATH = ../../lib
+
+libhydra_a_DIR = ${HYDRA_LIB_PATH}
+libhydra_a_SOURCES = slurm_launch.c slurm_init.c
+INCLUDES = -I${abs_srcdir}/../../include \
+	-I${abs_srcdir}/../../../../include \
+	-I../../include \
+	-I../../../../include \
+	-I${abs_srcdir}/../../launcher/utils \
+	-I${abs_srcdir}/../../pm/utils \
+	-I${abs_srcdir}/../include \
+	-I../include \
+	-I${abs_srcdir}/../utils \
+	-I${abs_srcdir}/../../demux

Added: mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm.h
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm.h	                        (rev 0)
+++ mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm.h	2009-03-18 19:46:13 UTC (rev 4121)
@@ -0,0 +1,14 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2008 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef SLURM_H_INCLUDED
+#define SLURM_H_INCLUDED
+
+#include "hydra_base.h"
+
+HYD_Status HYD_BSCD_slurm_launch_procs(void);
+
+#endif /* SLURM_H_INCLUDED */

Added: mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm_init.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm_init.c	                        (rev 0)
+++ mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm_init.c	2009-03-18 19:46:13 UTC (rev 4121)
@@ -0,0 +1,24 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2008 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "hydra_base.h"
+#include "bsci.h"
+#include "slurm.h"
+
+struct HYD_BSCI_fns HYD_BSCI_fns;
+
+HYD_Status HYD_BSCI_slurm_init(void)
+{
+    HYD_Status status = HYD_SUCCESS;
+
+    HYDU_FUNC_ENTER();
+
+    HYD_BSCI_fns.launch_procs = HYD_BSCD_slurm_launch_procs;
+
+    HYDU_FUNC_EXIT();
+
+    return status;
+}

Added: mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm_launch.c	                        (rev 0)
+++ mpich2/trunk/src/pm/hydra/bootstrap/slurm/slurm_launch.c	2009-03-18 19:46:13 UTC (rev 4121)
@@ -0,0 +1,82 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2008 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "hydra.h"
+#include "hydra_utils.h"
+#include "bscu.h"
+#include "slurm.h"
+
+HYD_Handle handle;
+
+HYD_Status HYD_BSCD_slurm_launch_procs(void)
+{
+    struct HYD_Proc_params *proc_params;
+    struct HYD_Partition_list *partition;
+    char *client_arg[HYD_EXEC_ARGS];
+    int i, arg, process_id;
+    HYD_Status status = HYD_SUCCESS;
+
+    HYDU_FUNC_ENTER();
+
+    /* FIXME: Instead of directly reading from the HYD_Handle
+     * structure, the upper layers should be able to pass what exactly
+     * they want launched. Without this functionality, the proxy
+     * cannot use this and will have to perfom its own launch. */
+    process_id = 0;
+    for (proc_params = handle.proc_params; proc_params; proc_params = proc_params->next) {
+        for (partition = proc_params->partition; partition; partition = partition->next) {
+            if (partition->group_rank)  /* Only rank 0 is spawned */
+                continue;
+
+            /* Setup the executable arguments */
+            arg = 0;
+            /* FIXME: Get the path to srun */
+            client_arg[arg++] = MPIU_Strdup("srun");
+
+            /* Allow X forwarding only if explicitly requested */
+            if (handle.enablex == 1)
+                client_arg[arg++] = MPIU_Strdup("-X");
+            else if (handle.enablex == 0)
+                client_arg[arg++] = MPIU_Strdup("-x");
+            else        /* default mode is disable X */
+                client_arg[arg++] = MPIU_Strdup("-x");
+
+            /* Currently, we do not support any partition names other
+             * than host names */
+            client_arg[arg++] = MPIU_Strdup(partition->name);
+
+            for (i = 0; partition->args[i]; i++)
+                client_arg[arg++] = MPIU_Strdup(partition->args[i]);
+
+            client_arg[arg++] = NULL;
+
+            /* The stdin pointer will be some value for process_id 0;
+             * for everyone else, it's NULL. */
+            status = HYDU_Create_process(client_arg, (process_id == 0 ? &handle.in : NULL),
+                                         &partition->out, &partition->err, &partition->pid);
+            if (status != HYD_SUCCESS) {
+                HYDU_Error_printf("bootstrap spawn process returned error\n");
+                goto fn_fail;
+            }
+
+            for (arg = 0; client_arg[arg]; arg++)
+                HYDU_FREE(client_arg[arg]);
+
+            /* For the remaining processes, set the stdin fd to -1 */
+            if (process_id != 0)
+                handle.in = -1;
+
+            process_id++;
+        }
+    }
+
+  fn_exit:
+    HYDU_FUNC_EXIT();
+    return status;
+
+  fn_fail:
+    goto fn_exit;
+}

Modified: mpich2/trunk/src/pm/hydra/configure.in
===================================================================
--- mpich2/trunk/src/pm/hydra/configure.in	2009-03-18 19:14:41 UTC (rev 4120)
+++ mpich2/trunk/src/pm/hydra/configure.in	2009-03-18 19:46:13 UTC (rev 4121)
@@ -65,7 +65,7 @@
 dnl Check what boot-strap server we should use
 AC_ARG_WITH(hydra-bss, [  --with-hydra-bss           Boot-strap Server],
 		    [ hydra_bss=$withval ],
-		    [ hydra_bss="ssh,fork" ])
+		    [ hydra_bss="ssh,fork,slurm" ])
 AC_MSG_CHECKING(boot-strap server)
 AC_MSG_RESULT($hydra_bss)
 hydra_bss_names="`echo $hydra_bss | sed -e 's/:/ /g' -e 's/,/ /g'`"



More information about the mpich2-commits mailing list