README: -DPOLYBENCH_USE_C99_PROTO should not be used on nvcc command line
[ppcg.git] / opencl_test.sh.in
blob93ab89402e42b2efcf6f3dcefb40c35e1cfd614c
1 #!/bin/sh
3 keep=no
5 for option; do
6 case "$option" in
7 --keep)
8 keep=yes
9 ;;
10 esac
11 done
13 EXEEXT=@EXEEXT@
14 VERSION=@GIT_HEAD_VERSION@
15 CC="@CC@"
16 CFLAGS="--std=gnu99"
17 srcdir="@srcdir@"
19 if [ $keep = "yes" ]; then
20 OUTDIR="opencl_test.$VERSION"
21 mkdir "$OUTDIR" || exit 1
22 else
23 if test "x$TMPDIR" = "x"; then
24 TMPDIR=/tmp
26 OUTDIR=`mktemp -d $TMPDIR/ppcg.XXXXXXXXXX` || exit 1
29 for i in $srcdir/tests/*.c; do
30 echo $i
31 name=`basename $i`
32 name="${name%.c}"
33 out_c="${OUTDIR}/$name.ppcg.c"
34 out="${OUTDIR}/$name.ppcg$EXEEXT"
35 options="--target=opencl --opencl-no-use-gpu"
36 functions="$srcdir/tests/${name}_opencl_functions.cl"
37 if test -f $functions; then
38 options="$options --opencl-include-file=$functions"
39 options="$options --opencl-compiler-options=-I."
41 ./ppcg$EXEEXT $options $i -o "$out_c" || exit
42 $CC $CFLAGS "$srcdir/ocl_utilities.c" -lOpenCL "$out_c" -o "$out" || \
43 exit
44 $out || exit
45 done
47 if [ $keep = "no" ]; then
48 rm -r "${OUTDIR}"