| [e3f356c] | 1 | #!/usr/bin/env bash
|
|---|
| 2 |
|
|---|
| 3 | # Copyright (c) 2017, Lawrence Livermore National Security, LLC.
|
|---|
| 4 | # Produced at the Lawrence Livermore National Laboratory
|
|---|
| 5 | # Written by Chunhua Liao, Pei-Hung Lin, Joshua Asplund,
|
|---|
| 6 | # Markus Schordan, and Ian Karlin
|
|---|
| 7 | # (email: liao6@llnl.gov, lin32@llnl.gov, asplund1@llnl.gov,
|
|---|
| 8 | # schordan1@llnl.gov, karlin1@llnl.gov)
|
|---|
| 9 | # LLNL-CODE-732144
|
|---|
| 10 | # All rights reserved.
|
|---|
| 11 | #
|
|---|
| 12 | # This file is part of DataRaceBench. For details, see
|
|---|
| 13 | # https://github.com/LLNL/dataracebench. Please also see the LICENSE file
|
|---|
| 14 | # for our additional BSD notice
|
|---|
| 15 | #
|
|---|
| 16 | # Redistribution of Backstroke and use in source and binary forms, with
|
|---|
| 17 | # or without modification, are permitted provided that the following
|
|---|
| 18 | # conditions are met:
|
|---|
| 19 | #
|
|---|
| 20 | # * Redistributions of source code must retain the above copyright
|
|---|
| 21 | # notice, this list of conditions and the disclaimer below.
|
|---|
| 22 | #
|
|---|
| 23 | # * Redistributions in binary form must reproduce the above copyright
|
|---|
| 24 | # notice, this list of conditions and the disclaimer (as noted below)
|
|---|
| 25 | # in the documentation and/or other materials provided with the
|
|---|
| 26 | # distribution.
|
|---|
| 27 | #
|
|---|
| 28 | # * Neither the name of the LLNS/LLNL nor the names of its contributors
|
|---|
| 29 | # may be used to endorse or promote products derived from this
|
|---|
| 30 | # software without specific prior written permission.
|
|---|
| 31 | #
|
|---|
| 32 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|---|
| 33 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|---|
| 34 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|---|
| 35 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|---|
| 36 | # DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL
|
|---|
| 37 | # SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE
|
|---|
| 38 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|---|
| 39 | # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|---|
| 40 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 41 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|---|
| 42 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|---|
| 43 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|---|
| 44 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|---|
| 45 | # THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 46 |
|
|---|
| 47 | OPTION=$1
|
|---|
| 48 | DEF_LAN=$2
|
|---|
| 49 | TESTS=$(grep -l main micro-benchmarks/*.c)
|
|---|
| 50 | CPPTESTS=$(grep -l main micro-benchmarks/*.cpp)
|
|---|
| 51 | FORTRANTESTS=$(find micro-benchmarks-fortran -iregex ".*\.F[0-9]*" -o -iregex ".*\.for")
|
|---|
| 52 | POLYFLAG="micro-benchmarks/utilities/polybench.c -I micro-benchmarks -I micro-benchmarks/utilities -DPOLYBENCH_NO_FLUSH_CACHE -DPOLYBENCH_TIME -D_POSIX_C_SOURCE=200112L"
|
|---|
| 53 | FPOLYFLAG="-Imicro-benchmarks-fortran micro-benchmarks-fortran/utilities/fpolybench.o"
|
|---|
| 54 | LANGUAGE="default"
|
|---|
| 55 |
|
|---|
| 56 | help () {
|
|---|
| 57 | echo
|
|---|
| 58 | echo "Usage: $0 [--run] [--help] language"
|
|---|
| 59 | echo
|
|---|
| 60 | echo "--help : this option"
|
|---|
| 61 | echo "--small : compile and test all benchmarks using small parameters with Helgrind, ThreadSanitizer, Archer, Intel inspector."
|
|---|
| 62 | echo "--run : compile and run all benchmarks with gcc (no evaluation)"
|
|---|
| 63 | echo "--run-intel : compile and run all benchmarks with Intel compilers (no evaluation)"
|
|---|
| 64 | echo "--helgrind : compile and test all benchmarks with Helgrind"
|
|---|
| 65 | echo "--tsan-clang: compile and test all benchmarks with clang ThreadSanitizer"
|
|---|
| 66 | echo "--tsan-gcc : compile and test all benchmarks with gcc ThreadSanitizer"
|
|---|
| 67 | echo "--archer : compile and test all benchmarks with Archer"
|
|---|
| 68 | echo "--coderrect : compile and test all benchmarks with Coderrect Scanner"
|
|---|
| 69 | echo "--inspector : compile and test all benchmarks with Intel Inspector"
|
|---|
| 70 | echo "--romp : compile and test all benchmarks with Romp"
|
|---|
| 71 | echo "--customize : compile and test customized test list and tools"
|
|---|
| 72 | echo
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | valid_language_name () {
|
|---|
| 76 | case "$1" in
|
|---|
| 77 | c/c++) return 0 ;;
|
|---|
| 78 | C/C++) return 0 ;;
|
|---|
| 79 | c) return 0 ;;
|
|---|
| 80 | C) return 0 ;;
|
|---|
| 81 | c++) return 0 ;;
|
|---|
| 82 | C++) return 0 ;;
|
|---|
| 83 | fortran) return 0 ;;
|
|---|
| 84 | Fortran) return 0 ;;
|
|---|
| 85 | FORTRAN) return 0 ;;
|
|---|
| 86 | *) return 1 ;;
|
|---|
| 87 | esac
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | if [ -z "$DEF_LAN" ]; then
|
|---|
| 91 | echo "use default test"
|
|---|
| 92 | fi
|
|---|
| 93 |
|
|---|
| 94 | if valid_language_name "$DEF_LAN"; then LANGUAGE="$DEF_LAN"
|
|---|
| 95 | else
|
|---|
| 96 | echo "Invalid language name $DEF_LAN" && help && exit 1
|
|---|
| 97 | fi
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 | if [[ -z "$OPTION" || "$OPTION" == "--help" ]]; then
|
|---|
| 101 |
|
|---|
| 102 | echo
|
|---|
| 103 | echo "Usage: $0 [--run] [--help]"
|
|---|
| 104 | echo
|
|---|
| 105 | echo "--help : this option"
|
|---|
| 106 | echo "--small : compile and test all benchmarks using small parameters with Helgrind, ThreadSanitizer, Archer, Intel inspector."
|
|---|
| 107 | echo "--run : compile and run all benchmarks with gcc (no evaluation)"
|
|---|
| 108 | echo "--run-intel : compile and run all benchmarks with Intel compilers (no evaluation)"
|
|---|
| 109 | echo "--helgrind : compile and test all benchmarks with Helgrind"
|
|---|
| 110 | echo "--tsan-clang: compile and test all benchmarks with clang ThreadSanitizer"
|
|---|
| 111 | echo "--tsan-gcc : compile and test all benchmarks with gcc ThreadSanitizer"
|
|---|
| 112 | echo "--archer : compile and test all benchmarks with Archer"
|
|---|
| 113 | echo "--coderrect : compile and test all benchmarks with Coderrect Scanner"
|
|---|
| 114 | echo "--inspector : compile and test all benchmarks with Intel Inspector"
|
|---|
| 115 | echo "--romp : compile and test all benchmarks with Romp"
|
|---|
| 116 | echo "--customize : compile and test customized test list and tools"
|
|---|
| 117 | echo
|
|---|
| 118 | exit
|
|---|
| 119 | fi
|
|---|
| 120 |
|
|---|
| 121 | if [[ "$OPTION" == "--small" ]]; then
|
|---|
| 122 | scripts/test-harness.sh -t 3 -n 2 -d 32 -l $LANGUAGE -x helgrind
|
|---|
| 123 | scripts/test-harness.sh -t 3 -n 2 -d 32 -l $LANGUAGE -x archer
|
|---|
| 124 | scripts/test-harness.sh -t 3 -n 1 -d 32 -l $LANGUAGE -x coderrect
|
|---|
| 125 | scripts/test-harness.sh -t 3 -n 2 -d 32 -l $LANGUAGE -x tsan-clang
|
|---|
| 126 | scripts/test-harness.sh -t 3 -n 2 -d 32 -l $LANGUAGE -x inspector-max-resources
|
|---|
| 127 | scripts/test-harness.sh -t 3 -n 2 -d 32 -l $LANGUAGE -x romp
|
|---|
| 128 | fi
|
|---|
| 129 |
|
|---|
| 130 | if [[ "$OPTION" == "--run" ]]; then
|
|---|
| 131 | if [[ "$LANGUAGE" == "c" || "$LANGUAGE" == "C" ]]; then
|
|---|
| 132 | for test in $TESTS; do
|
|---|
| 133 | echo "------------------------------------------"
|
|---|
| 134 | echo "RUNNING: $test"
|
|---|
| 135 | CFLAGS="-g -Wall -std=c99 -fopenmp"
|
|---|
| 136 | if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
|
|---|
| 137 | gcc $CFLAGS "$test" -lm
|
|---|
| 138 | ./a.out > /dev/null
|
|---|
| 139 | done
|
|---|
| 140 | rm -f ./a.out
|
|---|
| 141 | # test for cpp files
|
|---|
| 142 | elif [[ "$LANGUAGE" == "c++" || "$LANGUAGE" == "C++" ]]; then
|
|---|
| 143 | for test in $CPPTESTS; do
|
|---|
| 144 | echo "------------------------------------------"
|
|---|
| 145 | echo "RUNNING: $test"
|
|---|
| 146 | CFLAGS="-g -Wall -fopenmp"
|
|---|
| 147 | if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
|
|---|
| 148 | g++ $CFLAGS "$test" -lm
|
|---|
| 149 | ./a.out > /dev/null
|
|---|
| 150 | done
|
|---|
| 151 | rm -f ./a.out
|
|---|
| 152 | # test for fortran files
|
|---|
| 153 | elif [[ "$LANGUAGE" == "fortran" || "$LANGUAGE" == "FORTRAN" ]]; then
|
|---|
| 154 | for test in $FORTRANTESTS; do
|
|---|
| 155 | echo "------------------------------------------"
|
|---|
| 156 | echo "RUNNING: $test"
|
|---|
| 157 | FFLAGS="-fopenmp -ffree-line-length-none"
|
|---|
| 158 | if grep -q 'PolyBench' "$test"; then FFLAGS+=" $FPOLYFLAG"; fi
|
|---|
| 159 | gfortran $FFLAGS "$test" -lm
|
|---|
| 160 | ./a.out > /dev/null
|
|---|
| 161 | done
|
|---|
| 162 | rm -f ./a.out
|
|---|
| 163 | rm drb*
|
|---|
| 164 | else
|
|---|
| 165 | for test in $TESTS; do
|
|---|
| 166 | echo "------------------------------------------"
|
|---|
| 167 | echo "RUNNING: $test"
|
|---|
| 168 | CFLAGS="-g -Wall -std=c99 -fopenmp"
|
|---|
| 169 | if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
|
|---|
| 170 | gcc $CFLAGS "$test" -lm
|
|---|
| 171 | ./a.out > /dev/null
|
|---|
| 172 | done
|
|---|
| 173 | rm -f ./a.out
|
|---|
| 174 | for test in $CPPTESTS; do
|
|---|
| 175 | echo "------------------------------------------"
|
|---|
| 176 | echo "RUNNING: $test"
|
|---|
| 177 | CFLAGS="-g -Wall -fopenmp"
|
|---|
| 178 | if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
|
|---|
| 179 | g++ $CFLAGS "$test" -lm
|
|---|
| 180 | ./a.out > /dev/null
|
|---|
| 181 | done
|
|---|
| 182 | rm -f ./a.out
|
|---|
| 183 | for test in $FORTRANTESTS; do
|
|---|
| 184 | echo "------------------------------------------"
|
|---|
| 185 | echo "RUNNING: $test"
|
|---|
| 186 | FFLAGS="-fopenmp -ffree-line-length-none"
|
|---|
| 187 | if grep -q 'PolyBench' "$test"; then FFLAGS+=" $FPOLYFLAG"; fi
|
|---|
| 188 | gfortran $FFLAGS "$test" -lm
|
|---|
| 189 | ./a.out > /dev/null
|
|---|
| 190 | done
|
|---|
| 191 | rm -f ./a.out
|
|---|
| 192 | rm drb*
|
|---|
| 193 | fi
|
|---|
| 194 | exit
|
|---|
| 195 | fi
|
|---|
| 196 |
|
|---|
| 197 | if [[ "$OPTION" == "--run-intel" ]]; then
|
|---|
| 198 | for test in $TESTS; do
|
|---|
| 199 | echo "------------------------------------------"
|
|---|
| 200 | echo "RUNNING: $test"
|
|---|
| 201 | CFLAGS="-g -Wall -std=c99 -fopenmp"
|
|---|
| 202 | if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
|
|---|
| 203 | icc $CFLAGS "$test" -lm
|
|---|
| 204 | ./a.out > /dev/null
|
|---|
| 205 | done
|
|---|
| 206 | rm -f ./a.out
|
|---|
| 207 | # test for cpp files
|
|---|
| 208 | for test in $CPPTESTS; do
|
|---|
| 209 | echo "------------------------------------------"
|
|---|
| 210 | echo "RUNNING: $test"
|
|---|
| 211 | CFLAGS="-g -Wall -fopenmp"
|
|---|
| 212 | if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
|
|---|
| 213 | icpc $CFLAGS "$test" -lm
|
|---|
| 214 | ./a.out > /dev/null
|
|---|
| 215 | done
|
|---|
| 216 | rm -f ./a.out
|
|---|
| 217 | # test for fortran files
|
|---|
| 218 | for test in $FORTRANTESTS; do
|
|---|
| 219 | echo "------------------------------------------"
|
|---|
| 220 | echo "RUNNING: $test"
|
|---|
| 221 | FFLAGS="-fopenmp"
|
|---|
| 222 | if grep -q 'PolyBench' "$test"; then FLAGS+=" $POLYFLAG"; fi
|
|---|
| 223 | ifort $FFLAGS "$test" -lm
|
|---|
| 224 | ./a.out > /dev/null
|
|---|
| 225 | done
|
|---|
| 226 | rm -f ./a.out
|
|---|
| 227 | rm drb*
|
|---|
| 228 | exit
|
|---|
| 229 | fi
|
|---|
| 230 |
|
|---|
| 231 | if [[ "$OPTION" == "--run-rose" ]]; then
|
|---|
| 232 | for test in $TESTS; do
|
|---|
| 233 | echo "------------------------------------------"
|
|---|
| 234 | echo "TESTING using rose: $test"
|
|---|
| 235 | CFLAGS="-g -Wall -std=c99 -rose:openmp:ast_only"
|
|---|
| 236 | if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
|
|---|
| 237 | $ROSE_INSTALL/bin/identityTranslator -c $CFLAGS "$test" -lm
|
|---|
| 238 | done
|
|---|
| 239 | # test for cpp files
|
|---|
| 240 | for test in $CPPTESTS; do
|
|---|
| 241 | echo "------------------------------------------"
|
|---|
| 242 | echo "TESTING using rose: $test"
|
|---|
| 243 | CFLAGS="-g -Wall -rose:openmp:ast_only"
|
|---|
| 244 | if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
|
|---|
| 245 | $ROSE_INSTALL/bin/identityTranslator -c $CFLAGS "$test" -lm
|
|---|
| 246 | done
|
|---|
| 247 | exit
|
|---|
| 248 | fi
|
|---|
| 249 |
|
|---|
| 250 |
|
|---|
| 251 |
|
|---|
| 252 | if [[ "$OPTION" == "--helgrind" ]]; then
|
|---|
| 253 | scripts/test-harness.sh -l $LANGUAGE -x helgrind
|
|---|
| 254 | fi
|
|---|
| 255 |
|
|---|
| 256 | if [[ "$OPTION" == "--archer" ]]; then
|
|---|
| 257 | scripts/test-harness.sh -t 8 -n 5 -d 32 -l $LANGUAGE -x archer
|
|---|
| 258 | fi
|
|---|
| 259 |
|
|---|
| 260 | if [[ "$OPTION" == "--coderrect" ]]; then
|
|---|
| 261 | scripts/test-harness.sh -t 8 -n 1 -d 32 -l $LANGUAGE -x coderrect
|
|---|
| 262 | fi
|
|---|
| 263 |
|
|---|
| 264 | if [[ "$OPTION" == "--tsan-clang" ]]; then
|
|---|
| 265 | scripts/test-harness.sh -t 8 -n 5 -d 32 -l $LANGUAGE -x tsan-clang
|
|---|
| 266 | fi
|
|---|
| 267 |
|
|---|
| 268 | if [[ "$OPTION" == "--tsan-gcc" ]]; then
|
|---|
| 269 | scripts/test-harness.sh -t 8 -n 5 -d 32 -l $LANGUAGE -x tsan-gcc
|
|---|
| 270 | fi
|
|---|
| 271 |
|
|---|
| 272 | if [[ "$OPTION" == "--inspector" ]]; then
|
|---|
| 273 | scripts/test-harness.sh -t 8 -n 5 -d 32 -l $LANGUAGE -x inspector-max-resources
|
|---|
| 274 | fi
|
|---|
| 275 |
|
|---|
| 276 | if [[ "$OPTION" == "--romp" ]]; then
|
|---|
| 277 | scripts/test-harness.sh -t 8 -n 5 -d 32 -l $LANGUAGE -x romp
|
|---|
| 278 | fi
|
|---|
| 279 |
|
|---|
| 280 | if [[ "$OPTION" == "--customize" ]]; then
|
|---|
| 281 | TO=($(cat tool.def))
|
|---|
| 282 | for rtool in "${TO[@]}"; do
|
|---|
| 283 | scripts/test-harness.sh -t 8 -n 5 -d 32 -l $LANGUAGE -c 1 -x $rtool;
|
|---|
| 284 | done
|
|---|
| 285 | fi
|
|---|