From d2f4a210180dfc8473d3a6285b70af249a309fc5 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Tue, 12 Nov 2013 15:23:54 +0100 Subject: [PATCH] From M.Volat : make smpi scripts sh-compliants to avoid the need to hack with env and depend on bash --- src/smpi/smpicc.in | 2 +- src/smpi/smpif90.in | 2 +- src/smpi/smpiff.in | 2 +- src/smpi/smpirun.in | 32 ++++++++++++++++---------------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/smpi/smpicc.in b/src/smpi/smpicc.in index 3b501a7ab7..843c526927 100755 --- a/src/smpi/smpicc.in +++ b/src/smpi/smpicc.in @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#! /bin/sh CC=@CMAKE_C_COMPILER@ diff --git a/src/smpi/smpif90.in b/src/smpi/smpif90.in index bba2ffa337..c0cb3482b9 100644 --- a/src/smpi/smpif90.in +++ b/src/smpi/smpif90.in @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#! /bin/sh F90=@GFORTRAN_EXE@ diff --git a/src/smpi/smpiff.in b/src/smpi/smpiff.in index 33093fcca0..21bc82a19b 100644 --- a/src/smpi/smpiff.in +++ b/src/smpi/smpiff.in @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#! /bin/sh prefix="@exec_prefix@" ARGS="-DMAIN__=user_main -Diargc_=smpi_process_argc -Dgetarg_=smpi_process_getarg" diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index 2aaea1635a..805bfb37c1 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#! /bin/sh @CMAKE_SMPI_COMMAND@ @@ -18,7 +18,7 @@ POWER="${DEFAULT_POWER}" SIMOPTS="--cfg=maxmin/precision:1e-9 --cfg=network/model:SMPI --cfg=network/TCP_gamma:4194304" #usage to print the way this script should be called -function usage () { +usage () { cat < -hostfile program [program-options] Options: @@ -234,14 +234,14 @@ if [ -z "${PLATFORM}" ]; then PLATFORMHEAD -for (( i=${NUMPROCS}; $i ; i=$i-1 )) do +for i in $(echo "for (i=${NUMPROCS};i>0;i--) i"|bc); do echo " " >> ${PLATFORMTMP} echo " " >> ${PLATFORMTMP} echo " " >> ${PLATFORMTMP} done -for (( i=${NUMPROCS}; $i ; i=$i-1 )) do - for (( j=${NUMPROCS}; $j ; j=$j-1 )) do +for i in $(echo "for (i=${NUMPROCS};i>0;i--) i"|bc); do + for j in $(echo "for (i=${NUMPROCS};i>0;i--) i"|bc); do if [ $i -eq $j ]; then echo " " >> ${PLATFORMTMP} else @@ -273,15 +273,15 @@ APPLICATIONHEAD ##---- cache hostnames of hostfile--------------- if [ -n "${HOSTFILE}" ] && [ -f ${HOSTFILE} ]; then - hostnames=(`cat ${HOSTFILE} | tr \\\n " "`) - NUMHOSTS=`cat ${HOSTFILE} | wc -l` + hostnames=$(cat ${HOSTFILE} | tr \\\n " ") + NUMHOSTS=$(cat ${HOSTFILE} | wc -l) fi if [ "${EXTOPT}" = "smpi_replay" ]; then APP_TRACES=$PROC_ARGS if [ -n "${APP_TRACES}" ] && [ -f "${APP_TRACES}" ]; then - hosttraces=(`cat ${APP_TRACES} | tr \\\n " "`) - NUMTRACES=`cat ${APP_TRACES} | wc -l` + hosttraces=$(cat ${APP_TRACES} | tr \\\n " ") + NUMTRACES=$(cat ${APP_TRACES} | wc -l) else printf "File not found: %s\n", "${APP_TRACES:-\${APP_TRACES\}}" >&2 exit 1 @@ -312,25 +312,25 @@ fi for i in ${SEQ} do if [ -n "${HOSTFILE}" ]; then - j=$(( $i % ${NUMHOSTS} )) + j=$(( $i % ${NUMHOSTS} + 1 )) fi ##---- optional display of ranks to process mapping if [ -n "${MAPOPT}" ]; then - echo "[rank $i] -> ${hostnames[$j]}" + echo "[rank $i] -> $(echo $hostnames|cut -d' ' -f$j)" fi - if [ -z "${hostnames[$j]}" ]; then - host="host"$(($j+1)) + if [ -z "$(echo $hostnames|cut -d' ' -f$j)" ]; then + host="host"$($j) else - host="${hostnames[$j]}" + host="$(echo $hostnames|cut -d' ' -f$j)" fi echo " " >> ${APPLICATIONTMP} echo " " >> ${APPLICATIONTMP} if [ "${EXTOPT}" = "smpi_replay" ]; then if [ ${NUMTRACES} -gt 1 ]; then - echo " " >> ${APPLICATIONTMP} + echo " " >> ${APPLICATIONTMP} else - echo " " >> ${APPLICATIONTMP} + echo " " >> ${APPLICATIONTMP} fi else for ARG in $PROC_ARGS; do -- 2.20.1