1 Star 0 Fork 4

EzioZz/swcodegen

forked from 锦轩/swcodegen 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
opencl_test.sh.in 1.77 KB
一键复制 编辑 原始数据 按行查看 历史
Sven van Haastregt 提交于 2014-05-14 17:26 . add chemv example
#!/bin/sh
keep=no
for option; do
case "$option" in
--keep)
keep=yes
;;
esac
done
EXEEXT=@EXEEXT@
VERSION=@GIT_HEAD_VERSION@
CC="@CC@"
CFLAGS="--std=gnu99"
srcdir="@srcdir@"
if [ $keep = "yes" ]; then
OUTDIR="opencl_test.$VERSION"
mkdir "$OUTDIR" || exit 1
else
if test "x$TMPDIR" = "x"; then
TMPDIR=/tmp
fi
OUTDIR=`mktemp -d $TMPDIR/ppcg.XXXXXXXXXX` || exit 1
fi
run_tests () {
subdir=$1
ppcg_options=$2
echo Test with PPCG options \'$ppcg_options\'
mkdir ${OUTDIR}/${subdir} || exit 1
for i in $srcdir/tests/*.c; do
echo $i
name=`basename $i`
name="${name%.c}"
out_c="${OUTDIR}/${subdir}/$name.ppcg.c"
out="${OUTDIR}/${subdir}/$name.ppcg$EXEEXT"
options="--target=opencl --opencl-no-use-gpu $ppcg_options"
functions="$srcdir/tests/${name}_opencl_functions.cl"
if test -f $functions; then
options="$options --opencl-include-file=$functions"
options="$options --opencl-compiler-options=-I."
fi
./ppcg$EXEEXT $options $i -o "$out_c" || exit
$CC $CFLAGS -I "$srcdir" "$srcdir/ocl_utilities.c" -lOpenCL \
-I. "$out_c" -o "$out" || exit
$out || exit
done
}
run_tests default
run_tests embed --opencl-embed-kernel-code
for i in $srcdir/examples/*.c; do
echo $i
name=`basename $i`
name="${name%.c}"
exe_ref="${OUTDIR}/$name.ref$EXEEXT"
gen_ocl="${OUTDIR}/$name.ppcg.c"
exe_ocl="${OUTDIR}/$name.ppcg$EXEEXT"
output_ref="${OUTDIR}/$name.ref.out"
output_ocl="${OUTDIR}/$name.ppcg.out"
$CC $CFLAGS $i -o $exe_ref || exit
./ppcg$EXEEXT --target=opencl --opencl-no-use-gpu $i -o "$gen_ocl" || \
exit
$CC $CFLAGS -I "$srcdir" "$srcdir/ocl_utilities.c" -lOpenCL \
"$gen_ocl" -o "$exe_ocl" || exit
$exe_ref > $output_ref || exit
$exe_ocl > $output_ocl || exit
cmp $output_ref $output_ocl || exit
done
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