1 Star 0 Fork 4

EzioZz/swcodegen

forked from 锦轩/swcodegen 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
polybench_test.sh.in 2.54 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/sh
keep=no
verbose=no
for option; do
case "$option" in
--keep)
keep=yes
;;
--verbose)
verbose=yes
;;
esac
done
EXEEXT=@EXEEXT@
DIR=@POLYBENCH_DIR@
VERSION=@GIT_HEAD_VERSION@
SIZE=-DMINI_DATASET
CC="@CC@"
HAVE_OPENCL=@HAVE_OPENCL@
HAVE_OPENMP=@HAVE_OPENMP@
srcdir="@srcdir@"
if [ $keep = "yes" ]; then
OUTDIR="out.$VERSION"
mkdir "$OUTDIR" || exit 1
else
if test "x$TMPDIR" = "x"; then
TMPDIR=/tmp
fi
OUTDIR=`mktemp -d $TMPDIR/ppcg.XXXXXXXXXX` || exit 1
fi
CPPFLAGS="-DPOLYBENCH_USE_C99_PROTO -DPOLYBENCH_DUMP_ARRAYS"
CPPFLAGS="$CPPFLAGS $SIZE -I $DIR/utilities"
CFLAGS="-lm --std=gnu99"
echo "Running tests in folder ${OUTDIR}"
run_tests () {
ext=$1
ppcg_options=$2
cc_options=$3
if [ "x$ppcg_options" = "x" ]; then
ppcg_option_str="none"
else
ppcg_option_str=$ppcg_options
fi
if [ "x$cc_options" = "x" ]; then
cc_option_str="none"
else
cc_option_str=$cc_options
fi
echo Test: $ext, ppcg options: $ppcg_option_str, CC options: $cc_option_str
for i in `cat $DIR/utilities/benchmark_list`; do
echo $i
name=`basename $i`
name=${name%.c}
source_opt="${OUTDIR}/$name.$ext.c"
prog_orig=${OUTDIR}/$name.orig${EXEEXT}
prog_opt=${OUTDIR}/$name.$ext${EXEEXT}
output_orig=${OUTDIR}/$name.orig.out
output_opt=${OUTDIR}/$name.$ext.out
dir=`dirname $i`
if [ $verbose = "yes" ]; then
echo ./ppcg$EXEEXT -I $DIR/$dir $DIR/$i \
$CPPFLAGS -o $source_opt $ppcg_options
fi
./ppcg$EXEEXT -I $DIR/$dir $DIR/$i $CPPFLAGS \
-o $source_opt $ppcg_options || exit
$CC -I $DIR/$dir $CPPFLAGS $DIR/$i -o $prog_orig \
$DIR/utilities/polybench.c $CFLAGS
$prog_orig 2> $output_orig
if [ $verbose = "yes" ]; then
echo $CC -I $DIR/$dir $CPPFLAGS $source_opt \
-o $prog_opt $DIR/utilities/polybench.c \
$CFLAGS $cc_options
fi
$CC -I $DIR/$dir $CPPFLAGS $source_opt -o $prog_opt \
$DIR/utilities/polybench.c $CFLAGS $cc_options || exit
$prog_opt 2> $output_opt || exit
cmp $output_orig $output_opt || exit
done
}
run_tests ppcg "--target=c --tile"
run_tests ppcg_live "--target=c --no-live-range-reordering --tile"
# Test OpenMP code, if compiler supports openmp
if [ $HAVE_OPENMP = "yes" ]; then
run_tests ppcg_omp "--target=c --openmp" -fopenmp
echo Introduced `grep -R 'omp parallel' "${OUTDIR}" | wc -l` '"pragma omp parallel for"'
else
echo Compiler does not support OpenMP. Skipping OpenMP tests.
fi
if [ $HAVE_OPENCL = "yes" ]; then
run_tests ppcg_opencl "--target=opencl --opencl-no-use-gpu" \
"-I $srcdir $srcdir/ocl_utilities.c -lOpenCL"
fi
if [ $keep = "no" ]; then
rm -r "${OUTDIR}"
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/EzioZz/swcodegen.git
git@gitee.com:EzioZz/swcodegen.git
EzioZz
swcodegen
swcodegen
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385