]> AND Private Git Repository - loba.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Add script to run experimentations.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 20 Apr 2011 13:20:27 +0000 (15:20 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 20 Apr 2011 13:20:27 +0000 (15:20 +0200)
Experimentations/run-all [new file with mode: 0755]
Experimentations/sample_parameters [new file with mode: 0644]

diff --git a/Experimentations/run-all b/Experimentations/run-all
new file mode 100755 (executable)
index 0000000..60bfa07
--- /dev/null
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+set -e
+#set -x
+
+usage() {
+    cat >&2 <<EOF
+Usage: $0 [-c] <parameters file>
+Options:
+    -h  print this help
+    -n  dry-run mode (for debugging)
+    -c  (continue) do not overwrite previous results
+EOF
+    exit $1
+}
+
+log() {
+    echo "-#- $@" >&2
+}
+
+die() {
+    echo "ERROR: $@" >&2
+    exit 2
+}
+
+variable_check() {
+    eval test -n "\${$1}" || die "undefined $1"
+}
+
+array_check() {
+    eval test "\${#$1}" -gt 0 || die "undefined $1"
+}
+
+# read args
+overwrite=1
+debug=0
+while getopts "chn" c; do
+    case "$c" in
+        'c') overwrite=0 ;;
+        'h') usage 0 ;;
+        'n') debug=1 ;;
+        '?') usage 1 ;;
+    esac
+done
+shift $((OPTIND - 1))
+[ $# -eq 1 ] || usage 1
+parameters="$1"
+
+log "Running: $0 $@"
+log "Hostname: $(hostname -f)"
+
+declare -a TOPOLOGIES ALGORITHMS PLATFORMS COMMON_OPTS
+
+# read parameters
+log "Reading parameters from \"$1\"."
+source "$parameters" || die "cannot read parameters file: \"$parameters\""
+
+array_check TOPOLOGIES
+array_check ALGORITHMS
+array_check PLATFORMS
+variable_check NHOSTS
+variable_check LOAD
+variable_check DEADLINE
+
+# default values
+: ${RESULTS:=$PWD/results}
+: ${LOBA:=$PWD/loba}
+
+COMMON_OPTS=(
+    --cfg=contexts/factory:raw
+)
+
+log "Results put in: \"$RESULTS\"."
+
+[ $debug = 1 ] && log "Running in dry-run mode"
+
+outfile() {
+    echo "$*" | sed 's,[^ ]*/,,g;s/\.xml//;y/ /_/'
+}
+
+for plat in "${PLATFORMS[@]}"; do
+    tmp=$(basename "$plat" ".xml")
+    plat_output="$RESULTS/plat_$tmp"
+    for topo in "${TOPOLOGIES[@]}"; do
+        topo_output="$plat_output/topo_$topo"
+        for algo in "${ALGORITHMS[@]}"; do
+            algo_output="$topo_output/algo_$algo"
+            [ $debug = 0 ] && mkdir -p "$algo_output"
+            args=(
+                -T"$topo"
+                -a"$algo"
+                -N"$NHOSTS"
+                -L"$LOAD"
+                -t"$DEADLINE"
+                "$plat"
+            )
+            for bk in "" "-b"; do
+                tmp=$(outfile "loba" $bk "${args[@]}")
+                out="$algo_output/$tmp.out"
+                cmd=( "$LOBA" "${COMMON_OPTS[@]}" $bk "${args[@]}" )
+                log "Run: ${cmd[@]}"$'\n'"... &> $out"
+                if [ $overwrite = 0 -a -e "$out" ]; then
+                    log "already run !"
+                    tail -n4 "$out"
+                    continue
+                fi
+                if [ $debug = 1 ]; then
+                    log "skipped (dry-run)"
+                else
+                    echo "# ${cmd[@]}" > "$out"
+                    "${cmd[@]}" >> "$out" 2>&1
+                    tail -n4 "$out"
+                fi
+            done
+        done
+    done
+done
diff --git a/Experimentations/sample_parameters b/Experimentations/sample_parameters
new file mode 100644 (file)
index 0000000..f4d740d
--- /dev/null
@@ -0,0 +1,38 @@
+
+# define the topologies
+TOPOLOGIES=(
+    btree
+    clique
+    hcube
+    line
+    ring
+    star
+    torus
+)
+
+# define the algorithms
+ALGORITHMS=(
+    besteffort
+    makhoul
+    simple
+)
+
+# the different platform files
+PLATFORMS=(
+    ../platform.xml
+)
+
+# number of hosts
+NHOSTS=0
+
+# total load
+LOAD=1000
+
+# time limit for the simulation
+DEADLINE=10000
+
+# optional: path to binary (default: ./loba)
+#LOBA=./loba
+
+# optional: path to results (default: ./results)
+#RESULTS=./results