From: Arnaud Giersch Date: Tue, 19 Jul 2011 16:32:23 +0000 (+0200) Subject: Add make_params. X-Git-Tag: v0.1~26 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/f1ac7a089033a5ecbe2c382a245531a24a83f1bf?hp=8c0fb7e6af2319e79b519a8a120b1472c53b22bf Add make_params. --- diff --git a/Experimentations/make_params b/Experimentations/make_params new file mode 100755 index 0000000..f034186 --- /dev/null +++ b/Experimentations/make_params @@ -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