Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
smpirun: make sure that <cluster is on its own line when computing the hostfile autom...
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 18 Sep 2018 13:16:09 +0000 (15:16 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 18 Sep 2018 13:16:09 +0000 (15:16 +0200)
src/smpi/smpirun.in

index e8f1743..ca795e2 100755 (executable)
@@ -270,7 +270,9 @@ if [ -z "${HOSTFILE}" ] ; then
     HOSTFILETMP=1
     HOSTFILE="$(mktemp smpitmp-hostfXXXXXX)"
     perl -ne 'print "$1\n" if /.*<host.*?id="(.*?)".*?\/>.*/' ${PLATFORM} > ${HOSTFILE}
     HOSTFILETMP=1
     HOSTFILE="$(mktemp smpitmp-hostfXXXXXX)"
     perl -ne 'print "$1\n" if /.*<host.*?id="(.*?)".*?\/>.*/' ${PLATFORM} > ${HOSTFILE}
-    perl -ne 'if (/.*<cluster.*?prefix="(.*?)".*?radical="(.*?)".*?suffix="(.*?)".*/) {
+    # put all <cluster tag on its own line.
+    cat ${PLATFORM} | tr '\n' ' ' | sed 's/<cluster/\n<cluster/' | \
+      perl -ne 'if (m/.*<cluster.*?prefix="(.*?)".*?radical="(.*?)".*?suffix="(.*?)".*/s) {
                 my ($pre,$rad,$post)=($1,$2,$3);
                for my $elm (split(",",$rad)) {
                  if ($elm=~/^([^-]*?)-([^-]*)$/) {
                 my ($pre,$rad,$post)=($1,$2,$3);
                for my $elm (split(",",$rad)) {
                  if ($elm=~/^([^-]*?)-([^-]*)$/) {
@@ -282,7 +284,7 @@ if [ -z "${HOSTFILE}" ] ; then
                  }
                }
              } elsif (/<cluster/) {
                  }
                }
              } elsif (/<cluster/) {
-            die ("Unparsable cluster tag. smpirun uses a primitive regular expression to parse cluster tags. Either provide a hostfile yourself or give the attributes prefix, radical and suffix IN THAT ORDER and ON THE SAME LINE as the opening tag (<cluster)");
+            die ("Unparsable cluster tag. smpirun uses a primitive regular expression to parse cluster tags. Either provide a hostfile yourself or give the attributes prefix, radical and suffix IN THAT ORDER.");
              }' ${PLATFORM} >> ${HOSTFILE}
 fi
 UNROLLEDHOSTFILETMP=0
              }' ${PLATFORM} >> ${HOSTFILE}
 fi
 UNROLLEDHOSTFILETMP=0