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

Private GIT Repository
Add make_params.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 19 Jul 2011 16:32:23 +0000 (18:32 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 31 Aug 2011 20:18:56 +0000 (22:18 +0200)
Experimentations/make_params [new file with mode: 0755]

diff --git a/Experimentations/make_params b/Experimentations/make_params
new file mode 100755 (executable)
index 0000000..f034186
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+set -e
+
+TEMPLATE=${1:-"ag_parameters"}
+PREFIX=param
+
+log() {
+    echo "-#- $@" >&2
+}
+
+die() {
+    echo "ERROR: $@" >&2
+    exit 2
+}
+
+test -r "$TEMPLATE" || die "file not found: $TEMPLATE"
+
+for flavour in "I" "R"; do
+    for distrib in "1" "N"; do
+        for ratio in "1000:1" "100:1" "10:1" "1:1" "1:10" "1:100" "1:1000"; do
+            declare -a opts=( )
+            case "$flavour" in
+                "I") opts+=( -Z ) ;;
+                "R") : ;;
+                *) die "unknown flavour: $flavour" ;;
+            esac
+            case "$distrib" in
+                "1") : ;;
+                "N") opts+=( -r42 -R ) ;;
+                *) die "unknown distribution: $distrib" ;;
+            esac
+            case "$ratio" in
+                *100*)    continue ;; ##### HACK, FIXME #####
+                "1000:1") opts+=( -c1e6,0 -C1.25e2,0 ) ;;
+                "100:1")  opts+=( -c1e6,0 -C1.25e3,0 ) ;;
+                "10:1")   opts+=( -c1e6,0 -C1.25e4,0 ) ;;
+                "1:1")    opts+=( -c1e6,0 -C1.25e5,0 ) ;;
+                "1:10")   opts+=( -c1e6,0 -C1.25e6,0 ) ;;
+                "1:100")  opts+=( -c1e6,0 -C1.25e7,0 ) ;;
+                "1:1000") opts+=( -c1e6,0 -C1.25e8,0 ) ;;
+                *) die "unknown ratio: $ratio" ;;
+            esac
+            suffix="${flavour}${distrib}_${ratio}"
+            output="${PREFIX}_${suffix}"
+            more_args="${opts[@]}"
+            results="./results_${suffix}"
+            log "writing file: ${output}"
+            {
+                sed -n '/MORE_ARGS/q;p' "$TEMPLATE"
+                printf 'MORE_ARGS=( %s )\n' "${more_args}"
+                sed -n '1,/MORE_ARGS/d;/RESULTS/q;p' "$TEMPLATE"
+                printf 'RESULTS="%s"\n' "${results}"
+                sed '1,/RESULTS/d' "$TEMPLATE"
+            } > "${output}"
+        done
+    done
+done