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

SCM Repository

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

Annotation of /tests/sqprnt/run_sh.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4725 - (view) (download)

1 : glk 4725 #!/bin/bash
2 :     set -o errexit
3 :     set -o nounset
4 :     shopt -s expand_aliases
5 :     JUNK=""
6 :     function junk { JUNK="$JUNK $@"; }
7 :     function cleanup { rm -rf $JUNK; }
8 :     trap cleanup err exit int term
9 :    
10 :    
11 :     alias diderotc=@DIDEROTC@
12 :     alias unu=@TEEM_BIN@/unu
13 :    
14 :     eps=0.00002
15 :     vmin=$(echo 0 | unu 2op nrand - 3 | unu save -f text)
16 :     vmax=$(echo 10 | unu 2op nrand - 3 | unu save -f text)
17 :     voff=($(echo "0 0 0 0" | unu 2op nrand - 3 | unu save -f text))
18 :     vnum=$(echo 300 | unu 2op nrand - 30 | unu 2op max - 100 | unu convert -t int | unu save -f text)
19 :    
20 :     echo "${voff[@]} ${voff[@]}" | unu reshape -s 4 2 -o base.txt; junk base.txt
21 :     echo "$vmin $vmax" | unu reshape -s 2 | unu axinsert -a 0 -s 4 | unu 2op + - base.txt |
22 :     unu resample -s = $vnum -k tent -c node -o vec4.nrrd
23 :     unu crop -i vec4.nrrd -min 0 0 -max M-1 M -o vec3.nrrd
24 :     unu crop -i vec4.nrrd -min 0 0 -max M-2 M -o vec2.nrrd
25 :     unu slice -i vec4.nrrd -a 0 -p 0 -o vec1.nrrd
26 :    
27 :     rm -f sqp?
28 :    
29 :     for TT in "" "--double"; do
30 :     for II in 1 2 3 4; do # I: expected vector size
31 :     echo "====================== compiling $II $TT"
32 :     diderotc --check-all $TT --exec sqp${II}.diderot
33 :     junk sqp${II}{,.cxx,.o}
34 :     for JJ in 1 2 3 4; do # J: given vector size
35 :     echo "======= running on vec${JJ}.nrrd"
36 :     cp vec${JJ}.nrrd vec.nrrd
37 :     #echo "./sqp${II} -vmm $vmin $vmax -voff ${voff[@]:0:$II}"
38 :     if ! ./sqp${II} -vmm $vmin $vmax -voff ${voff[@]:0:$II}; then
39 :     continue;
40 :     fi
41 :     # else program ran ok
42 :     err=$(unu minmax err.nrrd | grep max: | cut -d' ' -f 2)
43 :     #echo "err = $err"
44 :     bad=$(echo $err | unu 1op abs | unu 2op gt - $eps | unu save -f text)
45 :     if [[ $bad == 1 ]]; then
46 :     echo "ERROR: |$err| > $eps"
47 :     fi
48 :     done
49 :     done
50 :     done
51 :    
52 :     #cleanup
53 :     junk err.nrrd vec{,1,2,3,4}.nrrd

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