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

SCM Repository

[diderot] View of /tests/vis15-bugs/badptclB/run_sh.in
ViewVC logotype

View of /tests/vis15-bugs/badptclB/run_sh.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5129 - (download) (annotate)
Wed Jul 19 22:49:32 2017 UTC (2 years, 3 months ago) by glk
File size: 2955 byte(s)
ppm not pgm
#!/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

PROG=badptcl

unu pad -i init.txt -min 0 0 -max M+1 M -b pad -v 0.03 -o inith.nrrd
POSHINIT=inith.nrrd

ISZ=850
MM=1.05
PARM="-s 1 -l 10 -eps 0.06 -pcp 1 -well 0.1 -ISZ $ISZ -MM $MM -poshInit $POSHINIT"

DOPLL=true  # whether to run parallel

if $DOPLL; then
    echo "==================== compiling pthread"
    diderotc --target=pthread --snapshot --exec $PROG.diderot # --no-space-partition
    mv $PROG p$PROG
    echo "==================== running pthread"
    rm -rf ppos; mkdir ppos
    ./p$PROG -n 1 $PARM 2>&1 | tee plog-SAVE.txt ||:
    grep -v SAVE plog-SAVE.txt | grep -v STRT > plog.txt
    mv pos*nrrd ppos
fi

echo "==================== compiling seq"
diderotc --target=c --snapshot --exec $PROG.diderot
mv $PROG s$PROG
echo "==================== running seq"
rm -rf spos; mkdir spos
./s$PROG $PARM 2>&1 | tee slog-SAVE.txt
grep -v SAVE slog-SAVE.txt | grep -v STRT > slog.txt
mv pos*nrrd spos

export NRRD_STATE_VERBOSE_IO=0
if $DOPLL; then
  DIRS="ppos spos"
else
  DIRS=spos
fi
# make images of the saved positions via jhisto
for DIR in $DIRS; do
    echo "=== DIR $DIR:"; ls $DIR
    for DPIIN in $DIR/pos-????.nrrd; do # $DIR/pos-????.nrrd
        PIIN=$(basename $DPIIN)
        IIN=${PIIN#*-}
        II=${IIN%.*}
        echo "=== DIR $DIR === $DPIIN $PIIN $IIN $II"
        #unu minmax $DPIIN
        unu jhisto -i $DPIIN -min -$MM -$MM -max $MM $MM -b $ISZ $ISZ -t float |
        unu quantize -b 8 -min 0 -max 1 -o $DIR/pos-$II.pgm
    done
    rm -rf $DIR-img; mkdir $DIR-img
    mv $DIR/*pgm $DIR-img
done

# for all the saved sequential snapshots, make images to compare
# sequential snapshots to parallel snapshots
if $DOPLL; then
    rm -rf comp-img; mkdir comp-img
    for DPIIP in spos-img/pos-????.pgm; do
        PIIP=$(basename $DPIIP)
        echo "comparing {spos,ppos}-img/$PIIP"
        unu join -i {ppos,spos,ppos}-img/$PIIP -a 0 -incr -o comp-img/pos-$II.ppm
        IIP=${PIIP#*-}
        II=${IIP%.*}
        I=$((10#$II))
        if (("$I" == 0)); then
            continue;
        fi
        J=$(($I-1))
        for DD in s p; do
            # make images to compare snapshot contents with results of print() statements in program
            echo "comparing ${DD}pos-img/$PIIP with log-SAVE"
            grep "SAVE iter=$J" ${DD}log-SAVE.txt | cut -d' ' -f 4,5 |
            unu jhisto -min -$MM -$MM -max $MM $MM -b $ISZ $ISZ -t float |
            unu quantize -b 8 -min 0 -max 1 |
            unu join -i ${DD}pos-img/$PIIP - ${DD}pos-img/$PIIP -a 0 -incr -o ${DD}pos-img/comp-pos-$II.ppm
            # magenta==snapshot; green==SAVE
        done
    done
fi


# cleanup:
# rm -f inith.nrrd {p,s}log{,-SAVE}.txt badptcl.{o,cxx} {p,s}badptcl
# rm -rf {p,s}pos{,-img} comp-img

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