Small patch to the mpiexec

Eygene Ryabinkin rea+maui at grid.kiae.ru
Mon May 28 07:04:07 EDT 2007


Pete, good day.

Crawling over the mpiexec sources I found the strange code that
I believe was the result of the typo: 'i' should be 'j'.

The patch is attached with my comments inline.
-- 
Eygene Ryabinkin, RRC KI
-------------- next part --------------
>From e93f3be89ff39ea1d95bdc53abac00f5850baf97 Mon Sep 17 00:00:00 2001
From: Eygene Ryabinkin <rea+maui at grid.kiae.ru>
Date: Sat, 26 May 2007 21:44:40 +0400
Subject: [PATCH] Correct the node counting check in get_hosts().

This correction will not affect the functionality, but the original
code has the condition that was always false, so the check was
redundant.  But I feel that the index 'i' was supposed to be 'j'
and it was quick integer check instead of more costly strcmp().

Signed-off-by: Eygene Ryabinkin <rea+maui at grid.kiae.ru>
---
 get_hosts.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/get_hosts.c b/get_hosts.c
index e41a5bf..205c487 100644
--- a/get_hosts.c
+++ b/get_hosts.c
@@ -191,7 +191,8 @@ get_hosts(void)
 	if (host[i].parent >= 0)
 	    continue;
 	for (j=i+1; j<tasklist_len; j++) {
-	    if (host[i].parent >= 0)
+	    /* A quick check if the node has been already counted. */
+	    if (host[j].parent >= 0)
 		continue;
 	    if (strcmp(host[i].name, host[j].name) == 0) {
 		host[j].parent = i;
-- 
1.5.0.3-dirty



More information about the mpiexec mailing list