[mpich2-commits] r7903 - in mpich2/trunk/src/pm/hydra: include pm/pmiserv tools/bootstrap/external utils/alloc utils/args

balaji at mcs.anl.gov balaji at mcs.anl.gov
Thu Feb 3 17:57:55 CST 2011


Author: balaji
Date: 2011-02-03 17:57:55 -0600 (Thu, 03 Feb 2011)
New Revision: 7903

Modified:
   mpich2/trunk/src/pm/hydra/include/hydra.h
   mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmci.c
   mpich2/trunk/src/pm/hydra/tools/bootstrap/external/external_launch.c
   mpich2/trunk/src/pm/hydra/utils/alloc/alloc.c
   mpich2/trunk/src/pm/hydra/utils/args/args.c
Log:
Allow a non-default username to be specified for some of the hosts.

Modified: mpich2/trunk/src/pm/hydra/include/hydra.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra.h	2011-02-03 23:10:38 UTC (rev 7902)
+++ mpich2/trunk/src/pm/hydra/include/hydra.h	2011-02-03 23:57:55 UTC (rev 7903)
@@ -253,6 +253,9 @@
     char *hostname;
     int core_count;
 
+    /* Username */
+    char *user;
+
     /* Node-specific binding information */
     char *local_binding;
 
@@ -416,6 +419,7 @@
 void HYDU_init_global_env(struct HYD_env_global *global_env);
 void HYDU_finalize_global_env(struct HYD_env_global *global_env);
 HYD_status HYDU_alloc_node(struct HYD_node **node);
+void HYDU_dup_node(struct HYD_node src, struct HYD_node *dest);
 void HYDU_free_node_list(struct HYD_node *node_list);
 void HYDU_init_pg(struct HYD_pg *pg, int pgid);
 HYD_status HYDU_alloc_pg(struct HYD_pg **pg, int pgid);

Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmci.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmci.c	2011-02-03 23:10:38 UTC (rev 7902)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmiserv_pmci.c	2011-02-03 23:57:55 UTC (rev 7903)
@@ -118,8 +118,7 @@
     node_count = 0;
     for (proxy = HYD_server_info.pg_list.proxy_list; proxy; proxy = proxy->next) {
         HYDU_alloc_node(&node);
-        node->hostname = HYDU_strdup(proxy->node.hostname);
-        node->core_count = proxy->node.core_count;
+        HYDU_dup_node(proxy->node, node);
         node->next = NULL;
 
         if (node_list == NULL) {

Modified: mpich2/trunk/src/pm/hydra/tools/bootstrap/external/external_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/bootstrap/external/external_launch.c	2011-02-03 23:10:38 UTC (rev 7902)
+++ mpich2/trunk/src/pm/hydra/tools/bootstrap/external/external_launch.c	2011-02-03 23:57:55 UTC (rev 7903)
@@ -15,7 +15,7 @@
 HYD_status HYDT_bscd_external_launch_procs(char **args, struct HYD_node *node_list,
                                            int *control_fd)
 {
-    int num_hosts, idx, i, host_idx, fd, exec_idx, offset, lh;
+    int num_hosts, idx, i, host_idx, fd, exec_idx, offset, lh, len;
     int *pid, *fd_list, *dummy;
     int sockpair[2];
     struct HYD_node *node;
@@ -149,8 +149,16 @@
 
         if (targs[host_idx])
             HYDU_FREE(targs[host_idx]);
-        targs[host_idx] = HYDU_strdup(node->hostname);
+        if (node->user == NULL) {
+            targs[host_idx] = HYDU_strdup(node->hostname);
+        }
+        else {
+            len = strlen(node->user) + strlen("@") + strlen(node->hostname) + 1;
 
+            HYDU_MALLOC(targs[host_idx], char *, len, status);
+            MPL_snprintf(targs[host_idx], len, "%s@%s", node->user, node->hostname);
+        }
+
         /* append proxy ID */
         if (targs[idx])
             HYDU_FREE(targs[idx]);

Modified: mpich2/trunk/src/pm/hydra/utils/alloc/alloc.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/alloc/alloc.c	2011-02-03 23:10:38 UTC (rev 7902)
+++ mpich2/trunk/src/pm/hydra/utils/alloc/alloc.c	2011-02-03 23:57:55 UTC (rev 7903)
@@ -89,6 +89,7 @@
 {
     node->hostname = NULL;
     node->core_count = 0;
+    node->user = NULL;
     node->local_binding = NULL;
     node->next = NULL;
 }
@@ -110,6 +111,19 @@
     goto fn_exit;
 }
 
+void HYDU_dup_node(struct HYD_node src, struct HYD_node *dest)
+{
+    HYDU_FUNC_ENTER();
+
+    dest->hostname = src.hostname ? HYDU_strdup(src.hostname) : NULL;
+    dest->core_count = src.core_count;
+    dest->user = src.user ? HYDU_strdup(src.user) : NULL;
+    dest->local_binding = src.local_binding ? HYDU_strdup(src.local_binding) : NULL;
+
+    HYDU_FUNC_EXIT();
+    return;
+}
+
 void HYDU_free_node_list(struct HYD_node *node_list)
 {
     struct HYD_node *node, *tnode;
@@ -121,6 +135,9 @@
         if (node->hostname)
             HYDU_FREE(node->hostname);
 
+        if (node->user)
+            HYDU_FREE(node->user);
+
         if (node->local_binding)
             HYDU_FREE(node->local_binding);
 
@@ -395,6 +412,11 @@
             proxy = proxy->next;
         }
 
+        proxy->proxy_id = i;
+        proxy->start_pid = start_pid;
+        HYDU_dup_node(*node, &proxy->node);
+        proxy->node.next = NULL;
+
         /* For the first node, use only the remaining cores. For the
          * last node, we need to make sure its not oversubscribed
          * since the first proxy we started on might repeat. */
@@ -405,13 +427,6 @@
         else
             proxy->node.core_count = node->core_count;
 
-        proxy->proxy_id = i;
-        proxy->start_pid = start_pid;
-        proxy->node.hostname = HYDU_strdup(node->hostname);
-        if (node->local_binding)
-            proxy->node.local_binding = HYDU_strdup(node->local_binding);
-        proxy->node.next = NULL;
-
         /* If we found enough proxies, break out */
         start_pid += proxy->node.core_count;
         procs_left -= proxy->node.core_count;

Modified: mpich2/trunk/src/pm/hydra/utils/args/args.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/args/args.c	2011-02-03 23:10:38 UTC (rev 7902)
+++ mpich2/trunk/src/pm/hydra/utils/args/args.c	2011-02-03 23:57:55 UTC (rev 7903)
@@ -263,7 +263,7 @@
 HYD_status HYDU_process_mfile_token(char *token, int newline, struct HYD_node **node_list)
 {
     int num_procs;
-    char *hostname, *procs, *binding, *tmp;
+    char *hostname, *procs, *binding, *tmp, *user;
     struct HYD_node *node;
     HYD_status status = HYD_SUCCESS;
 
@@ -287,6 +287,16 @@
 
             node->local_binding = HYDU_strdup(binding);
         }
+        else if (!strcmp(tmp, "user")) {
+            user = strtok(NULL, "=");
+
+            for (node = *node_list; node->next; node = node->next);
+            if (node->user)
+                HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
+                                    "duplicate username setting\n");
+
+            node->user = HYDU_strdup(user);
+        }
         else {
             HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
                                 "token %s not supported at this time\n", token);



More information about the mpich2-commits mailing list