MPIEXEC and Intel MPI library.

Pete Wyckoff pw at osc.edu
Thu Apr 28 16:07:51 EDT 2005


A.Starikov at utwente.nl wrote on Thu, 28 Apr 2005 21:07 +0200:
> Instead of giving
> 
> cmd = init
> pmi_version = 1
> pmi_subversion = 1
> 
> Intel MPI reports
> 
> cmd = init
> pmi_version = 1.1
> 
> and nothing more.
> I just check, if there is only two keys, I check if second key actually 
> consists of two keys. If so - I separate this string and emulate 3rd key 
> which should be here.

Thanks for the explanation.  I wrote it a bit more verbosely to explain
to future coders what's going on.  It works against stock mpich2 still.
Would you have a chance to test it against your intel version before I
check it in?

		-- Pete
-------------- next part --------------
diff -u -p -r1.5 pmi.c
--- pmi.c	14 Mar 2005 15:52:19 -0000	1.5
+++ pmi.c	28 Apr 2005 20:04:36 -0000
@@ -222,23 +222,51 @@ accept_pmi_conn(void)
     if (strcmp(kv->val[0], "init"))
 	error("%s: expecting cmd=init, got cmd=%s", __func__,
 	  kv->val[0]);
-    if (kv->num != 3)
-	error("%s: in cmd=init, expecting 3 word total, got %d", __func__,
-	  kv->num);
-    if (strcmp(kv->key[1], "pmi_version"))
-	error("%s: cmd=init, no \"pmi_version\" key", __func__);
-    pmi_version = strtoul(kv->val[1], &cq, 10);
-    if (cq == kv->val[1])
-	error("%s: cmd=init, invalid value to pmi_version \"%s\"",
-	  __func__, kv->val[1]);
-    if (strcmp(kv->key[2], "pmi_subversion"))
-	error("%s: cmd=init, no \"pmi_subversion\" key", __func__);
-    pmi_subversion = strtoul(kv->val[2], &cq, 10);
-    if (cq == kv->val[2])
-	error("%s: cmd=init, invalid value to pmi_subversion \"%s\"",
-	  __func__, kv->val[2]);
-    debug(1, "%s: got request: cmd=init pmi_version=%d pmi_subversion=%d",
-      __func__, pmi_version, pmi_subversion);
+    if (kv->num == 3) {
+	/*
+	 * Normal modern mpich2 version.
+	 */
+	if (strcmp(kv->key[1], "pmi_version"))
+	    error("%s: cmd=init, no \"pmi_version\" key", __func__);
+	pmi_version = strtoul(kv->val[1], &cq, 10);
+	if (cq == kv->val[1])
+	    error("%s: cmd=init, invalid value to pmi_version \"%s\"",
+	      __func__, kv->val[1]);
+	if (strcmp(kv->key[2], "pmi_subversion"))
+	    error("%s: cmd=init, no \"pmi_subversion\" key", __func__);
+	pmi_subversion = strtoul(kv->val[2], &cq, 10);
+	if (cq == kv->val[2])
+	    error("%s: cmd=init, invalid value to pmi_subversion \"%s\"",
+	      __func__, kv->val[2]);
+	debug(1, "%s: got request: cmd=init pmi_version=%d pmi_subversion=%d",
+	  __func__, pmi_version, pmi_subversion);
+    } else if (kv->num == 2) {
+	/*
+	 * Special hack for intel version of mpich2 that says
+	 *   cmd=init pmi_version=1.1
+	 * instead of the above.
+	 */
+	char *cp;
+	if (strcmp(kv->key[1], "pmi_version"))
+	    error("%s: cmd=init, 2 keyvals, no \"pmi_version\" key", __func__);
+	cp = strchr(kv->val[1], '.');
+	if (!cp)
+	    error("%s: cmd=init, 2 keyvals, no '.' in \"pmi_version\" val",
+	      __func__);
+	*cp = '\0';
+	pmi_version = strtoul(kv->val[1], &cq, 10);
+	if (cq == kv->val[1])
+	    error("%s: cmd=init, 2 keyvals, invalid pmi_version \"%s\"",
+	      __func__, kv->val[1]);
+	pmi_subversion = strtoul(cp+1, &cq, 10);
+	if (cq == cp+1)
+	    error("%s: cmd=init, 2 keyvals, invalid pmi_subversion \"%s\"",
+	      __func__, cp+1);
+	debug(1, "%s: got request: cmd=init pmi_version=%d.%d",
+	  __func__, pmi_version, pmi_subversion);
+    } else
+	error("%s: in cmd=init, expecting 2 or 3 keyvals total, got %d",
+	  __func__, kv->num);
 
     /* response: cmd=response_to_init rc=0 if okay */
     growstr_zero(g);


More information about the mpiexec mailing list