version 0.1
[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:-""}"
58
59 ((++TestsTotal))
60
61 echo -n "$Binary -verify -kernel $K -t $T -pin $(seq -s , 0 $((T-1))) ${KernelArgs:+"-- "}$KernelArgs "
62
63 if [ "$KernelArgs" == "" ]; then
64 $Binary -verify -kernel $K -t $T -pin $(seq -s , 0 $((T-1))) > "$Tmp" 2>&1
65 else
66 $Binary -verify -kernel $K -t $T -pin $(seq -s , 0 $((T-1))) -- $KernelArgs > "$Tmp" 2>&1
67 fi
68
69 local ExitCode="$?"
70
71 if [ "$ExitCode" != "0" ]; then
72 echo ""
73 cat "$Tmp"
74 echo "$Binary -verify -kernel $K"
75 echo "Verification failed. Exit code = $ExitCode."
76 ((++TestsFailed))
77 else
78 echo "OK"
79 ((++TestsSucceeded))
80 fi
81
82}
83
84for K in $("$Binary" -list | tail -n +7); do
85
86 for T in $(seq 1 $NThreads); do
87
88 run_kernel "$Binary" "$K" "$T"
89
90 # Check in the usage string, if the kernel accepts parameters for blocking.
91
92 $Binary -kernel $K -- -h > "$Tmp" 2>&1
93
94 LineParameterStart="$(grep -n "^Kernel parameters:" "$Tmp" | sed -e 's/:.*//')"
95
96 if [ "$LineParameterStart" == "" ]; then
97 continue
98 fi
99
100 tail -n +$LineParameterStart "$Tmp" | grep -q -- "-blk"
101 ExitCode="$?"
102
103 if [ "$ExitCode" == "0" ]; then
104 # Kernel supports blocking
105 run_kernel "$Binary" "$K" "$T" "-blk 7"
106 fi
107
108 done
109
110done
111
112
113echo "# Tests toal: $TestsTotal succeeded: $TestsSucceeded failed: $TestsFailed"
This page took 0.065581 seconds and 5 git commands to generate.