| 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 | TESTS=$(grep -l main micro-benchmarks/*.c)
|
|---|
| 49 | POLYFLAG="micro-benchmarks/utilities/polybench.c -I micro-benchmarks -I micro-benchmarks/utilities -DPOLYBENCH_NO_FLUSH_CACHE -DPOLYBENCH_TIME -D_POSIX_C_SOURCE=200112L"
|
|---|
| 50 |
|
|---|
| 51 | if [[ -z "$OPTION" || "$OPTION" == "--help" ]]; then
|
|---|
| 52 | echo
|
|---|
| 53 | echo "Usage: $0 [--run] [--help]"
|
|---|
| 54 | echo
|
|---|
| 55 | echo "--help : this option"
|
|---|
| 56 | echo "--small : compile and test all benchmarks using small parameters with Helgrind, ThreadSanitizer, Archer, Intel inspector."
|
|---|
| 57 | echo "--run : compile and run all benchmarks with gcc (no evaluation)"
|
|---|
| 58 | echo "--helgrind : compile and test all benchmarks with Helgrind"
|
|---|
| 59 | echo "--tsan : compile and test all benchmarks with clang ThreadSanitizer"
|
|---|
| 60 | echo "--archer : compile and test all benchmarks with Archer"
|
|---|
| 61 | echo "--inspector: compile and test all benchmarks with Intel Inspector"
|
|---|
| 62 | echo
|
|---|
| 63 | exit
|
|---|
| 64 | fi
|
|---|
| 65 |
|
|---|
| 66 | if [[ "$OPTION" == "--small" ]]; then
|
|---|
| 67 | scripts/test-harness.sh -t 3 -n 2 -d 32 -x helgrind
|
|---|
| 68 | scripts/test-harness.sh -t 3 -n 2 -d 32 -x archer
|
|---|
| 69 | scripts/test-harness.sh -t 3 -n 2 -d 32 -x tsan
|
|---|
| 70 | scripts/test-harness.sh -t 3 -n 2 -d 32 -x inspector-max-resources
|
|---|
| 71 | fi
|
|---|
| 72 |
|
|---|
| 73 | if [[ "$OPTION" == "--run" ]]; then
|
|---|
| 74 | for test in $TESTS; do
|
|---|
| 75 | echo "------------------------------------------"
|
|---|
| 76 | echo "RUNNING: $test"
|
|---|
| 77 | CFLAGS="-g -Wall -std=c99 -fopenmp -lm"
|
|---|
| 78 | if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
|
|---|
| 79 | gcc $CFLAGS "$test"
|
|---|
| 80 | ./a.out > /dev/null
|
|---|
| 81 | done
|
|---|
| 82 | rm -f ./a.out
|
|---|
| 83 | exit
|
|---|
| 84 | fi
|
|---|
| 85 |
|
|---|
| 86 | if [[ "$OPTION" == "--helgrind" ]]; then
|
|---|
| 87 | scripts/test-harness.sh -x helgrind
|
|---|
| 88 | fi
|
|---|
| 89 |
|
|---|
| 90 | if [[ "$OPTION" == "--archer" ]]; then
|
|---|
| 91 | scripts/test-harness.sh -x archer
|
|---|
| 92 | fi
|
|---|
| 93 |
|
|---|
| 94 | if [[ "$OPTION" == "--tsan" ]]; then
|
|---|
| 95 | scripts/test-harness.sh -x tsan
|
|---|
| 96 | fi
|
|---|
| 97 |
|
|---|
| 98 | if [[ "$OPTION" == "--inspector" ]]; then
|
|---|
| 99 | scripts/test-harness.sh -x inspector-max-resources
|
|---|
| 100 | fi
|
|---|