Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
[ocl] add OpenCL test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhc committed Sep 30, 2017
1 parent a64ec0c commit 085174b
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 6 deletions.
26 changes: 26 additions & 0 deletions scripts/parse_result.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

bm="backprop bfs cfd gaussian hotspot hotspot3D hybridsort lud \
nn nw pathfinder srad streamcluster"
col="Init MemAlloc HtoD Exec DtoH Close Total"

OUTDIR=$DIR/results-gpu
TMPFILE=$DIR/.tmp.tmp

cd $OUTDIR

echo -n "GPU,"; echo $col | tr ' ' ','
for b in $bm; do
echo -n $b
result=""
echo -n > $TMPFILE
for c in $col; do
grep $c $OUTDIR/$b.txt | \
awk '{ total += $2; count++ } END { print total/count }' \
>> $TMPFILE
done
echo -n ","; cat $TMPFILE | paste -sd "," -
rm $TMPFILE
done
28 changes: 28 additions & 0 deletions scripts/run_cpu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
OCLDIR=$DIR/gpu-rodinia/opencl

bm="backprop bfs cfd gaussian hotspot hotspot3D hybridsort lud \
nn nw pathfinder srad streamcluster"

OUTDIR=$DIR/results-cpu
mkdir $OUTDIR &>/dev/null

cd $OCLDIR
exe() { echo "++ $@" |& tee -a $OUTDIR/$b.txt ; \
$@ |& tee -a $OUTDIR/$b.txt ; }

for b in $bm; do
echo -n > $OUTDIR/$b.txt # clean output file
echo "$(date) # running $b"
cd $b
make clean ; make TYPE=CPU
for idx in `seq 1 15`; do
exe ./run -p 0 -d 0
exe echo
done
cd $OCLDIR
exe echo
echo
done
14 changes: 8 additions & 6 deletions run.sh → scripts/run_gpu.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
OCLDIR=$DIR/opencl
OCLDIR=$DIR/gpu-rodinia/opencl

# 10 in total
# and does not work
Expand All @@ -10,7 +10,10 @@ bm="backprop b+tree dwt2d heartwall hotspot3D kmeans hybridsort \
nw pathfinder streamcluster bfs cfd gaussian hotspot \
lavaMD lud nn particlefilter srad"

OUTDIR=$DIR/results
bm="backprop bfs cfd gaussian hotspot hotspot3D hybridsort lud \
nn nw pathfinder srad streamcluster"

OUTDIR=$DIR/results-gpu
mkdir $OUTDIR &>/dev/null

cd $OCLDIR
Expand All @@ -21,10 +24,9 @@ for b in $bm; do
echo -n > $OUTDIR/$b.txt # clean output file
echo "$(date) # running $b"
cd $b
for idx in `seq 1 10`; do
#exe sudo -E perf stat -A -a -e instructions,cache-misses,cache-references,cycles \
# ./run
exe /usr/bin/time ./run
make clean && make TYPE=GPU
for idx in `seq 1 15`; do
exe ./run -p 1 -d 0
exe echo
done
cd $OCLDIR
Expand Down
28 changes: 28 additions & 0 deletions scripts/run_wrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
OCLDIR=$DIR/opencl-wrap/tests

bm="backprop bfs cfd gaussian hotspot hotspot3D hybridsort lud \
nn nw pathfinder srad streamcluster"

OUTDIR=$DIR/results-wrap
mkdir $OUTDIR &>/dev/null

cd $OCLDIR
exe() { echo "++ $@" |& tee -a $OUTDIR/$b.txt ; \
$@ |& tee -a $OUTDIR/$b.txt ; }

for b in $bm; do
echo -n > $OUTDIR/$b.txt # clean output file
echo "$(date) # running $b"
cd $b
make clean && make TYPE=GPU
for idx in `seq 1 10`; do
exe ./run -p 1 -d 0
exe echo
done
cd $OCLDIR
exe echo
echo
done

0 comments on commit 085174b

Please sign in to comment.