1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#!/usr/bin/env bash
###############################################################################
# Copyright (c) Intel Corporation - All rights reserved. #
# This file is part of the LIBXSMM library. #
# #
# For information on the license, see the LICENSE file. #
# Further information: https://github.com/hfp/libxsmm/ #
# SPDX-License-Identifier: BSD-3-Clause #
###############################################################################
# Hans Pabst (Intel Corp.)
###############################################################################
HERE=$(cd "$(dirname "$0")" && pwd -P)
FIND=$(command -v find)
SORT=$(command -v sort)
JOIN=$(command -v join)
CUT=$(command -v cut)
SED=$(command -v sed)
AWK=$(command -v awk)
RM=$(command -v rm)
if [ "" = "$1" ]; then
KIND=xsmm
else
KIND=$1
shift
fi
if [ "" = "$1" ]; then
FILEEXT=pdf
else
FILEEXT=$1
shift
fi
if [ "" = "$1" ]; then
MULTI=1
else
MULTI=$1
shift
fi
if [ -f /cygdrive/c/Program\ Files/gnuplot/bin/wgnuplot ]; then
WGNUPLOT=/cygdrive/c/Program\ Files/gnuplot/bin/wgnuplot
GNUPLOT=/cygdrive/c/Program\ Files/gnuplot/bin/gnuplot
elif [ -f /cygdrive/c/Program\ Files\ \(x86\)/gnuplot/bin/wgnuplot ]; then
WGNUPLOT=/cygdrive/c/Program\ Files\ \(x86\)/gnuplot/bin/wgnuplot
GNUPLOT=/cygdrive/c/Program\ Files\ \(x86\)/gnuplot/bin/gnuplot
else
GNUPLOT=$(command -v gnuplot)
WGNUPLOT=${GNUPLOT}
fi
GNUPLOT_MAJOR=0
GNUPLOT_MINOR=0
if [ -f "${GNUPLOT}" ]; then
GNUPLOT_MAJOR=$("${GNUPLOT}" --version | ${SED} "s/.\+ \([0-9]\).\([0-9]\) .*/\1/")
GNUPLOT_MINOR=$("${GNUPLOT}" --version | ${SED} "s/.\+ \([0-9]\).\([0-9]\) .*/\2/")
fi
GNUPLOT_VERSION=$((GNUPLOT_MAJOR * 10000 + GNUPLOT_MINOR * 100))
if [ "40600" -le "${GNUPLOT_VERSION}" ]; then
if [ -f "${HERE}/benchmark.set" ]; then
# determine behavior of sort command
export LC_ALL=C.UTF-8
${JOIN} --nocheck-order \
<(${CUT} "${HERE}/benchmark.set" -d" " -f1-3 | ${SORT} -nk1) \
<(${SORT} -nk1 benchmark-${KIND}.txt) \
| ${AWK} \
'{ if ($2==$4 && $3==$5) printf("%s %s %s %s %s\n", $1, $2, $3, $6, $8) }' \
| ${SORT} \
-b -n -k1 -k2 -k3 \
> benchmark-${KIND}.join
fi
env GDFONTPATH=/cygdrive/c/Windows/Fonts \
FILEEXT=${FILEEXT} KIND=${KIND} MULTI=${MULTI} \
"${WGNUPLOT}" "${HERE}/benchmark.plt"
if [ "1" != "${MULTI}" ] && [ "pdf" != "${FILEEXT}" ] && [ "$(command -v mogrify)" ]; then
${FIND} . -name "benchmark*.${FILEEXT}" -type f -exec mogrify -trim -transparent-color white {} \;
fi
else
>&2 echo "Error: missing prerequisites!"
exit 1
fi
|