Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: lacombar/hackbench
base: 2f1db234eb
...
head fork: lacombar/hackbench
compare: 4fd0775c69
  • 19 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 206 additions and 90 deletions.
  1. +200 −89 rebuild.sh
  2. +6 −1 scripts/parse-results.rb
View
289 rebuild.sh
@@ -24,11 +24,24 @@ die()
exit 1
}
+_mkdir()
+{
+ local _directory="$1"
+
+ [ -d "${_directory}" ] || mkdir "${_directory}"
+}
+
_list_runs()
{
+ local _cwd=$(pwd)
+ local _ppwd
local _run
- find "runs" -mindepth 1 -maxdepth 1 -type d | \
+ _ppwd=${_cwd%/*}
+ _ppwd=${_ppwd%/*}
+ [ "${_ppwd##*/}" = "arch" ] || die "_list_runs"
+
+ find "." -mindepth 1 -maxdepth 1 -type d | \
sort | \
while read _run; do
[ -f "${_run}/results.yml" ] && echo ${_run##*/}
@@ -46,27 +59,20 @@ list_runs()
_list_runs "$@"
}
-list_results()
-{
- local _result
-
- find "data" -name '*.*' | while read _result; do
- echo ${_result##*/}
- done
-}
-
for_each_run()
{
local _cb=$1; shift
local _cwd=$(pwd)
- local _runs=$(list_runs)
+ local _run
list_runs | while read _run; do
RUN=${_run}
- cd "runs/${_run}"
+ cd "${_run}"
${_cb} "$@"
cd "${_cwd}"
+
+ RUN=
done
}
@@ -77,13 +83,14 @@ _list_platforms()
local _platform
_pwd=${_cwd%/*}
- [ "${_pwd##*/}" = "arch" ] || die
+ [ "${_pwd##*/}" = "arch" ] || die "_list_platforms"
find "." -maxdepth 1 -mindepth 1 -type d | \
sort | \
while read _platform; do
- echo ${_platform##*/}
- done
+ _platform=${_platform##*/}
+ echo ${_platform}
+ done
}
list_platforms()
@@ -100,6 +107,7 @@ list_platforms()
for_each_platform()
{
local _cb=$1; shift
+ local _cwd=$(pwd)
local _platform
list_platforms | while read _platform; do
@@ -108,11 +116,11 @@ for_each_platform()
PLATFORM=${_platform}
- local _cwd=$(pwd)
-
cd "${_platform}";
${_cb} "$@"
cd "${_cwd}"
+
+ PLATFORM=
done
}
@@ -121,7 +129,7 @@ _list_arch()
local _cwd=$(pwd)
local _arch
- [ "${_cwd##*/}" = "arch" ] || die
+ [ "${_cwd##*/}" = "arch" ] || die "_list_arch"
find "." -maxdepth 1 -mindepth 1 -type d | \
sort | \
@@ -150,15 +158,17 @@ for_each_arch()
list_arch | while read _arch; do
[ -d "${_arch}" ] || \
- die "${_platform}: no such directory"
-
- ARCH=${_arch}
+ die "${_arch}: no such directory"
local _cwd=$(pwd)
+ ARCH=${_arch}
+
cd "${_arch}";
${_cb} "$@"
cd "${_cwd}"
+
+ ARCH=
done
cd ..
@@ -202,8 +212,11 @@ find_template()
generate_run_results()
{
+ local _destdir="$(get_destdir)"
- ${RESULTS_SCRIPT_INTERPRETER} ${RESULTS_SCRIPT_INTERPRETER_ARGS} \
+ O=${_destdir} \
+ ${RESULTS_SCRIPT_INTERPRETER} \
+ ${RESULTS_SCRIPT_INTERPRETER_ARGS} \
${RESULTS_SCRIPT} .
}
@@ -224,20 +237,21 @@ generate_run_script_by_ipc()
{
local _nloop="$1"; shift
local _ipc="$1"
+ local _destdir="$(get_destdir)"
local _process_data
local _thread_data
- local _image
+ local _plot
local _script
- _process_data="data/${_ipc}-process.${_nloop}"
- _thread_data="data/${_ipc}-thread.${_nloop}"
+ _process_data="${_destdir}/data/${_ipc}-process.${_nloop}"
+ _thread_data="${_destdir}/data/${_ipc}-thread.${_nloop}"
[ -e "${_process_data}" -a -e "${_thread_data}" ] || \
return 0
# generate ...
- _script="scripts/${_ipc}.${_nloop}.gplot"
- _image="images/${_ipc}.${_nloop}.png"
+ _script="${_destdir}/scripts/${_ipc}.${_nloop}.gplot"
+ _plot="${_destdir}/plots/${_ipc}.${_nloop}.png"
cat <<EOF > "${_script}"
set terminal png size 800, 300
@@ -245,7 +259,7 @@ set ylabel "time (s)"
set xlabel "ngroup"
set boxwidth 1.5 absolute
set key left top vertical Left reverse enhanced
-set output '${_image}'
+set output '${_plot}'
plot \\
EOF
{
@@ -260,20 +274,21 @@ generate_run_script_by_mode()
{
local _nloop="$1"; shift
local _mode="$1"
+ local _destdir="$(get_destdir)"
local _pipe_data
local _socket_data
- local _image
+ local _plot
local _script
- _pipe_data="data/pipe-${_mode}.${_nloop}"
- _socket_data="data/socket-${_mode}.${_nloop}"
+ _pipe_data="${_destdir}/data/pipe-${_mode}.${_nloop}"
+ _socket_data="${_destdir}/data/socket-${_mode}.${_nloop}"
[ -e "${_pipe_data}" -a -e "${_socket_data}" ] || \
return 0
# generate ...
- _script="scripts/${_mode}.${_nloop}.gplot"
- _image="images/${_mode}.${_nloop}.png"
+ _script="${_destdir}/scripts/${_mode}.${_nloop}.gplot"
+ _plot="${_destdir}/plots/${_mode}.${_nloop}.png"
cat <<EOF > "${_script}"
set terminal png size 800, 300
@@ -281,7 +296,7 @@ set ylabel "time (s)"
set xlabel "ngroup"
set boxwidth 1.5 absolute
set key left top vertical Left reverse enhanced
-set output '${_image}'
+set output '${_plot}'
plot \\
EOF
{
@@ -295,7 +310,7 @@ EOF
generate_one_run_map()
{
local _script="$1"
- local _image="$2"
+ local _plot="$2"
local _data="$3"
local _max_ngroup="$4"
local _max_nloop="$5"
@@ -305,7 +320,7 @@ generate_one_run_map()
set xrange [0:${_max_ngroup}]
set yrange [0:${_max_nloop}]
set terminal png size 800, 300
-set output '${_image}'
+set output '${_plot}'
set palette rgbformulae -3,-3,-7
set title "${_title}"
set multiplot
@@ -330,7 +345,7 @@ EOF
generate_one_normalized_run_map()
{
local _script="$1"
- local _image="$2"
+ local _plot="$2"
local _data="$3"
local _max_ngroup="$4"
local _max_nloop="$5"
@@ -340,7 +355,7 @@ generate_one_normalized_run_map()
set xrange [0:${_max_ngroup}]
set yrange [0:${_max_nloop}]
set terminal png size 800, 300
-set output '${_image}'
+set output '${_plot}'
set palette defined (-1 "#00bb00", -0.5 "#00bb00", 0 "#ffffff", 0.5 "#bb0000", 1 "#bb0000")
set cbrange [-1:1]
set title "${_title}"
@@ -367,44 +382,50 @@ generate_run_map()
{
local _ipc=$1; shift;
local _mode=$1; shift;
+ local _destdir="$(get_destdir)"
local _max_ngroup
local _max_nloop
local _data
- local _image
+ local _plot
local _script
local _normalized_script
- _data="data/${_ipc}-${_mode}"
+ _data="${_destdir}/data/${_ipc}-${_mode}"
[ -e "${_data}" ] || return 0
- _script="scripts/${_ipc}-${_mode}.gplot"
- _image="images/${_ipc}-${_mode}.png"
+ _script="${_destdir}/scripts/${_ipc}-${_mode}.gplot"
+ _plot="${_destdir}/plots/${_ipc}-${_mode}.png"
_title="${RUN} (${_ipc} / ${_mode})"
_max_ngroup="$(tail -1 "${_data}" | awk '{print $1}')"
_max_nloop="$(tail -1 "${_data}" | awk '{print $2}')"
- generate_one_run_map "${_script}" "${_image}" "${_data}" \
+ generate_one_run_map "${_script}" "${_plot}" "${_data}" \
"${_max_ngroup}" "${_max_nloop}" "${_title}"
- _data="data/${_ipc}-${_mode}-normalized"
+ _data="${_destdir}/data/${_ipc}-${_mode}-normalized"
[ -e "${_data}" ] || return 0
- _script="scripts/${_ipc}-${_mode}-normalized.gplot"
- _image="images/${_ipc}-${_mode}-normalized.png"
+ _script="${_destdir}/scripts/${_ipc}-${_mode}-normalized.gplot"
+ _plot="${_destdir}/plots/${_ipc}-${_mode}-normalized.png"
- generate_one_normalized_run_map "${_script}" "${_image}" "${_data}" \
+ generate_one_normalized_run_map "${_script}" "${_plot}" "${_data}" \
"${_max_ngroup}" "${_max_nloop}" "${_title}"
}
-generate_run_scripts()
+list_results()
{
- local _image
- local _data
+ local _destdir="$(get_destdir)"
local _result
- local _script
- local _mode
+
+ find "${_destdir}/data" -name '*.*' | while read _result; do
+ echo ${_result##*/}
+ done
+}
+
+generate_run_scripts()
+{
list_results | \
sed 's/.*\.//' | \
@@ -462,7 +483,10 @@ compute_run_time()
{
local _ipc="$1"
local _mode="$2"
- local _data="data/${_ipc}-${_mode}"
+ local _destdir="$(get_destdir)"
+ local _data
+
+ _data="${_destdir}/data/${_ipc}-${_mode}"
runtime=0
[ -e "${_data}" ] && runtime=$(sum_runtime "${_data}")
@@ -477,11 +501,16 @@ output_runtime_header()
generate_runtime_results()
{
local _ipc="$1"
- local _data="data/${_ipc}-runtime"
- local _script="scripts/runtime-${_ipc}.gplot"
- local _image="images/runtime-${_ipc}.png"
+ local _destdir="$(get_destdir)"
+ local _data
+ local _script
+ local _plot
local _run
+ _data="${_destdir}/data/${_ipc}-runtime"
+ _script="${_destdir}/scripts/runtime-${_ipc}.gplot"
+ _plot="${_destdir}/plots/runtime-${_ipc}.png"
+
{
echo -n "_ "
for_each_run \
@@ -496,7 +525,7 @@ generate_runtime_results()
{
ncol=$(head -1 "${_data}" | wc -w)
i=2
- echo "set output '${_image}'"
+ echo "set output '${_plot}'"
echo "plot \\"
while [ $i -lt $ncol ]; do
echo " '${_data}' using $i ti col, \\"; i=$(($i+1))
@@ -509,8 +538,10 @@ generate_runtime_results()
generate_combined_run_result()
{
- local _pwd=$(pwd)
- local _data="${_pwd}/data/$1"
+ local _destdir="$(get_destdir)"
+ local _data
+
+ _data="${_destdir}/data/$1"
[ -e "${_data}" ] || return 0
@@ -521,16 +552,20 @@ generate_combined_run_result()
generate_combined_results()
{
local _ipc="$1"
+ local _destdir="$(get_destdir)"
local _loop_data
for_each_run list_results | \
sort -u |
while read _loop_data; do
- local _image="images/combined-${_loop_data}.png"
- local _script="scripts/combined-${_loop_data}.gplot"
+ local _plot
+ local _script
+
+ _plot="${_destdir}/plots/combined-${_loop_data}.png";
+ _script="${_destdir}/scripts/combined-${_loop_data}.gplot"
{
- echo "set output '${_image}'"
+ echo "set output '${_plot}'"
echo "plot \\"
} > "${_script}"
@@ -543,10 +578,12 @@ generate_combined_results()
plot()
{
+ local _destdir="$(get_destdir)"
local _script
- for _script in scripts/*.gplot; do
- local _template=$(find_template "${_script}")
+ for _script in ${_destdir}/scripts/*.gplot; do
+ local _template
+ _template=$(find_template "${_script}")
gnuplot ${_template} ${_script}
done
@@ -560,27 +597,38 @@ COMBINED_RESULTS_TEMPLATE="$(pwd)/templates/combined-results.gplot"
RUNTIME_RESULTS_TEMPLATE="$(pwd)/templates/runtime.gplot"
TEMPLATES_DIR="$(pwd)/templates"
-DO_GENERATE=1
-DO_PLOT=1
+DESTDIR=$(pwd)/results
do_list_platforms()
{
+ local _platform
+
echo " * ${ARCH}"
- list_platforms
+ list_platforms | \
+ while read _platform; do
+ echo " - ${_platform}"
+ done
}
do_list_runs()
{
+ local _run
echo " * ${ARCH} - ${PLATFORM}"
- list_runs
+ list_runs | \
+ while read _run; do
+ echo " - ${_run}"
+ done
}
list()
{
case $1 in
"arch")
+ local _ocwd=$(pwd)
+ cd "arch"
list_arch
+ cd "${_ocwd}"
;;
"platforms")
for_each_arch \
@@ -599,15 +647,9 @@ do
A)
ARCHS_OVERRIDE="$(echo ${OPTARG} | sed 's/,/ /g')"
;;
- g)
- DO_PLOT=0
- ;;
l)
LIST=${OPTARG}
;;
- p)
- DO_GENERATE=0
- ;;
P)
PLATFORMS_OVERRIDE="$(echo ${OPTARG} | sed 's/,/ /g')"
;;
@@ -626,29 +668,59 @@ if [ -n "${LIST:-}" ]; then
exit
fi
-check_directories()
+get_destdir()
+{
+ echo "${DESTDIR}/${ARCH}/${PLATFORM}/${RUN}"
+}
+
+build_destdir_directories()
{
- for _dir in images data scripts; do
- [ -e "${_dir}" ] || mkdir "${_dir}"
+ local _ocwd=$(pwd)
+ local _destdir="$(get_destdir)"
+
+ _mkdir "${_destdir}"
+ cd "${_destdir}"
+
+ for _dir in plots data scripts; do
+ _mkdir "${_dir}"
done
+
+ cd ${_ocwd}
}
-for_each_arch \
- for_each_platform \
- for_each_run \
- check_directories
+ARCH=
+PLATFORM=
+RUN=
+
+build_destdir()
+{
+
+ _mkdir "${DESTDIR}"
+
+ for_each_arch \
+ build_destdir_directories
-for_each_arch \
- for_each_platform \
- check_directories
+ for_each_arch \
+ for_each_platform \
+ build_destdir_directories
-if [ ${DO_GENERATE} = 1 ]; then
+ for_each_arch \
+ for_each_platform \
+ for_each_run \
+ build_destdir_directories
+}
+
+generate_results()
+{
echo "* Generating results ..."
for_each_arch \
for_each_platform \
for_each_run \
generate_run_results
+}
+generate_scripts()
+{
echo "* Generating scripts ..."
for_each_arch \
@@ -665,10 +737,11 @@ if [ ${DO_GENERATE} = 1 ]; then
for_each_platform \
for_each_ipc \
generate_combined_results
-fi
+}
-if [ ${DO_PLOT} = 1 ]; then
- echo "* Plotting ..."
+generate_plots()
+{
+ echo "* Generating plots ..."
for_each_arch \
for_each_platform \
@@ -678,4 +751,42 @@ if [ ${DO_PLOT} = 1 ]; then
for_each_arch \
for_each_platform \
plot
-fi
+}
+
+main()
+{
+ local _do_results=1
+ local _do_scripts=1
+ local _do_plots=1
+
+ build_destdir
+
+ while [ $# != 0 ]; do
+ _do_results=
+ _do_scripts=
+ _do_plots=
+
+ case "$1" in
+ "results")
+ _do_results=1
+ ;;
+ "scripts")
+ _do_scripts=1
+ ;;
+ "plots")
+ _do_plots=1
+ ;;
+ esac
+
+ shift
+ done
+
+ [ -z "${_do_results}" ] || generate_results
+
+ [ -z "${_do_scripts}" ] || generate_scripts
+
+ [ -z "${_do_plots}" ] || generate_plots
+}
+
+main "$@"
+
View
7 scripts/parse-results.rb
@@ -20,7 +20,7 @@ def parse_results(results)
results.keys.each { |ipc|
modes=results[ipc]
modes.keys.sort.each { |mode|
- output_name = "#{@basedir}/data/#{ipc}-#{mode}"
+ output_name = "#{@outdir}/data/#{ipc}-#{mode}"
output = File.open(output_name, "w")
nloop_output_mode = "w"
@@ -53,6 +53,11 @@ def parse_results(results)
@basedir = "."
end
+@outdir = ENV['O']
+if @outdir.nil?
+ @outdir = "."
+end
+
@data = YAML.load(File.open("#{@basedir}/results.yml")).to_hash
@data.each_pair { |k, v|

No commit comments for this range

Something went wrong with that request. Please try again.