[mpich2-commits] r4024 - in mpich2/trunk/src/pm/hydra/bootstrap: . fork

balaji at mcs.anl.gov balaji at mcs.anl.gov
Thu Mar 12 04:03:32 CDT 2009


Author: balaji
Date: 2009-03-12 04:03:31 -0500 (Thu, 12 Mar 2009)
New Revision: 4024

Added:
   mpich2/trunk/src/pm/hydra/bootstrap/fork/
   mpich2/trunk/src/pm/hydra/bootstrap/fork/Makefile.sm
   mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_finalize.c
   mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_launch.c
   mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_usize.c
   mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_wait.c
Modified:
   mpich2/trunk/src/pm/hydra/bootstrap/Makefile.sm
Log:
Committing in the initial version of the fork bootstrap server.


Modified: mpich2/trunk/src/pm/hydra/bootstrap/Makefile.sm
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/Makefile.sm	2009-03-12 08:50:34 UTC (rev 4023)
+++ mpich2/trunk/src/pm/hydra/bootstrap/Makefile.sm	2009-03-12 09:03:31 UTC (rev 4024)
@@ -4,5 +4,5 @@
 #     See COPYRIGHT in top-level directory.
 #
 
-SUBDIRS_HYDRA_BSS = ssh
+SUBDIRS_HYDRA_BSS = ssh fork
 SUBDIRS = utils @HYDRA_BSS@ .


Property changes on: mpich2/trunk/src/pm/hydra/bootstrap/fork
___________________________________________________________________
Name: svn:ignore
   + Makefile
Makefile.in
configure
configure.lineno
config.*
hydra_config.h*
autom4te*
mpiexec
*.gcov
*.gcda
*.gcno


Added: mpich2/trunk/src/pm/hydra/bootstrap/fork/Makefile.sm
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/fork/Makefile.sm	                        (rev 0)
+++ mpich2/trunk/src/pm/hydra/bootstrap/fork/Makefile.sm	2009-03-12 09:03:31 UTC (rev 4024)
@@ -0,0 +1,19 @@
+# -*- 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 = fork_launch.c fork_wait.c fork_finalize.c fork_usize.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${abs_srcdir}/../utils \
+	-I${abs_srcdir}/../../demux

Added: mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_finalize.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_finalize.c	                        (rev 0)
+++ mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_finalize.c	2009-03-12 09:03:31 UTC (rev 4024)
@@ -0,0 +1,20 @@
+/* -*- 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 "bsci.h"
+#include "bscu.h"
+
+HYD_Status HYD_BSCI_Finalize(void)
+{
+    HYD_Status status = HYD_SUCCESS;
+
+    HYDU_FUNC_ENTER();
+
+    HYDU_FUNC_EXIT();
+    return status;
+}

Added: mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_launch.c	                        (rev 0)
+++ mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_launch.c	2009-03-12 09:03:31 UTC (rev 4024)
@@ -0,0 +1,66 @@
+/* -*- 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 "bsci.h"
+#include "bscu.h"
+
+HYD_Handle handle;
+
+HYD_Status HYD_BSCI_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;
+            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;
+}

Added: mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_usize.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_usize.c	                        (rev 0)
+++ mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_usize.c	2009-03-12 09:03:31 UTC (rev 4024)
@@ -0,0 +1,23 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2008 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "hydra.h"
+#include "bsci.h"
+
+
+/* FIXME: This should probably be added as a default function allowing
+ * the bootstrap server to override if needed. */
+HYD_Status HYD_BSCI_Get_universe_size(int *size)
+{
+    HYD_Status status = HYD_SUCCESS;
+
+    HYDU_FUNC_ENTER();
+
+    *size = -1;
+
+    HYDU_FUNC_EXIT();
+    return status;
+}

Added: mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_wait.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_wait.c	                        (rev 0)
+++ mpich2/trunk/src/pm/hydra/bootstrap/fork/fork_wait.c	2009-03-12 09:03:31 UTC (rev 4024)
@@ -0,0 +1,27 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ *  (C) 2008 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#include "hydra.h"
+#include "bsci.h"
+#include "bscu.h"
+
+/*
+ * HYD_BSCI_Wait_for_completion: We first wait for communication
+ * events from the available processes till all connections have
+ * closed. In the meanwhile, the SIGCHLD handler keeps track of all
+ * the terminated processes.
+ */
+HYD_Status HYD_BSCI_Wait_for_completion(void)
+{
+    HYD_Status status = HYD_SUCCESS;
+
+    HYDU_FUNC_ENTER();
+
+    status = HYD_BSCU_Wait_for_completion();
+
+    HYDU_FUNC_EXIT();
+    return status;
+}



More information about the mpich2-commits mailing list