[mpich2-commits] r4023 - in mpich2/trunk/src/pm/hydra: bootstrap/ssh include launcher/mpiexec launcher/utils pm/central utils/args

balaji at mcs.anl.gov balaji at mcs.anl.gov
Thu Mar 12 03:50:35 CDT 2009


Author: balaji
Date: 2009-03-12 03:50:34 -0500 (Thu, 12 Mar 2009)
New Revision: 4023

Modified:
   mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c
   mpich2/trunk/src/pm/hydra/include/hydra.h
   mpich2/trunk/src/pm/hydra/include/hydra_base.h
   mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c
   mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c
   mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c
   mpich2/trunk/src/pm/hydra/pm/central/central_launch.c
   mpich2/trunk/src/pm/hydra/utils/args/args.c
Log:
Added some debug information. A lot more is needed.

Modified: mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c	2009-03-12 07:38:31 UTC (rev 4022)
+++ mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c	2009-03-12 08:50:34 UTC (rev 4023)
@@ -59,10 +59,8 @@
 
             /* 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);
+            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;

Modified: mpich2/trunk/src/pm/hydra/include/hydra.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra.h	2009-03-12 07:38:31 UTC (rev 4022)
+++ mpich2/trunk/src/pm/hydra/include/hydra.h	2009-03-12 08:50:34 UTC (rev 4023)
@@ -14,7 +14,7 @@
 struct HYD_Handle_ {
     char *base_path;
     int proxy_port;
-    char *boot_server;
+    char *bootstrap;
 
     int debug;
     int enablex;

Modified: mpich2/trunk/src/pm/hydra/include/hydra_base.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_base.h	2009-03-12 07:38:31 UTC (rev 4022)
+++ mpich2/trunk/src/pm/hydra/include/hydra_base.h	2009-03-12 08:50:34 UTC (rev 4023)
@@ -83,15 +83,34 @@
 } HYD_Env_prop_t;
 
 #if !defined COMPILER_ACCEPTS_VA_ARGS
-#define HYDU_Print printf
+#define HYDU_Error_printf MPIU_Error_printf
+#elif defined COMPILER_ACCEPTS_FUNC && defined __LINE__
+#define HYDU_Error_printf(...)                            \
+    {                                                     \
+	fprintf(stderr, "%s (%d): ", __func__, __LINE__); \
+	MPIU_Error_printf(__VA_ARGS__);                   \
+    }
+#elif defined __FILE__ && defined __LINE__
+#define HYDU_Error_printf(...)                            \
+    {                                                     \
+	fprintf(stderr, "%s (%d): ", __FILE__, __LINE__); \
+	MPIU_Error_printf(__VA_ARGS__);                   \
+    }
 #else
-#define HYDU_Print(...)                         \
+#define HYDU_Error_printf(...)                  \
     {                                           \
-        int i;                                  \
-        for (i = 0; i < HYDU_Dbg_depth; i++)    \
-            printf("  ");                       \
-        printf(__VA_ARGS__);                    \
+	MPIU_Error_printf(__VA_ARGS__);         \
     }
+#endif
+
+#if !defined COMPILER_ACCEPTS_VA_ARGS
+#define HYDU_Debug if (handle.debug) printf
+#else
+#define HYDU_Debug(...)                                 \
+    {                                                   \
+        if (handle.debug)                               \
+            printf(__VA_ARGS__);                        \
+    }
 #endif /* COMPILER_ACCEPTS_VA_ARGS */
 
 #if !defined ENABLE_DEBUG
@@ -100,44 +119,19 @@
 #elif defined COMPILER_ACCEPTS_FUNC
 #define HYDU_FUNC_ENTER()                                               \
     {                                                                   \
-	HYDU_Print("Entering function %s\n", __func__);                 \
-        HYDU_Dbg_depth++;                                               \
+	HYDU_Debug("Entering function %s\n", __func__);                 \
     }
 #define HYDU_FUNC_EXIT()                                               \
     {                                                                  \
-	HYDU_Print("Exiting function %s\n", __func__);                 \
-        HYDU_Dbg_depth--;                                              \
+	HYDU_Debug("Exiting function %s\n", __func__);                 \
     }
 #else
 #define HYDU_FUNC_ENTER()                                               \
     {                                                                   \
-        HYDU_Dbg_depth++;                                               \
     }
 #define HYDU_FUNC_EXIT()                                               \
     {                                                                  \
-        HYDU_Dbg_depth--;                                              \
     }
 #endif
 
-#if !defined COMPILER_ACCEPTS_VA_ARGS
-#define HYDU_Error_printf MPIU_Error_printf
-#elif defined COMPILER_ACCEPTS_FUNC && defined __LINE__
-#define HYDU_Error_printf(...)                            \
-    {                                                     \
-	fprintf(stderr, "%s (%d): ", __func__, __LINE__); \
-	MPIU_Error_printf(__VA_ARGS__);                   \
-    }
-#elif defined __FILE__ && defined __LINE__
-#define HYDU_Error_printf(...)                            \
-    {                                                     \
-	fprintf(stderr, "%s (%d): ", __FILE__, __LINE__); \
-	MPIU_Error_printf(__VA_ARGS__);                   \
-    }
-#else
-#define HYDU_Error_printf(...)                  \
-    {                                           \
-	MPIU_Error_printf(__VA_ARGS__);         \
-    }
-#endif
-
 #endif /* HYDRA_BASE_H_INCLUDED */

Modified: mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c
===================================================================
--- mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c	2009-03-12 07:38:31 UTC (rev 4022)
+++ mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c	2009-03-12 08:50:34 UTC (rev 4023)
@@ -18,7 +18,7 @@
     printf("Usage: ./mpiexec [global opts] [exec1 local opts] : [exec2 local opts] : ...\n\n");
 
     printf("Global Options (passed to all executables):\n");
-    printf("\t-v/-vv/-vvv                      [Verbose level]\n");
+    printf("\t-v                               [Verbose mode]\n");
     printf("\t--enable-x/--disable-x           [Enable or disable X forwarding]\n");
     printf("\t--proxy-port                     [Port on which proxies can listen]\n");
     printf("\t-genv {name} {value}             [Environment variable name and value]\n");
@@ -94,6 +94,7 @@
         timeout = atoi(getenv("MPIEXEC_TIMEOUT"));
     else
         timeout = -1;   /* Set a negative timeout */
+    HYDU_Debug("Timeout set to %d seconds (negative means infinite)\n", timeout);
     HYDU_Time_set(&handle.timeout, &timeout);
 
     /* Launch the processes */

Modified: mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c
===================================================================
--- mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c	2009-03-12 07:38:31 UTC (rev 4022)
+++ mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c	2009-03-12 08:50:34 UTC (rev 4023)
@@ -12,7 +12,6 @@
 #define HYDRA_MAX_PATH 4096
 
 HYD_Handle handle;
-int HYDU_Dbg_depth;
 
 #define CHECK_LOCAL_PARAM_START(start, status) \
     { \
@@ -139,7 +138,7 @@
         }
 
         /* Check what debug level is requested */
-        if (!strcmp(*argv, "-v") || !strcmp(*argv, "-vv") || !strcmp(*argv, "-vvv")) {
+        if (!strcmp(*argv, "-v")) {
             CHECK_LOCAL_PARAM_START(local_params_started, status);
 
             /* Debug level already set */
@@ -149,14 +148,8 @@
                 status = HYD_INTERNAL_ERROR;
                 goto fn_fail;
             }
+            handle.debug = 1;
 
-            if (!strcmp(*argv, "-v"))
-                handle.debug = 1;
-            else if (!strcmp(*argv, "-vv"))
-                handle.debug = 2;
-            else if (!strcmp(*argv, "-vvv"))
-                handle.debug = 3;
-
             continue;
         }
 
@@ -458,32 +451,87 @@
 HYD_Status HYD_LCHI_Print_parameters(void)
 {
     HYD_Env_t *env;
+    int i, j;
+    struct HYD_Proc_params *proc_params;
+    struct HYD_Partition_list *partition;
     HYD_Status status = HYD_SUCCESS;
 
     HYDU_FUNC_ENTER();
 
-    HYDU_Print("mpiexec options:\n\n");
-    HYDU_Print("  Debug level: %d\n", handle.debug);
-    HYDU_Print("  Enable X: %d\n", handle.enablex);
-    HYDU_Print("  Working dir: %s\n", handle.wdir);
+    HYDU_Debug("\n");
+    HYDU_Debug("=================================================");
+    HYDU_Debug("=================================================");
+    HYDU_Debug("\n");
+    HYDU_Debug("mpiexec options:\n");
+    HYDU_Debug("----------------\n");
+    HYDU_Debug("  Base path: %s\n", handle.base_path);
+    HYDU_Debug("  Proxy port: %d\n", handle.proxy_port);
+    HYDU_Debug("  Bootstrap server: %s\n", handle.bootstrap);
+    HYDU_Debug("  Debug level: %d\n", handle.debug);
+    HYDU_Debug("  Enable X: %d\n", handle.enablex);
+    HYDU_Debug("  Working dir: %s\n", handle.wdir);
+    HYDU_Debug("  Host file: %s\n", handle.host_file);
 
-    HYDU_Print("\n");
-    HYDU_Print("  Global environment:\n");
+    HYDU_Debug("\n");
+    HYDU_Debug("  Global environment:\n");
+    HYDU_Debug("  -------------------\n");
     for (env = handle.global_env; env; env = env->next)
-        HYDU_Print("    %s=%s\n", env->env_name, env->env_value);
+        HYDU_Debug("    %s=%s\n", env->env_name, env->env_value);
 
-    HYDU_Print("\n");
-    HYDU_Print("  Hydra internal environment:\n");
-    for (env = handle.system_env; env; env = env->next)
-        HYDU_Print("    %s=%s\n", env->env_name, env->env_value);
+    if (handle.system_env) {
+        HYDU_Debug("\n");
+        HYDU_Debug("  Hydra internal environment:\n");
+        HYDU_Debug("  ---------------------------\n");
+        for (env = handle.system_env; env; env = env->next)
+            HYDU_Debug("    %s=%s\n", env->env_name, env->env_value);
+    }
 
-    HYDU_Print("\n");
-    HYDU_Print("  User set environment:\n");
-    for (env = handle.user_env; env; env = env->next)
-        HYDU_Print("    %s=%s\n", env->env_name, env->env_value);
+    if (handle.user_env) {
+        HYDU_Debug("\n");
+        HYDU_Debug("  User set environment:\n");
+        HYDU_Debug("  ---------------------\n");
+        for (env = handle.user_env; env; env = env->next)
+            HYDU_Debug("    %s=%s\n", env->env_name, env->env_value);
+    }
 
-    HYDU_Print("\n");
+    HYDU_Debug("\n\n");
 
+    HYDU_Debug("    Process parameters:\n");
+    HYDU_Debug("    *******************\n");
+    i = 1;
+    for (proc_params = handle.proc_params; proc_params; proc_params = proc_params->next) {
+        HYDU_Debug("      Executable ID: %2d\n", i++);
+        HYDU_Debug("      -----------------\n");
+        HYDU_Debug("        Process count: %d\n", proc_params->exec_proc_count);
+        HYDU_Debug("        Executable: ");
+        for (j = 0; proc_params->exec[j]; j++)
+            HYDU_Debug("%s ", proc_params->exec[j]);
+        HYDU_Debug("\n");
+
+        if (proc_params->user_env) {
+            HYDU_Debug("\n");
+            HYDU_Debug("        User set environment:\n");
+            HYDU_Debug("        .....................\n");
+            for (env = proc_params->user_env; env; env = env->next)
+                HYDU_Debug("          %s=%s\n", env->env_name, env->env_value);
+        }
+
+        j = 0;
+        for (partition = proc_params->partition; partition; partition = partition->next) {
+            HYDU_Debug("\n");
+            HYDU_Debug("        Partition ID: %2d\n", j++);
+            HYDU_Debug("        ----------------\n");
+            HYDU_Debug("          Partition name: %s\n", partition->name);
+            HYDU_Debug("          Partition process count: %d\n", partition->proc_count);
+            HYDU_Debug("\n");
+        }
+    }
+
+    HYDU_Debug("\n");
+    HYDU_Debug("=================================================");
+    HYDU_Debug("=================================================");
+    HYDU_Debug("\n\n");
+
     HYDU_FUNC_EXIT();
     return status;
 }

Modified: mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c
===================================================================
--- mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c	2009-03-12 07:38:31 UTC (rev 4022)
+++ mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c	2009-03-12 08:50:34 UTC (rev 4023)
@@ -30,6 +30,7 @@
         }
     }
 
+    HYDU_Debug("Partition list: ");
     proc_params = handle.proc_params;
     while (proc_params) {
         if (!strcmp(handle.host_file, "HYDRA_USE_LOCALHOST")) {
@@ -37,6 +38,7 @@
             proc_params->partition->name = MPIU_Strdup("localhost");
             proc_params->partition->proc_count = proc_params->exec_proc_count;
             total_procs = proc_params->exec_proc_count;
+            HYDU_Debug("%s:%d ", proc_params->partition->name, proc_params->exec_proc_count);
         }
         else {
             total_procs = 0;
@@ -70,6 +72,9 @@
                 partition->proc_count = num_procs;
 
                 total_procs += num_procs;
+
+                HYDU_Debug("%s:%d ", partition->name, partition->proc_count);
+
                 if (total_procs == proc_params->exec_proc_count)
                     break;
             }
@@ -84,6 +89,7 @@
             /* Optimize the case where there is only one node */
             if (run->next == NULL) {
                 run->proc_count = proc_params->exec_proc_count;
+                HYDU_Debug("%s:%d ", run->name, run->proc_count);
             }
             else {
                 while (total_procs != proc_params->exec_proc_count) {
@@ -91,6 +97,9 @@
                     partition = partition->next;
                     partition->name = MPIU_Strdup(run->name);
                     partition->proc_count = run->proc_count;
+
+                    HYDU_Debug("%s:%d ", partition->name, partition->proc_count);
+
                     total_procs += partition->proc_count;
                     run = run->next;
                 }
@@ -99,6 +108,7 @@
 
         proc_params = proc_params->next;
     }
+    HYDU_Debug("\n");
 
   fn_exit:
     if (fp)

Modified: mpich2/trunk/src/pm/hydra/pm/central/central_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/central/central_launch.c	2009-03-12 07:38:31 UTC (rev 4022)
+++ mpich2/trunk/src/pm/hydra/pm/central/central_launch.c	2009-03-12 08:50:34 UTC (rev 4023)
@@ -95,6 +95,7 @@
     MPIU_Snprintf(port_str, strlen(hostname) + 1 + strlen(sport) + 1,
                   "%s:%s", hostname, sport);
     HYDU_FREE(sport);
+    HYDU_Debug("Process manager listening on PMI port %s\n", port_str);
 
     status = HYDU_Env_create(&env, "PMI_PORT", port_str);
     if (status != HYD_SUCCESS) {
@@ -200,6 +201,11 @@
             partition->args[arg] = NULL;
             HYDU_Append_exec(proc_params->exec, partition->args);
 
+            if (handle.debug) {
+                HYDU_Debug("Executable passed to the bootstrap: ");
+                HYDU_Dump_args(partition->args);
+            }
+
             process_id += partition->proc_count;
         }
     }

Modified: mpich2/trunk/src/pm/hydra/utils/args/args.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/args/args.c	2009-03-12 07:38:31 UTC (rev 4022)
+++ mpich2/trunk/src/pm/hydra/utils/args/args.c	2009-03-12 08:50:34 UTC (rev 4023)
@@ -92,8 +92,8 @@
     HYDU_FUNC_ENTER();
 
     for (arg = 0; args[arg]; arg++)
-        fprintf(stderr, "%s ", args[arg]);
-    fprintf(stderr, "\n");
+        printf("%s ", args[arg]);
+    printf("\n");
 
     HYDU_FUNC_EXIT();
     return status;



More information about the mpich2-commits mailing list