X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=tests%2Ftest-single-openmp.sh;fp=tests%2Ftest-single-openmp.sh;h=9eea4dae70e87ab859db7715d64941afc3afc25c;hp=0000000000000000000000000000000000000000;hb=b6a9ea0d7004823a8bfd262674cd620c143e4be5;hpb=5272d4783579f571bf5a8cc866ade3e25e18c16d diff --git a/tests/test-single-openmp.sh b/tests/test-single-openmp.sh new file mode 100755 index 0000000..9eea4da --- /dev/null +++ b/tests/test-single-openmp.sh @@ -0,0 +1,58 @@ +#/bin/bash + +TEST=short +if test $# -ge 1; then + TEST=$1 +fi + +if test "x$TEST" = "xshort"; then + PR=165; PV=144; IX=115; IY=$IX + NSAMPLE=2 +elif test "x$TEST" = "xmedium"; then + PR=901; PV=600; IX=500; IY=$IX + NSAMPLE=4 +elif test "x$TEST" = "xlong"; then + PR=1651; PV=1440; IX=1151; IY=$IX + NSAMPLE=5 +else + echo "usage: $0 [test-size]" + echo "test-size -- either short, medium, or long" + exit +fi +TIME= + +DIR=/tmp +BIN_SNG=$DIR/sng/ctsimtext +BIN_OMP=$DIR/omp/ctsimtext + +RUNTIME_REGEX="sed -r 's/^[^0-9]* ([0-9\.]+)[ a-z]*/\1/'" +for PHAN in herman; do + fbase=${DIR}/${PHAN} + phmbase=$fbase + rm -rf ${phmbase}-* + + ts=`sh -c "$BIN_SNG phm2if ${phmbase}-sng.if $IX $IY --phantom $PHAN --nsample $NSAMPLE --verbose | tail -1 | $RUNTIME_REGEX"` + tm=`sh -c "$BIN_OMP phm2if ${phmbase}-omp.if $IX $IY --phantom $PHAN --nsample $NSAMPLE --verbose | tail -1 | $RUNTIME_REGEX"` + ratio=`bc <<< "scale=2; $ts / $tm"` + diff=`$BIN_SNG if2 ${phmbase}-omp.if ${phmbase}-sng.if --comp` + echo "Phantom,$PHAN,$tm,$ts,$ratio,\"$diff\"" + + for GEOM in equilinear equiangular parallel; do + ifbase=${phmbase}-${GEOM} + ts=`sh -c "$BIN_SNG phm2pj ${ifbase}-sng.pj $PR $PV --phantom $PHAN --verbose | tail -1 | $RUNTIME_REGEX"` + tm=`sh -c "$BIN_OMP phm2pj ${ifbase}-omp.pj $PR $PV --phantom $PHAN --verbose | tail -1 | $RUNTIME_REGEX"` + ratio=`bc <<< "scale=2; $ts / $tm"` + echo "Projection,$PHAN,$GEOM,$tm,$ts,$ratio" + + for BP in idiff diff table trig; do + for INT in nearest linear cubic; do + recbase=${ifbase}-${BP}-${INT} + ts=`sh -c "$BIN_SNG pjrec ${ifbase}-sng.pj $recbase-sng.if $IX $IY --verbose --interp $INT --backproj $BP | tail -1 | $RUNTIME_REGEX"` + tm=`sh -c "$BIN_OMP pjrec ${ifbase}-omp.pj $recbase-omp.if $IX $IY --verbose --interp $INT --backproj $BP | tail -1 | $RUNTIME_REGEX"` + ratio=`bc <<< "scale=2; $ts / $tm"` + diff=`$BIN_SNG if2 $recbase-omp.if $recbase-sng.if --comp` + echo "Reconstruction,$PHAN,$GEOM,$BP,$INT,$tm,$ts,$ratio,\"$diff\"" + done + done + done +done