Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /tests/sqprnt/run_sh.in
ViewVC logotype

View of /tests/sqprnt/run_sh.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4725 - (download) (annotate)
Tue Oct 11 19:58:19 2016 UTC (2 years, 9 months ago) by glk
File size: 1829 byte(s)
now configuring sqprnt/run.sh
#!/bin/bash
set -o errexit
set -o nounset
shopt -s expand_aliases
JUNK=""
function junk { JUNK="$JUNK $@"; }
function cleanup { rm -rf $JUNK; }
trap cleanup err exit int term


alias diderotc=@DIDEROTC@
alias unu=@TEEM_BIN@/unu

eps=0.00002
vmin=$(echo 0 | unu 2op nrand - 3 | unu save -f text)
vmax=$(echo 10 | unu 2op nrand - 3 | unu save -f text)
voff=($(echo "0 0 0 0" | unu 2op nrand - 3 | unu save -f text))
vnum=$(echo 300 | unu 2op nrand - 30 | unu 2op max - 100 | unu convert -t int | unu save -f text)

echo "${voff[@]} ${voff[@]}" | unu reshape -s 4 2 -o base.txt; junk base.txt
echo "$vmin $vmax" | unu reshape -s 2 | unu axinsert -a 0 -s 4 | unu 2op + - base.txt |
unu resample -s = $vnum -k tent -c node -o vec4.nrrd
unu crop -i vec4.nrrd -min 0 0 -max M-1 M -o vec3.nrrd
unu crop -i vec4.nrrd -min 0 0 -max M-2 M -o vec2.nrrd
unu slice -i vec4.nrrd -a 0 -p 0 -o vec1.nrrd

rm -f sqp?

for TT in "" "--double"; do
    for II in 1 2 3 4; do  # I: expected vector size
        echo "====================== compiling $II $TT"
        diderotc --check-all $TT --exec sqp${II}.diderot
        junk sqp${II}{,.cxx,.o}
        for JJ in 1 2 3 4; do # J: given vector size
            echo "======= running on vec${JJ}.nrrd"
            cp vec${JJ}.nrrd vec.nrrd
            #echo "./sqp${II} -vmm $vmin $vmax -voff ${voff[@]:0:$II}"
            if ! ./sqp${II} -vmm $vmin $vmax -voff ${voff[@]:0:$II}; then
                continue;
            fi
            # else program ran ok
            err=$(unu minmax err.nrrd | grep max: | cut -d' ' -f 2)
	    #echo "err = $err"
            bad=$(echo $err | unu 1op abs | unu 2op gt - $eps | unu save -f text)
            if [[ $bad == 1 ]]; then
                echo "ERROR: |$err| > $eps"
            fi
        done
    done
done

#cleanup
junk err.nrrd vec{,1,2,3,4}.nrrd

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0