add citation information
[LbmBenchmarkKernelsPublic.git] / src / test-verification.sh
CommitLineData
10988083
MW
1#!/bin/bash -l
2# --------------------------------------------------------------------------
3#
4# Copyright
5# Markus Wittmann, 2016-2017
6# RRZE, University of Erlangen-Nuremberg, Germany
7# markus.wittmann -at- fau.de or hpc -at- rrze.fau.de
8#
9# Viktor Haag, 2016
10# LSS, University of Erlangen-Nuremberg, Germany
11#
12# This file is part of the Lattice Boltzmann Benchmark Kernels (LbmBenchKernels).
13#
14# LbmBenchKernels is free software: you can redistribute it and/or modify
15# it under the terms of the GNU General Public License as published by
16# the Free Software Foundation, either version 3 of the License, or
17# (at your option) any later version.
18#
19# LbmBenchKernels is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22# GNU General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
25# along with LbmBenchKernels. If not, see <http://www.gnu.org/licenses/>.
26#
27# --------------------------------------------------------------------------
28set -u
29
30Tmp="delme.test.sh.$(hostname).$$.tmp"
31Binary="../bin/lbmbenchk-linux-intel-release"
32NThreads="5"
33
34TestsTotal="0"
35TestsFailed="0"
36TestsSucceeded="0"
37
38if [ "$#" -ge "1" ]; then
39 Binary="$1"
40fi
41
42
43function on_exit
44{
45 if [ -e "$Tmp" ]; then
46 rm -f "$Tmp" 2>&1 || true
47 fi
48}
49
50trap "on_exit" EXIT
51
52function run_kernel
53{
54 local Binary="$1"
55 local K="$2" # Kernel name
56 local T="$3" # Number of threads
57 local KernelArgs="${4:-""}"
8cafd9ea 58 local BinaryArgs="${5:-""}"
10988083
MW
59
60 ((++TestsTotal))
61
8cafd9ea 62 echo -n "$Binary -verify -kernel $K -t $T -pin $(seq -s , 0 $((T-1))) $BinaryArgs ${KernelArgs:+"-- "}$KernelArgs "
10988083
MW
63
64 if [ "$KernelArgs" == "" ]; then
8cafd9ea 65 $Binary -verify -kernel $K -t $T -pin $(seq -s , 0 $((T-1))) $BinaryArgs > "$Tmp" 2>&1
10988083 66 else
8cafd9ea 67 $Binary -verify -kernel $K -t $T -pin $(seq -s , 0 $((T-1))) $BinaryArgs -- $KernelArgs > "$Tmp" 2>&1
10988083
MW
68 fi
69
70 local ExitCode="$?"
71
72 if [ "$ExitCode" != "0" ]; then
73 echo ""
74 cat "$Tmp"
75 echo "$Binary -verify -kernel $K"
76 echo "Verification failed. Exit code = $ExitCode."
77 ((++TestsFailed))
78 else
79 echo "OK"
80 ((++TestsSucceeded))
81 fi
82
83}
84
85for K in $("$Binary" -list | tail -n +7); do
86
87 for T in $(seq 1 $NThreads); do
88
89 run_kernel "$Binary" "$K" "$T"
8cafd9ea 90 # run_kernel "$Binary" "$K" "$T" "" "-dims 17x17x17"
10988083
MW
91
92 # Check in the usage string, if the kernel accepts parameters for blocking.
93
94 $Binary -kernel $K -- -h > "$Tmp" 2>&1
95
96 LineParameterStart="$(grep -n "^Kernel parameters:" "$Tmp" | sed -e 's/:.*//')"
97
98 if [ "$LineParameterStart" == "" ]; then
99 continue
100 fi
101
102 tail -n +$LineParameterStart "$Tmp" | grep -q -- "-blk"
103 ExitCode="$?"
104
105 if [ "$ExitCode" == "0" ]; then
106 # Kernel supports blocking
107 run_kernel "$Binary" "$K" "$T" "-blk 7"
108 fi
109
110 done
111
112done
113
114
115echo "# Tests toal: $TestsTotal succeeded: $TestsSucceeded failed: $TestsFailed"
This page took 0.11746 seconds and 5 git commands to generate.