From: Kevin M. Rosenberg Date: Thu, 22 Mar 2018 00:42:26 +0000 (-0600) Subject: Test script outputs in CSV X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=commitdiff_plain;h=b6a9ea0d7004823a8bfd262674cd620c143e4be5 Test script outputs in CSV --- diff --git a/scripts/make-single-openmp.sh b/scripts/make-single-openmp.sh deleted file mode 100755 index 5e9ead1..0000000 --- a/scripts/make-single-openmp.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -DIR=/tmp -rm -rf $DIR/sng $DIR/omp -mkdir $DIR/sng $DIR/omp - -(cd ..; (make clean > /dev/null); (./configure --disable-openmp > /dev/null); grep HAVE_OPEN config.h; (make -j 20 > /dev/null); cp tools/ctsimtext src/ctsim $DIR/sng/.) -(cd ..; (make clean > /dev/null); (./configure --enable-openmp > /dev/null); grep HAVE_OPEN config.h; (make -j 20 > /dev/null); cp tools/ctsimtext src/ctsim $DIR/omp/.) diff --git a/scripts/test-single-openmp.sh b/scripts/test-single-openmp.sh deleted file mode 100755 index c6d88da..0000000 --- a/scripts/test-single-openmp.sh +++ /dev/null @@ -1,51 +0,0 @@ -#/bin/sh - -TEST=short -if test $# -ge 1; then - TEST=$1 -fi - -if test "x$TEST" = "xshort"; then - PR=165; PV=144; IX=115; IY=$IX -elif test "x$TEST" = "xmedium"; then - PR=901; PV=600; IX=500; IY=$IX -elif test "x$TEST" = "xlong"; then - PR=1651; PV=1440; IX=1151; IY=$IX -else - echo "usage: $0 [test-size]" - echo "test-size -- either short, medium, or long" - exit -fi -TIME= - -DIR=/tmp -BIN1=$DIR/omp/ctsimtext -BIN2=$DIR/sng/ctsimtext - -for PHAN in herman; do - for GEOM in equilinear equiangular parallel; do - echo "$PHAN $GEOM" - echo "-------------------" - fbase=${DIR}/${PHAN}-${GEOM} - rm -f ${fbase}-* - - echo -n "$BIN1 Proj: "; $TIME $BIN1 phm2pj $fbase-omp.pj $PR $PV --phantom $PHAN --verbose | tail -1 | sed 's/Run time: (.+) /$1/' - echo -n "$BIN2 Proj: "; $TIME $BIN2 phm2pj $fbase-sng.pj $PR $PV --phantom $PHAN --verbose | tail -1 | sed 's/Run time: (.+) /$1/' - echo - - for BP in idiff diff table trig; do - for INT in nearest linear cubic; do - recbase=${fbase}-${BP}-${INT} - echo -n "$BIN1 Recon $BP $INT: "; $TIME $BIN1 pjrec $fbase-omp.pj $recbase-omp.if $IX $IY --verbose --interp $INT --backproj $BP | tail -1 - echo -n "$BIN2 Recon $BP $INT: "; $TIME $BIN2 pjrec $fbase-sng.pj $recbase-sng.if $IX $IY --verbose --interp $INT --backproj $BP| tail -1 - echo -n "--> Difference Recon $BP $INT: "; $BIN1 if2 $recbase-omp.if $recbase-sng.if --comp - echo - done - done - done - phmbase=${fbase}-phm - echo -n "$BIN1 Phm: "; $TIME $BIN1 phm2if ${phmbase}-omp.if $IX $IX --phantom $PHAN --nsample 5 --verbose | tail -1 - echo -n "$BIN2 Phm: "; $TIME $BIN2 phm2if ${phmbase}-sng.if $IX $IX --phantom $PHAN --nsample 5 --verbose | tail -1 - echo -n "--> Image diff Phantom: "; $BIN1 if2 ${phmbase}-omp.if ${phmbase}-sng.if --comp - echo -done diff --git a/tests/make-single-openmp.sh b/tests/make-single-openmp.sh new file mode 100755 index 0000000..5e9ead1 --- /dev/null +++ b/tests/make-single-openmp.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +DIR=/tmp +rm -rf $DIR/sng $DIR/omp +mkdir $DIR/sng $DIR/omp + +(cd ..; (make clean > /dev/null); (./configure --disable-openmp > /dev/null); grep HAVE_OPEN config.h; (make -j 20 > /dev/null); cp tools/ctsimtext src/ctsim $DIR/sng/.) +(cd ..; (make clean > /dev/null); (./configure --enable-openmp > /dev/null); grep HAVE_OPEN config.h; (make -j 20 > /dev/null); cp tools/ctsimtext src/ctsim $DIR/omp/.) 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