Created
September 26, 2014 19:07
-
-
Save jhamman/0b1baece46ad2cd23526 to your computer and use it in GitHub Desktop.
check_for_vic_nans.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Test VIC output for nans | |
branch="upstream/develop" | |
testdir="...path with global file..." | |
vic_repo="...path to /src/ directory in VIC repo..." | |
cd $vic_repo | |
# set number of commits to loop through | |
ncommits=75 | |
# set compilers here | |
for compiler in mp-gcc48; # mp-gcc44 mp-gcc45 mp-gcc46 mp-gcc47 mp-gcc48 mp-gcc49 none; | |
do | |
# set compiler | |
# sudo port select gcc $compiler | |
# show compiler info | |
gcc --version | head -n 1 | |
# nan log | |
nan_log="nan_log_$compiler.txt" | |
touch $nan_log | |
# for commit in $(git rev-list --max-count=$ncommits --reverse --no-merges $branch); | |
for commit in $(git rev-list --max-count=$ncommits --no-merges $branch); | |
do | |
# make executable | |
exe="vic_${compiler}_${commit}" | |
echo $(git show --pretty=oneline --format="%H %ai %s" --quiet $commit) | |
git checkout -f $commit &> ${testdir}log.txt | |
make clean &>> ${testdir}log.txt | |
make &>> ${testdir}log.txt | |
mv vicNl $exe | |
# run vic | |
./$exe -g ${testdir}global.param &>> ${testdir}log.txt | |
for file in fluxes_68.750_161.250; | |
do | |
if grep "nan" ${testdir}${file} -q; then | |
git show --pretty=oneline --format="%H %ai %s" --quiet $commit >> $nan_log | |
cp ${testdir}${file} ${WORKDIR}/${file}_${commit}_${compiler}.txt | |
echo "nan found!" | |
fi | |
rm ${testdir}${file} | |
done | |
done | |
nnans=$(wc -l $nan_log) | |
echo "$nnans runs included nans" | |
echo "look in $nan_log for more info" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment