Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
get rid of most of the awfully slow cut commands in smpirun.
authordegomme <augustin.degomme@unibas.ch>
Sun, 13 Nov 2016 19:11:19 +0000 (12:11 -0700)
committerdegomme <augustin.degomme@unibas.ch>
Sun, 13 Nov 2016 19:11:19 +0000 (12:11 -0700)
Those for smpi_replay are still here, though, as the set solution only works one list at a time.
Let's hope this works everywhere.

src/smpi/smpirun.in

index 80611b0..ff70781 100755 (executable)
@@ -406,22 +406,24 @@ else
     done
 fi
 
+set -- $hostnames
 ##---- generate <process> tags------------------------------
 for i in ${SEQ}
 do
     if [ -n "${HOSTFILE}" ]; then
-       j=$(( $i % ${NUMHOSTS} + 1 ))
+      j=$(( $i % ${NUMHOSTS} + 1 ))
+    fi
+
+    host=$(eval "echo \${$j}")
+
+    if [ -z $host ]; then
+      host="host"$($j)
     fi
     ##---- optional display of ranks to process mapping
     if [ -n "${MAPOPT}" ]; then
-       echo "[rank $i] -> $(echo $hostnames|cut -d' ' -f$j)"
+      echo "[rank $i] -> $host"
     fi
 
-    if [ -z "$(echo $hostnames|cut -d' ' -f$j)" ]; then
-       host="host"$($j)
-    else
-       host="$(echo $hostnames|cut -d' ' -f$j)"
-    fi
     echo "  <process host=\"${host}\" function=\"$i\"> <!-- function name used only for logging -->" >> ${APPLICATIONTMP}
     echo "    <argument value=\"1\"/> <!-- instance -->" >> ${APPLICATIONTMP}
     echo "    <argument value=\"$i\"/> <!-- rank -->" >> ${APPLICATIONTMP}