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 5131 - (download) (annotate)
Thu Jul 20 12:55:38 2017 UTC (23 months, 3 weeks ago) by glk
File size: 3260 byte(s)
control generation of snapshots with SNAP; uses diderotc -o to control output name
#!/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="-l 10 -eps 0.06 -pcp 1 -well 0.1 -ISZ $ISZ -MM $MM -poshInit $POSHINIT"

DOPLL=true  # whether to run parallel

SNAP=true
if $SNAP; then
    SNAPSHOT="--snapshot"
    DASHS="-s 1"
else
    SNAPSHOT=""
    DASHS=""
fi

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

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

if $SNAP; then
    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
fi

# for all the saved sequential snapshots, make images to compare
# sequential snapshots to parallel snapshots
if $DOPLL && $SNAP; 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 *.{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