[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1b1-49-ga35fa10

mysql vizuser noreply at mpich.org
Wed Sep 25 21:12:43 CDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  a35fa10b8d70217662e8b1d1c04dfa39015ae757 (commit)
      from  60165ef2d70dc83586201408add87bdd5f86aa0b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/a35fa10b8d70217662e8b1d1c04dfa39015ae757

commit a35fa10b8d70217662e8b1d1c04dfa39015ae757
Author: Ken Raffenetti <raffenet at mcs.anl.gov>
Date:   Tue Sep 24 20:42:55 2013 -0500

    Change to PMI proxy on unknown key lookup
    
    When a key is not found locally, pass the "get" command upstream.
    This allows us to handle special cases like dead processes.
    Fixes #1917.
    
    Signed-off-by: Pavan Balaji <balaji at mcs.anl.gov>

diff --git a/src/pm/hydra/pm/pmiserv/pmip_pmi_v1.c b/src/pm/hydra/pm/pmiserv/pmip_pmi_v1.c
index 7466a1f..b46ab87 100644
--- a/src/pm/hydra/pm/pmiserv/pmip_pmi_v1.c
+++ b/src/pm/hydra/pm/pmiserv/pmip_pmi_v1.c
@@ -409,24 +409,24 @@ static HYD_status fn_get(int fd, char *args[])
             }
         }
 
-        HYD_STRING_STASH_INIT(stash);
-        HYD_STRING_STASH(stash, HYDU_strdup("cmd=get_result rc="), status);
         if (val) {
+            HYD_STRING_STASH_INIT(stash);
+            HYD_STRING_STASH(stash, HYDU_strdup("cmd=get_result rc="), status);
             HYD_STRING_STASH(stash, HYDU_strdup("0 msg=success value="), status);
             HYD_STRING_STASH(stash, HYDU_strdup(val), status);
+            HYD_STRING_STASH(stash, HYDU_strdup("\n"), status);
+
+            HYD_STRING_SPIT(stash, cmd, status);
+
+            status = send_cmd_downstream(fd, cmd);
+            HYDU_ERR_POP(status, "error sending PMI response\n");
+            HYDU_FREE(cmd);
         }
         else {
-            HYD_STRING_STASH(stash, HYDU_strdup("-1 msg=key_"), status);
-            HYD_STRING_STASH(stash, HYDU_strdup(key), status);
-            HYD_STRING_STASH(stash, HYDU_strdup("_not_found value=unknown"), status);
+            /* if we can't find the key locally, ask upstream */
+            status = send_cmd_upstream("cmd=get ", fd, token_count, args);
+            HYDU_ERR_POP(status, "error sending command upstream\n");
         }
-        HYD_STRING_STASH(stash, HYDU_strdup("\n"), status);
-
-        HYD_STRING_SPIT(stash, cmd, status);
-
-        status = send_cmd_downstream(fd, cmd);
-        HYDU_ERR_POP(status, "error sending command downstream\n");
-        HYDU_FREE(cmd);
     }
 
   fn_exit:
diff --git a/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c b/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
index 4dd7ffe..9955e18 100644
--- a/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
+++ b/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
@@ -199,6 +199,86 @@ static HYD_status fn_put(int fd, int pid, int pgid, char *args[])
     goto fn_exit;
 }
 
+static HYD_status fn_get(int fd, int pid, int pgid, char *args[])
+{
+    int i;
+    struct HYD_proxy *proxy;
+    struct HYD_pmcd_pmi_pg_scratch *pg_scratch;
+    struct HYD_pmcd_pmi_kvs_pair *run;
+    char *kvsname, *key, *val;
+    char *tmp[HYD_NUM_TMP_STRINGS], *cmd;
+    struct HYD_pmcd_token *tokens;
+    int token_count;
+    HYD_status status = HYD_SUCCESS;
+
+    HYDU_FUNC_ENTER();
+
+    status = HYD_pmcd_pmi_args_to_tokens(args, &tokens, &token_count);
+    HYDU_ERR_POP(status, "unable to convert args to tokens\n");
+
+    kvsname = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, "kvsname");
+    HYDU_ERR_CHKANDJUMP(status, kvsname == NULL, HYD_INTERNAL_ERROR,
+                        "unable to find token: kvsname\n");
+
+    key = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, "key");
+    HYDU_ERR_CHKANDJUMP(status, key == NULL, HYD_INTERNAL_ERROR, "unable to find token: key\n");
+
+    proxy = HYD_pmcd_pmi_find_proxy(fd);
+    HYDU_ASSERT(proxy, status);
+
+    pg_scratch = (struct HYD_pmcd_pmi_pg_scratch *) proxy->pg->pg_scratch;
+
+    val = NULL;
+    if (!strcmp(key, "PMI_dead_processes")) {
+        val = pg_scratch->dead_processes;
+        goto found_val;
+    }
+
+    if (strcmp(pg_scratch->kvs->kvsname, kvsname))
+        HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
+                            "kvsname (%s) does not match this group's kvs space (%s)\n",
+                            kvsname, pg_scratch->kvs->kvsname);
+
+    /* Try to find the key */
+    for (run = pg_scratch->kvs->key_pair; run; run = run->next) {
+        if (!strcmp(run->key, key)) {
+            val = run->val;
+            break;
+        }
+    }
+
+  found_val:
+    i = 0;
+    tmp[i++] = HYDU_strdup("cmd=get_result rc=");
+    if (val) {
+        tmp[i++] = HYDU_strdup("0 msg=success value=");
+        tmp[i++] = HYDU_strdup(val);
+    }
+    else {
+        tmp[i++] = HYDU_strdup("-1 msg=key_");
+        tmp[i++] = HYDU_strdup(key);
+        tmp[i++] = HYDU_strdup("_not_found value=unknown");
+    }
+    tmp[i++] = HYDU_strdup("\n");
+    tmp[i++] = NULL;
+
+    status = HYDU_str_alloc_and_join(tmp, &cmd);
+    HYDU_ERR_POP(status, "unable to join strings\n");
+    HYDU_free_strlist(tmp);
+
+    status = cmd_response(fd, pid, cmd);
+    HYDU_ERR_POP(status, "error writing PMI line\n");
+    HYDU_FREE(cmd);
+
+  fn_exit:
+    HYD_pmcd_pmi_free_tokens(tokens, token_count);
+    HYDU_FUNC_EXIT();
+    return status;
+
+  fn_fail:
+    goto fn_exit;
+}
+
 static char *mcmd_args[MAX_PMI_ARGS] = { NULL };
 
 static int mcmd_num_args = 0;
@@ -684,6 +764,7 @@ static HYD_status fn_lookup_name(int fd, int pid, int pgid, char *args[])
 static struct HYD_pmcd_pmi_handle pmi_v1_handle_fns_foo[] = {
     {"barrier_in", fn_barrier_in},
     {"put", fn_put},
+    {"get", fn_get},
     {"spawn", fn_spawn},
     {"publish_name", fn_publish_name},
     {"unpublish_name", fn_unpublish_name},

-----------------------------------------------------------------------

Summary of changes:
 src/pm/hydra/pm/pmiserv/pmip_pmi_v1.c    |   24 ++++----
 src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c |   81 ++++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list