source: flex_extract.git/Testing/Regression/FortranEtadot/run_ref.sh @ d2d6cf9

ctbtodev
Last change on this file since d2d6cf9 was d2d6cf9, checked in by Petra Seibert <petra.seibert [at) univie.ac.at>, 4 years ago

remove jasper from makefiles, correct Fortran regression test scripts

  • Property mode set to 100755
File size: 3.0 KB
Line 
1#!/bin/bash
2
3# Do the reference runs and compare output of fast and debug
4
5# Copyright Petra Seibert, 2019
6# SPDX-License-Identifier: MIT-0
7
8export OMP_NUM_THREADS=4  # you may want to change this
9export OMP_PLACES=sockets
10testhome=`pwd`
11path1=../../../Source/Fortran/
12path=../${path1}
13exedebug=calc_etadot_debug.out
14exefast=calc_etadot_fast.out
15hash=$(git log --abbrev-commit --pretty=oneline -n 1  --pretty=format:'%h')
16exitonfail=true
17rm -f log.run_ref failed
18
19# loop over all reference runs
20rm -f log.run_ref
21rm -f Work/*
22
23if [ "$1" = omithigh ]; then # for fast testing, not for production
24                             # requires > 16 GB
25  inputs=`ls Inputs |  grep -v high`
26else
27  inputs=`ls Inputs`
28fi
29for ref in $inputs; do
30
31  echo 'Working on test case =' $ref
32
33  # loop over debug and fast runs
34  for exe in 'debug' 'fast'; do
35
36    cd Work
37    echo '  Run code version "'${exe}'"'
38
39    thisexe=calc_etadot_${exe}.out
40    ln ../Inputs/${ref}/fort.* .
41    ( time ${path}${thisexe} ) >& log
42   
43    # check whether runs completeted properly
44    outdir='Outputs/Output_ref_'${ref}'_'${exe}
45    grep -q CONGRATULATIONS log
46    if [ $? = "0" ]; then
47      echo '    CONGRATULATIONS found' >> ../log.run_ref
48      mv log ../${outdir}
49    else
50      echo '    missing CONGRATULATIONS. Test failed.'
51      echo $ref $exe 'FAILED' >> ${testhome}/failed
52      if [ "${exitonfail}" = true ]; then exit; fi
53    fi
54    for outfile in 'fort.15' 'VERTICAL.EC'; do
55      if [ -e $outfile ]; then
56        mv ${outfile} ../${outdir}
57      else
58        echo '    missing '${outfile}' Test failed.'
59        echo $ref $exe 'FAILED' >> ${testhome}/failed
60      if [ "${exitonfail}" = true ]; then exit; fi
61      fi
62    done
63
64    cd ..
65    rm Work/* # this is for being more safe
66   
67  done # end of exe loop
68 
69  # compare debug and fast
70  # omega case also produces fort.25 - need to add this
71  for outfile in 'fort.15' 'VERTICAL.EC'; do
72    outdebug='Outputs/Output_ref_'${ref}'_debug/'$outfile
73    outfast='Outputs/Output_ref_'${ref}'_fast/'$outfile
74    test=$(cmp  $outdebug $outfast)
75    if $test; then
76      echo $outfile '    equal for debug and fast' >> log.run_ref
77    else
78      echo 'WARNING:' $outfile '    not equal for debug and fast, test failed'
79      echo $ref $exe 'FAILED' >> ${testhome}/failed
80       if [ "${exitonfail}" = true ]; then exit; fi
81    fi
82  done
83
84  # save and show runtimes
85  for exe in 'debug' 'fast'; do
86    log='Outputs/Output_ref_'${ref}'_'${exe}'/log'
87    times=$(tail -3 ${log})
88    real=$(echo $times | grep real | awk '{print $2}')
89    user=$(echo $times | grep user | awk '{print $4}')
90    sys=$( echo $times | grep sys  | awk '{print $6}')
91    echo $hash, "'"reference"'", "'"${ref}'_'${exe}"'", ${real}, ${user}, ${sys} >> runtimes.csv
92    tail -1 runtimes.csv >> log.run_ref
93  done
94 
95  echo # go to next reference run
96 
97done
98echo
99echo More information in log.run_ref
100
101# the following code is executed only if exitonfail is not set to 'true'.
102if [ -e failed ]; then 
103  echo
104  echo Some tests failed, see file "failed":
105  echo
106  cat failed|sort -u
107fi
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG