From: Aberrahmane Sider Date: Wed, 25 May 2011 23:11:41 +0000 (+0100) Subject: Adding extract-all and extract-all-inv bash scripts that create latex tabular data... X-Git-Tag: v0.1~63 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/70611cc5a8c28decbc1580c18f3a805347fb846e?ds=inline;hp=-c Adding extract-all and extract-all-inv bash scripts that create latex tabular data with the results folder of run-all. Compile and view all results using sample-latex-tabular-results.tex inside the results/platform folder --- 70611cc5a8c28decbc1580c18f3a805347fb846e diff --git a/Experimentations/extract-all b/Experimentations/extract-all new file mode 100755 index 0000000..6cb1b65 --- /dev/null +++ b/Experimentations/extract-all @@ -0,0 +1,142 @@ +#!/bin/bash + +set -e +#set -x + +usage() { + cat >&2 < +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 from : \"$RESULTS\"." + +[ $debug = 1 ] && log "Running in dry-run mode" + +outfile() { + echo "$*" | sed 's,[^ ]*/,,g;s/\.xml//;y/ /_/' +} +params=([0]="Load" [1]="Computation" [2]="Data send amount" [3]="Data send count" ) +params_pos=(9 5 7 7) +firsttexline="|l|" +for algo in "${ALGORITHMS[@]}"; do + for bk in "" "-b"; do + firsttexline=$(echo "$firsttexline r|") + done +done +firsttexline=$(echo -e "\\\begin{tabular}{$firsttexline}\n\\hline\c") + +lasttexline="\\end{tabular}" + +secondtexline="Param/Alg" +for algo in "${ALGORITHMS[@]}"; do + for bk in "" "-b"; do + secondtexline=$(echo -e "$secondtexline&\t${algo}${bk}") + done +done +secondtexline=$(echo -e "$secondtexline\\t \\\\\\\\ \\hline \\hline\c") + +mediantexlineend=$(echo -e "\\\\\\\\ \\hline\c") +# mediantexlineend=$(echo -e "$mediantexlineend\c") + + +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" + topo_data_all_output="$plat_output/data_$topo-all.tex" + echo "$firsttexline" > "$topo_data_all_output" + echo "$secondtexline" >> "$topo_data_all_output" + for target_i in "0" "1" "2" "3"; do + target_param=${params[$target_i]}; + target_position=${params_pos[$target_i]}; + outfilesuffix=$(outfile "${target_param[@]}") + mediantexline="$target_param\t" + for algo in "${ALGORITHMS[@]}"; do + topo_data_out="$plat_output/data_$topo-$outfilesuffix.tex" + algo_output="$topo_output/algo_$algo" + args=( + -T"$topo" + -a"$algo" + -N"$NHOSTS" + -L"$LOAD" + -t"$DEADLINE" + "$plat" + ) + for bk in "" "-b"; do + tmp=$(outfile "loba" $bk "${args[@]}") + infile="$algo_output/$tmp.out" + variable=$(awk '/'"$target_param"'/{print $'"$target_position"'}' "$infile") + log "Reading $target_param from $infile : $variable" + mediantexline=$(echo -e "$mediantexline&$variable\t") + echo -e "$algo$bk\t$variable\n" >> "$topo_data_out" + done + done + echo "$mediantexline" >> "$topo_data_all_output" + echo "$mediantexlineend" >> "$topo_data_all_output" + done + echo "$lasttexline" >> "$topo_data_all_output" + done +done diff --git a/Experimentations/extract-all-inv b/Experimentations/extract-all-inv new file mode 100755 index 0000000..dfa4c60 --- /dev/null +++ b/Experimentations/extract-all-inv @@ -0,0 +1,138 @@ +#!/bin/bash + +set -e +#set -x + +usage() { + cat >&2 < +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 from : \"$RESULTS\"." + +[ $debug = 1 ] && log "Running in dry-run mode" + +outfile() { + echo "$*" | sed 's,[^ ]*/,,g;s/\.xml//;y/ /_/' +} +params=([0]="Load" [1]="Computation" [2]="Data send amount" [3]="Data send count" ) +params_pos=(9 5 7 7) + +firsttexline="|l|" +for param in "${params[@]}"; do + firsttexline=$(echo "$firsttexline r|") +done +firsttexline=$(echo -e "\\\begin{tabular}{$firsttexline}\n\\hline\c") + +lasttexline="\\end{tabular}" + +secondtexline="Alg/Param" +for param in "${params[@]}"; do + secondtexline=$(echo -e "$secondtexline&\t${param}") +done +secondtexline=$(echo -e "$secondtexline\\t \\\\\\\\ \\hline \\hline\c") + +mediantexlineend=$(echo -e "\\\\\\\\ \\hline\c") +# mediantexlineend=$(echo -e "$mediantexlineend\c") + +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" + topo_data_all_output="$plat_output/data_$topo-all.tex" + echo "$firsttexline" > "$topo_data_all_output" + echo "$secondtexline" >> "$topo_data_all_output" + for algo in "${ALGORITHMS[@]}"; do + algo_output="$topo_output/algo_$algo" + args=( + -T"$topo" + -a"$algo" + -N"$NHOSTS" + -L"$LOAD" + -t"$DEADLINE" + "$plat" + ) + for bk in "" "-b"; do + mediantexline="$algo$bk\t" + tmp=$(outfile "loba" $bk "${args[@]}") + infile="$algo_output/$tmp.out" + for target_i in "0" "1" "2" "3"; do + target_param=${params[$target_i]}; + target_position=${params_pos[$target_i]}; + outfilesuffix=$(outfile "${target_param[@]}") + topo_data_out="$plat_output/data_$topo-$outfilesuffix.tex" + variable=$(awk '/'"$target_param"'/{print $'"$target_position"'}' "$infile") + log "Reading $target_param from $infile : $variable" + mediantexline=$(echo -e "$mediantexline&$variable\t") + echo -e "$algo$bk\t$variable\n" >> "$topo_data_out" + done + echo "$mediantexline" >> "$topo_data_all_output" + echo "$mediantexlineend" >> "$topo_data_all_output" + done + done + echo "$lasttexline" >> "$topo_data_all_output" + done +done diff --git a/Experimentations/sample-latex-tabular.tex b/Experimentations/sample-latex-tabular.tex new file mode 100644 index 0000000..f718522 --- /dev/null +++ b/Experimentations/sample-latex-tabular.tex @@ -0,0 +1,54 @@ +\documentclass[10pt,a4paper]{article} +\usepackage[latin1]{inputenc} +\usepackage{float} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\begin{document} +\begin{flushleft} + +\begin{table} +\caption{Btree-plat} +\input{data_btree-all} +\label{tbl:plat-btree-all} +\end{table} + +\begin{table} +\caption{Clique-plat} +\input{data_clique-all} +\label{tbl:plat-clique-all} +\end{table} + +\begin{table} +\caption{Hcube-plat} +\input{data_hcube-all} +\label{tbl:plat-hcube-all} +\end{table} + +\begin{table} +\caption{Line-plat} +\input{data_line-all} +\label{tbl:plat-line-all} +\end{table} + +\begin{table} +\caption{Ring-plat} +\input{data_ring-all} +\label{tbl:plat-ring-all} +\end{table} + +\begin{table} +\caption{Star-plat} +\input{data_star-all} +\label{tbl:plat-torus-all} +\end{table} + + +\begin{table} +\caption{Torus-plat} +\input{data_torus-all} +\label{tbl:plat-torus-all} +\end{table} + +\end{flushleft} +\end{document}