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

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

update the Fortran regression test and makefile_fast

  • 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')
16csvfile='runtimes_'${HOST}'.csv'
17exitonfail=true
18rm -f log.run_ref failed
19
20# loop over all reference runs
21rm -f log.run_ref
22rm -f Work/*
23
24if [ "$1" = omithigh ]; then # for fast testing, not for production
25                             # requires > 16 GB
26  inputs=`ls Inputs |  grep -v high`
27else
28  inputs=`ls Inputs`
29fi
30for ref in $inputs; do
31
32  echo 'Working on test case =' $ref
33
34  # loop over debug and fast runs
35  for exe in 'debug' 'fast'; do
36
37    cd Work
38    echo '  Run code version "'${exe}'"'
39
40    thisexe=calc_etadot_${exe}.out
41    ln ../Inputs/${ref}/fort.* .
42    ( time ${path}${thisexe} ) >& log
43   
44    # check whether runs completeted properly
45    outdir='Outputs/Output_ref_'${ref}'_'${exe}
46    grep -q CONGRATULATIONS log
47    if [ $? = "0" ]; then
48      echo '    CONGRATULATIONS found' >> ../log.run_ref
49      mv log ../${outdir}
50    else
51      echo '    missing CONGRATULATIONS. Test failed.'
52      echo $ref $exe 'FAILED' >> ${testhome}/failed
53      if [ "${exitonfail}" = true ]; then exit; fi
54    fi
55    for outfile in 'fort.15' ; do
56      if [ -e $outfile ]; then
57        mv ${outfile} ../${outdir}
58      else
59        echo '    missing '${outfile}' Test failed.'
60        echo $ref $exe 'FAILED' >> ${testhome}/failed
61      if [ "${exitonfail}" = true ]; then exit; fi
62      fi
63    done
64
65    cd ..
66    rm Work/* # this is for being more safe
67   
68  done # end of exe loop
69 
70  # compare debug and fast
71  # omega case also produces fort.25 - need to add this
72  for outfile in 'fort.15' ; do
73    outdebug='Outputs/Output_ref_'${ref}'_debug/'$outfile
74    outfast='Outputs/Output_ref_'${ref}'_fast/'$outfile
75    test=$()
76    if cmp -s $outdebug $outfast >/dev/null; then
77      echo $outfile '    equal for debug and fast' >> log.run_ref
78    else
79      echo 'WARNING:' $outfile '    not equal for debug and fast, test failed'
80      echo $ref $exe 'FAILED' >> ${testhome}/failed
81       if [ "${exitonfail}" = true ]; then exit; fi
82    fi
83  done
84
85  # save and show runtimes
86  for exe in 'debug' 'fast'; do
87    log='Outputs/Output_ref_'${ref}'_'${exe}'/log'
88    times=$(tail -3 ${log})
89    real=$(echo $times | grep real | awk '{print $2}')
90    user=$(echo $times | grep user | awk '{print $4}')
91    sys=$( echo $times | grep sys  | awk '{print $6}')
92    echo $hash, "'"reference"'", "'"${ref}'_'${exe}"'", ${real}, ${user}, ${sys} >> ${csvfile}
93    tail -1 runtimes.csv >> log.run_ref
94  done
95 
96  echo # go to next reference run
97 
98done
99echo
100echo More information in log.run_ref
101
102# the following code is executed only if exitonfail is not set to 'true'.
103if [ -e failed ]; then 
104  echo
105  echo Some tests failed, see file "failed":
106  echo
107  cat failed|sort -u
108fi
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG