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

Private GIT Repository
Print neighbor loads (debug) at termination.
[loba.git] / Experimentations / make_params
1 #!/bin/bash
2
3 set -e
4
5 TEMPLATE=${1:-"ag_parameters"}
6 PREFIX=param
7
8 log() {
9     echo "-#- $@" >&2
10 }
11
12 die() {
13     echo "ERROR: $@" >&2
14     exit 2
15 }
16
17 test -r "$TEMPLATE" || die "file not found: $TEMPLATE"
18
19 for flavour in "I" "R"; do
20     for distrib in "1" "N"; do
21         for ratio in "1000:1" "100:1" "10:1" "1:1" "1:10" "1:100" "1:1000"; do
22             declare -a opts=( -m1e-4 -M10 )
23             case "$flavour" in
24                 "I") opts+=( -Z ) ;;
25                 "R") : ;;
26                 *) die "unknown flavour: $flavour" ;;
27             esac
28             case "$distrib" in
29                 "1") : ;;
30                 "N") opts+=( -r42 -R ) ;;
31                 *) die "unknown distribution: $distrib" ;;
32             esac
33             case "$ratio" in
34                 "1000:1") opts+=( -c1e6,0 -C1.25e2,0 ) ;;
35                 "100:1")  opts+=( -c1e6,0 -C1.25e3,0 ) ;;
36                 "10:1")   opts+=( -c1e6,0 -C1.25e4,0 ) ;;
37                 "1:1")    opts+=( -c1e6,0 -C1.25e5,0 ) ;;
38                 "1:10")   opts+=( -c1e6,0 -C1.25e6,0 ) ;;
39                 "1:100")  opts+=( -c1e6,0 -C1.25e7,0 ) ;;
40                 "1:1000") opts+=( -c1e6,0 -C1.25e8,0 ) ;;
41                 *) die "unknown ratio: $ratio" ;;
42             esac
43             suffix="${flavour}${distrib}_${ratio}"
44             output="${PREFIX}_${suffix}"
45             more_args="${opts[@]}"
46             results="./results_${suffix}"
47             log "writing file: ${output}"
48             {
49                 sed -n '/MORE_ARGS/q;p' "$TEMPLATE"
50                 printf 'MORE_ARGS=( %s )\n' "${more_args}"
51                 sed -n '1,/MORE_ARGS/d;/RESULTS/q;p' "$TEMPLATE"
52                 printf 'RESULTS="%s"\n' "${results}"
53                 sed '1,/RESULTS/d' "$TEMPLATE"
54             } > "${output}"
55         done
56     done
57 done