source: CIVL/examples/omp/dataracebench-1.2.0/check-data-races.sh@ 8abfd3a

1.23 2.0 main test-branch
Last change on this file since 8abfd3a was 86ee0b6, checked in by Ziqing Luo <ziqing@…>, 7 years ago

merged wenhao's branch for omp transformation

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5337 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100755
File size: 5.0 KB
Line 
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
47OPTION=$1
48TESTS=$(grep -l main micro-benchmarks/*.c)
49CPPTESTS=$(grep -l main micro-benchmarks/*.cpp)
50POLYFLAG="micro-benchmarks/utilities/polybench.c -I micro-benchmarks -I micro-benchmarks/utilities -DPOLYBENCH_NO_FLUSH_CACHE -DPOLYBENCH_TIME -D_POSIX_C_SOURCE=200112L"
51
52if [[ -z "$OPTION" || "$OPTION" == "--help" ]]; then
53 echo
54 echo "Usage: $0 [--run] [--help]"
55 echo
56 echo "--help : this option"
57 echo "--small : compile and test all benchmarks using small parameters with Helgrind, ThreadSanitizer, Archer, Intel inspector."
58 echo "--run : compile and run all benchmarks with gcc (no evaluation)"
59 echo "--run-intel: compile and run all benchmarks with Intel compilers (no evaluation)"
60 echo "--helgrind : compile and test all benchmarks with Helgrind"
61 echo "--tsan : compile and test all benchmarks with clang ThreadSanitizer"
62 echo "--archer : compile and test all benchmarks with Archer"
63 echo "--inspector: compile and test all benchmarks with Intel Inspector"
64 echo
65 exit
66fi
67
68if [[ "$OPTION" == "--small" ]]; then
69 scripts/test-harness.sh -t 3 -n 2 -d 32 -x helgrind
70 scripts/test-harness.sh -t 3 -n 2 -d 32 -x archer
71 scripts/test-harness.sh -t 3 -n 2 -d 32 -x tsan
72 scripts/test-harness.sh -t 3 -n 2 -d 32 -x inspector-max-resources
73fi
74
75if [[ "$OPTION" == "--run" ]]; then
76 for test in $TESTS; do
77 echo "------------------------------------------"
78 echo "RUNNING: $test"
79 CFLAGS="-g -Wall -std=c99 -fopenmp"
80 if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
81 gcc $CFLAGS "$test" -lm
82 ./a.out > /dev/null
83 done
84 rm -f ./a.out
85# test for cpp files
86 for test in $CPPTESTS; do
87 echo "------------------------------------------"
88 echo "RUNNING: $test"
89 CFLAGS="-g -Wall -fopenmp"
90 if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
91 g++ $CFLAGS "$test" -lm
92 ./a.out > /dev/null
93 done
94 rm -f ./a.out
95 exit
96fi
97
98if [[ "$OPTION" == "--run-intel" ]]; then
99 for test in $TESTS; do
100 echo "------------------------------------------"
101 echo "RUNNING: $test"
102 CFLAGS="-g -Wall -std=c99 -fopenmp"
103 if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
104 icc $CFLAGS "$test" -lm
105 ./a.out > /dev/null
106 done
107 rm -f ./a.out
108# test for cpp files
109 for test in $CPPTESTS; do
110 echo "------------------------------------------"
111 echo "RUNNING: $test"
112 CFLAGS="-g -Wall -fopenmp"
113 if grep -q 'PolyBench' "$test"; then CFLAGS+=" $POLYFLAG"; fi
114 icpc $CFLAGS "$test" -lm
115 ./a.out > /dev/null
116 done
117 rm -f ./a.out
118 exit
119fi
120
121
122if [[ "$OPTION" == "--helgrind" ]]; then
123 scripts/test-harness.sh -x helgrind
124fi
125
126if [[ "$OPTION" == "--archer" ]]; then
127 scripts/test-harness.sh -x archer
128fi
129
130if [[ "$OPTION" == "--tsan" ]]; then
131 scripts/test-harness.sh -x tsan
132fi
133
134if [[ "$OPTION" == "--inspector" ]]; then
135 scripts/test-harness.sh -x inspector-max-resources
136fi
Note: See TracBrowser for help on using the repository browser.