From 4477ed075db9d72a59afd9992d4caabdadf10a27 Mon Sep 17 00:00:00 2001 From: Joachim Jenke Date: Thu, 10 Aug 2023 12:23:40 +0200 Subject: [PATCH 01/11] Actually use the CLANG env variable. Halt on error to avoid exhaustive execution time for codes with milions of races --- scripts/test-harness.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/test-harness.sh b/scripts/test-harness.sh index d420d0b..6017536 100755 --- a/scripts/test-harness.sh +++ b/scripts/test-harness.sh @@ -64,6 +64,7 @@ VALGRIND_COMPILE_C_FLAGS="-O0 -g -std=c99 -fopenmp" VALGRIND_COMPILE_CPP_FLAGS="-O0 -g -fopenmp" CLANG=${CLANG:-"clang"} +CLANGXX=${CLANGXX:-"clang++"} TSAN_COMPILE_FLAGS="-O0 -fopenmp -fsanitize=thread -g" # Path to LLOV is fixed due to it's only available in container @@ -354,12 +355,12 @@ for tool in "${TOOLS[@]}"; do echo "testing C++ code:$test" case "$tool" in gnu) g++ -g -fopenmp $additional_compile_flags $test -o $exname -lm ;; - clang) clang++ -fopenmp -g $additional_compile_flags $test -o $exname -lm ;; + clang) ${CLANGXX} -fopenmp -g $additional_compile_flags $test -o $exname -lm ;; intel) icpc $ICPC_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; helgrind) g++ $VALGRIND_COMPILE_CPP_FLAGS $additional_compile_flags $test -o $exname -lm ;; archer) clang-archer++ $ARCHER_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; coderrect) coderrect -XbcOnly clang++ -fopenmp -fopenmp-version=45 -g -O0 $additional_compile_flags $test -o $exname -lm > /dev/null 2>&1 ;; - tsan-clang) clang++ $TSAN_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; + tsan-clang) ${CLANGXX} $TSAN_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; tsan-gcc) g++ $TSAN_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; llov) $LLOV_COMPILER/bin/clang++ $LLOV_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm 2> $compilelog;; inspector) icpc $ICPC_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; @@ -370,12 +371,12 @@ for tool in "${TOOLS[@]}"; do else case "$tool" in gnu) gcc -g -std=c99 -fopenmp $additional_compile_flags $test -o $exname -lm ;; - clang) clang -fopenmp -g $additional_compile_flags $test -o $exname -lm ;; + clang) ${CLANG} -fopenmp -g $additional_compile_flags $test -o $exname -lm ;; intel) icc $ICC_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; helgrind) gcc $VALGRIND_COMPILE_C_FLAGS $additional_compile_flags $test -o $exname -lm ;; archer) clang-archer $ARCHER_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; coderrect) coderrect -XbcOnly clang -fopenmp -fopenmp-version=45 -g -O0 $additional_compile_flags $test -o $exname -lm > /dev/null 2>&1 ;; - tsan-clang) clang $TSAN_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; + tsan-clang) ${CLANG} $TSAN_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; tsan-gcc) gcc $TSAN_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; llov) $LLOV_COMPILER/bin/clang $LLOV_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm 2> $compilelog;; inspector) icc $ICC_COMPILE_FLAGS $additional_compile_flags $test -o $exname -lm ;; @@ -458,7 +459,7 @@ for tool in "${TOOLS[@]}"; do cat tmp.log >> "$LOG_DIR/$logname" || >tmp.log ;; tsan-clang) # races=$($MEMCHECK -f "%M" -o "$MEMLOG" "./$exname" $size 2>&1 | tee -a "$LOG_DIR/$logname" | grep -ce 'WARNING: ThreadSanitizer: data race') ;; - $TIMEOUTCMD $TIMEOUTMIN"m" $MEMCHECK -f "%M" -o "$MEMLOG" env TSAN_OPTIONS="exitcode=0 ignore_noninstrumented_modules=1" "./$exname" $size &> tmp.log; + $TIMEOUTCMD $TIMEOUTMIN"m" $MEMCHECK -f "%M" -o "$MEMLOG" env TSAN_OPTIONS="exitcode=0 halt_on_error=1 ignore_noninstrumented_modules=1" "./$exname" $size &> tmp.log; check_return_code $?; echo "$testname return $testreturn" races=$(grep -ce 'WARNING: ThreadSanitizer: data race' tmp.log) @@ -641,7 +642,7 @@ for tool in "${TOOLS[@]}"; do cat tmp.log >> "$LOG_DIR/$logname" || >tmp.log ;; tsan-clang) # races=$($MEMCHECK -f "%M" -o "$MEMLOG" "./$exname" $size 2>&1 | tee -a "$LOG_DIR/$logname" | grep -ce 'WARNING: ThreadSanitizer: data race') ;; - $TIMEOUTCMD $TIMEOUTMIN"m" $MEMCHECK -f "%M" -o "$MEMLOG" env TSAN_OPTIONS="exitcode=0 ignore_noninstrumented_modules=1" "./$exname" $size &> tmp.log; + $TIMEOUTCMD $TIMEOUTMIN"m" $MEMCHECK -f "%M" -o "$MEMLOG" env TSAN_OPTIONS="exitcode=0 halt_on_error=1 ignore_noninstrumented_modules=1" "./$exname" $size &> tmp.log; check_return_code $?; echo "$testname return $testreturn" races=$(grep -ce 'WARNING: ThreadSanitizer: data race' tmp.log) From 659132ac0eeac82353ec5942685a68ca2c792609 Mon Sep 17 00:00:00 2001 From: Joachim Jenke Date: Thu, 10 Aug 2023 13:40:34 +0200 Subject: [PATCH 02/11] Reduce unnecessary execution time --- micro-benchmarks/DRB065-pireduction-orig-no.c | 2 +- micro-benchmarks/DRB078-taskdep2-orig-no.c | 3 +- micro-benchmarks/DRB079-taskdep3-orig-no.c | 3 +- micro-benchmarks/DRB107-taskgroup-orig-no.c | 3 +- .../DRB190-critical-section2-no.c | 12 ++++--- .../DRB193-critical-section3-yes.c | 3 +- ...8-prodcons-no.c.c => DRB198-prodcons-no.c} | 12 ++++--- micro-benchmarks/DRB199-prodcons-yes.c | 13 ++++---- micro-benchmarks/signaling.h | 31 +++++++++++++++++++ 9 files changed, 61 insertions(+), 21 deletions(-) rename micro-benchmarks/{DRB198-prodcons-no.c.c => DRB198-prodcons-no.c} (84%) create mode 100644 micro-benchmarks/signaling.h diff --git a/micro-benchmarks/DRB065-pireduction-orig-no.c b/micro-benchmarks/DRB065-pireduction-orig-no.c index 62fc44f..0fdbcb5 100644 --- a/micro-benchmarks/DRB065-pireduction-orig-no.c +++ b/micro-benchmarks/DRB065-pireduction-orig-no.c @@ -48,7 +48,7 @@ THE POSSIBILITY OF SUCH DAMAGE. Classic PI calculation using reduction */ -#define num_steps 2000000000 +#define num_steps 200000000 #include int main(int argc, char** argv) diff --git a/micro-benchmarks/DRB078-taskdep2-orig-no.c b/micro-benchmarks/DRB078-taskdep2-orig-no.c index 9d170c4..f544202 100644 --- a/micro-benchmarks/DRB078-taskdep2-orig-no.c +++ b/micro-benchmarks/DRB078-taskdep2-orig-no.c @@ -50,6 +50,7 @@ i is shared for two tasks based on implicit data-sharing attribute rules. */ #include #include +#include "signaling.h" int main() { int i=0; @@ -58,7 +59,7 @@ int main() { #pragma omp task depend (out:i) { - sleep(3); + delay(10000); i = 1; } #pragma omp task depend (out:i) diff --git a/micro-benchmarks/DRB079-taskdep3-orig-no.c b/micro-benchmarks/DRB079-taskdep3-orig-no.c index cd07937..f079c9f 100644 --- a/micro-benchmarks/DRB079-taskdep3-orig-no.c +++ b/micro-benchmarks/DRB079-taskdep3-orig-no.c @@ -50,6 +50,7 @@ tasks with depend clauses to ensure execution order, no data races. #include #include #include +#include "signaling.h" int main() { int i=0, j, k; @@ -58,7 +59,7 @@ int main() { #pragma omp task depend (out:i) { - sleep(3); + delay(10000); i = 1; } #pragma omp task depend (in:i) diff --git a/micro-benchmarks/DRB107-taskgroup-orig-no.c b/micro-benchmarks/DRB107-taskgroup-orig-no.c index 6c62b00..0e922d4 100644 --- a/micro-benchmarks/DRB107-taskgroup-orig-no.c +++ b/micro-benchmarks/DRB107-taskgroup-orig-no.c @@ -50,6 +50,7 @@ THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include "signaling.h" int main() { @@ -62,7 +63,7 @@ int main() { #pragma omp task { - sleep(3); + delay(10000); result = 1; } } diff --git a/micro-benchmarks/DRB190-critical-section2-no.c b/micro-benchmarks/DRB190-critical-section2-no.c index 6cab3c2..bf4e669 100644 --- a/micro-benchmarks/DRB190-critical-section2-no.c +++ b/micro-benchmarks/DRB190-critical-section2-no.c @@ -16,21 +16,22 @@ #include -int cap = 10, size = 0; +int cap = 10, size = 0, packages = 1000; unsigned r = 0; int main() { -#pragma omp parallel sections shared(size, cap) firstprivate(r) num_threads(2) +#pragma omp parallel sections shared(size, cap) firstprivate(r, packages) num_threads(2) { #pragma omp section - while (1) + while (packages) { #pragma omp critical { if (size < cap) { size++; // produce + packages--; // produced a package printf("Produced! size=%d\n", size); fflush(stdout); } @@ -39,18 +40,19 @@ int main() r = (r + 1) % 10; } #pragma omp section - while (1) + while (packages) { #pragma omp critical { if (size > 0) { size--; // consume + packages--; // consumed a package printf("Consumed! size=%d\n", size); fflush(stdout); } } - for (int i = 0; i < 1000; i++) + for (int i = 0; i < 1500; i++) r = (r + 1) % 10; } } diff --git a/micro-benchmarks/DRB193-critical-section3-yes.c b/micro-benchmarks/DRB193-critical-section3-yes.c index 7a2e630..e1403cb 100644 --- a/micro-benchmarks/DRB193-critical-section3-yes.c +++ b/micro-benchmarks/DRB193-critical-section3-yes.c @@ -12,7 +12,8 @@ * Wenhao Wu and Stephen F. Siegel @Univ. of Delaware. * Race due to different critical section names - * Data race pair: x@26:7:W vs. x@43:7:W + * Data race pair: x@27:7:W vs. x@44:7:W + * Data race pair: s@30:9:W vs. s@40:15:R */ #include diff --git a/micro-benchmarks/DRB198-prodcons-no.c.c b/micro-benchmarks/DRB198-prodcons-no.c similarity index 84% rename from micro-benchmarks/DRB198-prodcons-no.c.c rename to micro-benchmarks/DRB198-prodcons-no.c index 2316f1b..4446bf5 100644 --- a/micro-benchmarks/DRB198-prodcons-no.c.c +++ b/micro-benchmarks/DRB198-prodcons-no.c @@ -16,34 +16,36 @@ #include int nprod = 4, ncons = 4; -int cap = 5, size = 0; +int cap = 5, size = 0, packages = 1000; int main() { int nthread = nprod + ncons; -#pragma omp parallel for shared(size, cap, nprod, ncons, nthread) num_threads(nthread) +#pragma omp parallel for shared(size, cap, nprod, ncons, nthread) firstprivate(packages) num_threads(nthread) for (int i = 0; i < nthread; i++) { if (i < nprod) - while (1) + while (packages) { // I am a producer #pragma omp critical if (size < cap) { size++; // produce + packages--; // produced a package printf("Producer %d produced! size=%d\n", i, size); fflush(stdout); } } else - while (1) + while (packages) { // I am a consumer #pragma omp critical if (size > 0) { size--; // consume + packages--; // consumed a package printf("Consumer %d consumed! size=%d\n", i - nprod, size); fflush(stdout); } } } -} \ No newline at end of file +} diff --git a/micro-benchmarks/DRB199-prodcons-yes.c b/micro-benchmarks/DRB199-prodcons-yes.c index 40db7c2..efc3244 100644 --- a/micro-benchmarks/DRB199-prodcons-yes.c +++ b/micro-benchmarks/DRB199-prodcons-yes.c @@ -15,37 +15,38 @@ * Data race pair: size@34:11:W vs. size@45:11:W */ -#include #include int nprod = 4, ncons = 4; -int cap = 5, size = 0; +int cap = 5, size = 0, packages = 1000; int main() { int nthread = nprod + ncons; -#pragma omp parallel for shared(size, cap, nprod, ncons, nthread) num_threads(nthread) +#pragma omp parallel for shared(size, cap, nprod, ncons, nthread) firstprivate(packages) num_threads(nthread) for (int i = 0; i < nthread; i++) { if (i < nprod) - while (1) + while (packages) { // I am a producer #pragma omp critical(A) if (size < cap) { size++; // produce + packages--; // produced a package printf("Producer %d produced! size=%d\n", i, size); fflush(stdout); } } else - while (1) + while (packages) { // I am a consumer #pragma omp critical(B) if (size > 0) { size--; // consume + packages--; // consumed a package printf("Consumer %d consumed! size=%d\n", i - nprod, size); fflush(stdout); } } } -} \ No newline at end of file +} diff --git a/micro-benchmarks/signaling.h b/micro-benchmarks/signaling.h new file mode 100644 index 0000000..6874b65 --- /dev/null +++ b/micro-benchmarks/signaling.h @@ -0,0 +1,31 @@ +#if defined(WIN32) || defined(_WIN32) +#include +#define delay() Sleep(1); +#else +#include +#define delay(t) usleep(t); +#endif + +// These functions are used to provide a signal-wait mechanism to enforce expected scheduling for the test cases. +// Conditional variable (s) needs to be shared! Initialize to 0 + +#define SIGNAL(s) atomic_signal(&s) +//inline +void atomic_signal(int* s) +{ + #pragma omp atomic + (*s)++; +} + +#define WAIT(s,v) atomic_wait(&s,v) +// wait for s >= v +//inline +void atomic_wait(int *s, int v) +{ + int wait=0; + do{ + delay(10); + #pragma omp atomic read + wait = (*s); + }while(wait Date: Thu, 10 Aug 2023 13:52:52 +0200 Subject: [PATCH 03/11] Avoid dead code elimination --- micro-benchmarks/DRB176-fib-taskdep-no.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/micro-benchmarks/DRB176-fib-taskdep-no.c b/micro-benchmarks/DRB176-fib-taskdep-no.c index 1ca1ef1..1fff4d3 100644 --- a/micro-benchmarks/DRB176-fib-taskdep-no.c +++ b/micro-benchmarks/DRB176-fib-taskdep-no.c @@ -23,10 +23,10 @@ int fib(int n) { i = fib(n - 1); #pragma omp task shared(j) depend(out : j) j = fib(n - 2); -#pragma omp task shared(i, j) depend(in : i, j) +#pragma omp task shared(i, j, s) depend(in : i, j) s = i + j; #pragma omp taskwait - return i + j; + return s; } int main(int argc, char **argv) { From bf3dc442b7da4282c40172509d6ad7f1833fba63 Mon Sep 17 00:00:00 2001 From: Joachim Jenke Date: Thu, 10 Aug 2023 12:27:49 +0200 Subject: [PATCH 04/11] Mark data dependency as dd --- ...DRB024-simdtruedep-orig-yes.c => DRB024-simdtruedep-orig-dd.c} | 0 .../{DRB025-simdtruedep-var-yes.c => DRB025-simdtruedep-var-dd.c} | 0 ...DRB138-simdsafelen-orig-yes.c => DRB138-simdsafelen-orig-dd.c} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename micro-benchmarks/{DRB024-simdtruedep-orig-yes.c => DRB024-simdtruedep-orig-dd.c} (100%) rename micro-benchmarks/{DRB025-simdtruedep-var-yes.c => DRB025-simdtruedep-var-dd.c} (100%) rename micro-benchmarks/{DRB138-simdsafelen-orig-yes.c => DRB138-simdsafelen-orig-dd.c} (100%) diff --git a/micro-benchmarks/DRB024-simdtruedep-orig-yes.c b/micro-benchmarks/DRB024-simdtruedep-orig-dd.c similarity index 100% rename from micro-benchmarks/DRB024-simdtruedep-orig-yes.c rename to micro-benchmarks/DRB024-simdtruedep-orig-dd.c diff --git a/micro-benchmarks/DRB025-simdtruedep-var-yes.c b/micro-benchmarks/DRB025-simdtruedep-var-dd.c similarity index 100% rename from micro-benchmarks/DRB025-simdtruedep-var-yes.c rename to micro-benchmarks/DRB025-simdtruedep-var-dd.c diff --git a/micro-benchmarks/DRB138-simdsafelen-orig-yes.c b/micro-benchmarks/DRB138-simdsafelen-orig-dd.c similarity index 100% rename from micro-benchmarks/DRB138-simdsafelen-orig-yes.c rename to micro-benchmarks/DRB138-simdsafelen-orig-dd.c From d67d31a4f481740c6fca25aa49ede0cdc13a6fd7 Mon Sep 17 00:00:00 2001 From: Joachim Jenke Date: Thu, 10 Aug 2023 13:50:46 +0200 Subject: [PATCH 05/11] Fix classification of some microkernels --- ...wait-orig-yes.c => DRB129-mergeable-taskwait-orig-no.c} | 0 micro-benchmarks/DRB142-acquirerelease-orig-yes.c | 7 +++---- .../{DRB189-barrier3-yes.c => DRB189-barrier3-no.c} | 0 3 files changed, 3 insertions(+), 4 deletions(-) rename micro-benchmarks/{DRB129-mergeable-taskwait-orig-yes.c => DRB129-mergeable-taskwait-orig-no.c} (100%) rename micro-benchmarks/{DRB189-barrier3-yes.c => DRB189-barrier3-no.c} (100%) diff --git a/micro-benchmarks/DRB129-mergeable-taskwait-orig-yes.c b/micro-benchmarks/DRB129-mergeable-taskwait-orig-no.c similarity index 100% rename from micro-benchmarks/DRB129-mergeable-taskwait-orig-yes.c rename to micro-benchmarks/DRB129-mergeable-taskwait-orig-no.c diff --git a/micro-benchmarks/DRB142-acquirerelease-orig-yes.c b/micro-benchmarks/DRB142-acquirerelease-orig-yes.c index 19a3a97..84f392f 100644 --- a/micro-benchmarks/DRB142-acquirerelease-orig-yes.c +++ b/micro-benchmarks/DRB142-acquirerelease-orig-yes.c @@ -15,7 +15,7 @@ * variable. * * Implicit flush must be used after critical construct, after line:34 and before line:35 to avoid data race. - * Data Race pair: x@34:9:W vs. x@34:9:W + * Data Race pair: x@34:9:W vs. x@43:11:R * */ @@ -39,9 +39,8 @@ int main(){ while (tmp == 0) { #pragma omp atomic read acquire tmp = y; - } - #pragma omp critical - { if (x!=10) printf("x = %d\n", x); } + } + if (x!=10) printf("x = %d\n", x); } } return 0; diff --git a/micro-benchmarks/DRB189-barrier3-yes.c b/micro-benchmarks/DRB189-barrier3-no.c similarity index 100% rename from micro-benchmarks/DRB189-barrier3-yes.c rename to micro-benchmarks/DRB189-barrier3-no.c From ce2d3ddd7bea0ca5720d0f7e389be8ca08b118fd Mon Sep 17 00:00:00 2001 From: Joachim Jenke Date: Thu, 10 Aug 2023 13:51:58 +0200 Subject: [PATCH 06/11] More than one team is necessary for a data race to be possible --- .../DRB144-critical-missingreduction-orig-gpu-yes.c | 2 +- micro-benchmarks/DRB150-missinglock1-orig-gpu-yes.c | 2 +- micro-benchmarks/DRB160-nobarrier-orig-gpu-yes.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/micro-benchmarks/DRB144-critical-missingreduction-orig-gpu-yes.c b/micro-benchmarks/DRB144-critical-missingreduction-orig-gpu-yes.c index 1032c3d..cb75624 100644 --- a/micro-benchmarks/DRB144-critical-missingreduction-orig-gpu-yes.c +++ b/micro-benchmarks/DRB144-critical-missingreduction-orig-gpu-yes.c @@ -20,7 +20,7 @@ int var = 0; int main(){ #pragma omp target map(tofrom:var) device(0) - #pragma omp teams distribute parallel for + #pragma omp teams distribute parallel for num_teams(4) for(int i=0; i Date: Thu, 10 Aug 2023 12:48:45 +0200 Subject: [PATCH 07/11] Fix non-deteminism in test execution --- micro-benchmarks/DRB013-nowait-orig-yes.c | 2 +- micro-benchmarks/DRB114-if-orig-yes.c | 3 +- micro-benchmarks/DRB114b-if-orig-no.c | 70 +++++++++++++++++++++++ micro-benchmarks/DRB201-sync1-yes.c | 5 +- micro-benchmarks/DRB201b-sync1-yes.c | 51 +++++++++++++++++ 5 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 micro-benchmarks/DRB114b-if-orig-no.c create mode 100644 micro-benchmarks/DRB201b-sync1-yes.c diff --git a/micro-benchmarks/DRB013-nowait-orig-yes.c b/micro-benchmarks/DRB013-nowait-orig-yes.c index b9a959f..e948774 100644 --- a/micro-benchmarks/DRB013-nowait-orig-yes.c +++ b/micro-benchmarks/DRB013-nowait-orig-yes.c @@ -72,7 +72,7 @@ int main() a[i] = b + a[i]*5; #pragma omp single - error = a[9] + 1; + error = a[9] + a[len/2] + a[len-1] + 1; } printf ("error = %d\n", error); diff --git a/micro-benchmarks/DRB114-if-orig-yes.c b/micro-benchmarks/DRB114-if-orig-yes.c index c527e41..cca79fa 100644 --- a/micro-benchmarks/DRB114-if-orig-yes.c +++ b/micro-benchmarks/DRB114-if-orig-yes.c @@ -60,8 +60,7 @@ int main(int argc, char* argv[]) for (i=0;i +#include +#include +int main(int argc, char* argv[]) +{ + int i; + int len=100; + int a[100]; + + for (i=0;i #include #include +#include "signaling.h" omp_lock_t l; -int x = 1; +int x = 1, sem = 0; int main() { @@ -32,11 +33,13 @@ int main() if (tid == 0) { omp_set_lock(&l); + SIGNAL(sem); x = 0; omp_unset_lock(&l); } else if (tid == 1) { + WAIT(sem, 1); omp_set_lock(&l); omp_unset_lock(&l); x = 1; diff --git a/micro-benchmarks/DRB201b-sync1-yes.c b/micro-benchmarks/DRB201b-sync1-yes.c new file mode 100644 index 0000000..1ae2007 --- /dev/null +++ b/micro-benchmarks/DRB201b-sync1-yes.c @@ -0,0 +1,51 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + +/* + * This is a program based on a dataset contributed by + * Wenhao Wu and Stephen F. Siegel @Univ. of Delaware. + + * Thread with id 1 acquires and releases the lock, but then it modifies x without holding it. + * Data race pair: size@35:7:W vs. size@42:7:W + */ + +#include +#include +#include +#include "signaling.h" + +omp_lock_t l; +int x = 1, sem = 0; + +int main() +{ + omp_init_lock(&l); +#pragma omp parallel num_threads(2) + { + int tid = omp_get_thread_num(); +#pragma omp barrier + if (tid == 0) + { + WAIT(sem, 1); + omp_set_lock(&l); + x = 0; + omp_unset_lock(&l); + } + else if (tid == 1) + { + omp_set_lock(&l); + SIGNAL(sem); + omp_unset_lock(&l); + x = 1; + } +#pragma omp barrier + } // end of parallel construct + omp_destroy_lock(&l); + printf("Done: x=%d\n", x); +} \ No newline at end of file From 4c2adf0e385e64364ae67e9adca9fc1a6589dc19 Mon Sep 17 00:00:00 2001 From: Joachim Jenke Date: Thu, 10 Aug 2023 13:43:02 +0200 Subject: [PATCH 08/11] Encourage specific task schedules to reduce non-deterministic results --- .../DRB027-taskdependmissing-orig-yes.c | 18 ++++- .../DRB027b-taskdependmissing-orig-yes.c | 79 +++++++++++++++++++ .../DRB131-taskdep4-orig-omp45-yes.c | 22 ++++-- .../DRB131b-taskdep4-orig-omp45-yes.c | 57 +++++++++++++ .../DRB132-taskdep4-orig-omp45-no.c | 20 +++-- .../DRB132b-taskdep4-orig-omp45-no.c | 58 ++++++++++++++ .../DRB133-taskdep5-orig-omp45-no.c | 18 ++++- .../DRB133b-taskdep5-orig-omp45-no.c | 61 ++++++++++++++ .../DRB134-taskdep5-orig-omp45-yes.c | 18 ++++- .../DRB134b-taskdep5-orig-omp45-yes.c | 61 ++++++++++++++ .../DRB136-taskdep-mutexinoutset-orig-yes.c | 13 ++- .../DRB136b-taskdep-mutexinoutset-orig-yes.c | 67 ++++++++++++++++ .../DRB165-taskdep4-orig-omp50-yes.c | 22 ++++-- .../DRB165b-taskdep4-orig-omp50-yes.c | 56 +++++++++++++ .../DRB168-taskdep5-orig-omp50-yes.c | 23 ++++-- .../DRB168b-taskdep5-orig-omp50-yes.c | 59 ++++++++++++++ .../DRB173-non-sibling-taskdep-yes.c | 19 ++++- .../DRB173b-non-sibling-taskdep-yes.c | 53 +++++++++++++ .../DRB175-non-sibling-taskdep2-yes.c | 12 ++- .../DRB175b-non-sibling-taskdep2-yes.c | 44 +++++++++++ micro-benchmarks/DRB177-fib-taskdep-yes.c | 16 ++-- micro-benchmarks/DRB177b-fib-taskdep-yes.c | 57 +++++++++++++ 22 files changed, 800 insertions(+), 53 deletions(-) create mode 100644 micro-benchmarks/DRB027b-taskdependmissing-orig-yes.c create mode 100644 micro-benchmarks/DRB131b-taskdep4-orig-omp45-yes.c create mode 100644 micro-benchmarks/DRB132b-taskdep4-orig-omp45-no.c create mode 100644 micro-benchmarks/DRB133b-taskdep5-orig-omp45-no.c create mode 100644 micro-benchmarks/DRB134b-taskdep5-orig-omp45-yes.c create mode 100644 micro-benchmarks/DRB136b-taskdep-mutexinoutset-orig-yes.c create mode 100644 micro-benchmarks/DRB165b-taskdep4-orig-omp50-yes.c create mode 100644 micro-benchmarks/DRB168b-taskdep5-orig-omp50-yes.c create mode 100644 micro-benchmarks/DRB173b-non-sibling-taskdep-yes.c create mode 100644 micro-benchmarks/DRB175b-non-sibling-taskdep2-yes.c create mode 100644 micro-benchmarks/DRB177b-fib-taskdep-yes.c diff --git a/micro-benchmarks/DRB027-taskdependmissing-orig-yes.c b/micro-benchmarks/DRB027-taskdependmissing-orig-yes.c index 44b30a5..7373750 100644 --- a/micro-benchmarks/DRB027-taskdependmissing-orig-yes.c +++ b/micro-benchmarks/DRB027-taskdependmissing-orig-yes.c @@ -47,20 +47,30 @@ THE POSSIBILITY OF SUCH DAMAGE. /* Two tasks without depend clause to protect data writes. i is shared for two tasks based on implicit data-sharing attribute rules. -Data race pair: i@61:5:W vs. i@63:5:W +Data race pair: i@63:5:W vs. i@67:5:W */ #include #include +#include "signaling.h" + int main() { - int i=0; -#pragma omp parallel + int i=0, sem=0; +#pragma omp parallel shared(sem) num_threads(2) #pragma omp single { #pragma omp task - i = 1; + { + i = 1; + SIGNAL(sem); + WAIT(sem,2); + } #pragma omp task + { i = 2; + SIGNAL(sem); + WAIT(sem,2); + } } printf ("i=%d\n",i); diff --git a/micro-benchmarks/DRB027b-taskdependmissing-orig-yes.c b/micro-benchmarks/DRB027b-taskdependmissing-orig-yes.c new file mode 100644 index 0000000..1187cd1 --- /dev/null +++ b/micro-benchmarks/DRB027b-taskdependmissing-orig-yes.c @@ -0,0 +1,79 @@ +/* +Copyright (c) 2017, Lawrence Livermore National Security, LLC. +Produced at the Lawrence Livermore National Laboratory +Written by Chunhua Liao, Pei-Hung Lin, Joshua Asplund, +Markus Schordan, and Ian Karlin +(email: liao6@llnl.gov, lin32@llnl.gov, asplund1@llnl.gov, +schordan1@llnl.gov, karlin1@llnl.gov) +LLNL-CODE-732144 +All rights reserved. + +This file is part of DataRaceBench. For details, see +https://github.com/LLNL/dataracebench. Please also see the LICENSE file +for our additional BSD notice. + +Redistribution and use in source and binary forms, with +or without modification, are permitted provided that the following +conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the disclaimer below. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the disclaimer (as noted below) + in the documentation and/or other materials provided with the + distribution. + +* Neither the name of the LLNS/LLNL nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL +SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* +Two tasks without depend clause to protect data writes. +i is shared for two tasks based on implicit data-sharing attribute rules. +Data race pair: i@63:5:W vs. i@67:5:W +*/ +#include +#include +#include "signaling.h" + +int main() +{ + int i=0, sem=0; +#pragma omp parallel shared(sem) num_threads(2) +{ +#pragma omp masked + { +#pragma omp task + { + SIGNAL(sem); + i = 1; + } +#pragma omp task + { + SIGNAL(sem); + i = 2; + } + #pragma omp taskwait + } + WAIT(sem, 2); +} + printf ("i=%d\n",i); + return 0; +} diff --git a/micro-benchmarks/DRB131-taskdep4-orig-omp45-yes.c b/micro-benchmarks/DRB131-taskdep4-orig-omp45-yes.c index 45940a9..4877917 100644 --- a/micro-benchmarks/DRB131-taskdep4-orig-omp45-yes.c +++ b/micro-benchmarks/DRB131-taskdep4-orig-omp45-yes.c @@ -11,22 +11,30 @@ * There is no completion restraint on the second child task. Hence, immediately after the first * taskwait it is unsafe to access the y variable since the second child task may still be * executing. - * Data Race at y@28:2:W vs. y@34:19:R + * Data Race at y@34:4:W vs. y@42:19:R */ #include #include +#include "signaling.h" void foo(){ - int x = 0, y = 2; + int x = 0, y = 2, sem = 0; - #pragma omp task depend(inout: x) shared(x) - x++; //1st Child Task + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); + x++; //1st Child Task + } - #pragma omp task shared(y) - y--; // 2nd child task + #pragma omp task shared(y, sem) + { + SIGNAL(sem); + y--; // 2nd child task + } + WAIT(sem, 2); #pragma omp task depend(in: x) if(0) // 1st taskwait {} @@ -37,7 +45,7 @@ void foo(){ int main(){ - #pragma omp parallel + #pragma omp parallel num_threads(2) #pragma omp single foo(); diff --git a/micro-benchmarks/DRB131b-taskdep4-orig-omp45-yes.c b/micro-benchmarks/DRB131b-taskdep4-orig-omp45-yes.c new file mode 100644 index 0000000..49e05b5 --- /dev/null +++ b/micro-benchmarks/DRB131b-taskdep4-orig-omp45-yes.c @@ -0,0 +1,57 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + +/* + * There is no completion restraint on the second child task. Hence, immediately after the first + * taskwait it is unsafe to access the y variable since the second child task may still be + * executing. + * Data Race at y@36:4:W vs. y@43:19:R +*/ + +#include +#include +#include "signaling.h" + +int sem = 0; + +void foo(){ + + int x = 0, y = 2; + + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); + x++; //1st Child Task + } + + #pragma omp task shared(y, sem) + { + SIGNAL(sem); + y--; // 2nd child task + } + + #pragma omp task depend(in: x) if(0) // 1st taskwait + {} + + printf("x=%d\n",x); + printf("y=%d\n",y); + #pragma omp taskwait // 2nd taskwait +} + + +int main(){ + #pragma omp parallel + { + #pragma omp masked + foo(); + WAIT(sem, 2); + } + + return 0; +} diff --git a/micro-benchmarks/DRB132-taskdep4-orig-omp45-no.c b/micro-benchmarks/DRB132-taskdep4-orig-omp45-no.c index 78bad68..1406b01 100644 --- a/micro-benchmarks/DRB132-taskdep4-orig-omp45-no.c +++ b/micro-benchmarks/DRB132-taskdep4-orig-omp45-no.c @@ -14,17 +14,25 @@ #include #include +#include "signaling.h" void foo(){ - int x = 0, y = 2; + int x = 0, y = 2, sem = 0; - #pragma omp task depend(inout: x) shared(x) - x++; //1st Child Task + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); + x++; //1st Child Task + } - #pragma omp task shared(y) - y--; // 2nd child task + #pragma omp task shared(y, sem) + { + SIGNAL(sem); + y--; // 2nd child task + } + WAIT(sem, 2); #pragma omp task depend(in: x) if(0) // 1st taskwait {} @@ -37,7 +45,7 @@ void foo(){ int main(){ - #pragma omp parallel + #pragma omp parallel num_threads(2) #pragma omp single foo(); diff --git a/micro-benchmarks/DRB132b-taskdep4-orig-omp45-no.c b/micro-benchmarks/DRB132b-taskdep4-orig-omp45-no.c new file mode 100644 index 0000000..91d185d --- /dev/null +++ b/micro-benchmarks/DRB132b-taskdep4-orig-omp45-no.c @@ -0,0 +1,58 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + +/* The second taskwait ensures that the second child task has completed; hence it is safe to access + * the y variable in the following print statement. + * */ + + +#include +#include +#include "signaling.h" + +int sem = 0; + +void foo(){ + + int x = 0, y = 2; + + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); + x++; //1st Child Task + } + + #pragma omp task shared(y, sem) + { + SIGNAL(sem); + y--; // 2nd child task + } + + #pragma omp task depend(in: x) if(0) // 1st taskwait + {} + + printf("x=%d\n",x); + + #pragma omp taskwait // 2nd taskwait + + printf("y=%d\n",y); +} + + +int main(){ + #pragma omp parallel + { + #pragma omp masked + foo(); + WAIT(sem, 2); + } + + return 0; +} + diff --git a/micro-benchmarks/DRB133-taskdep5-orig-omp45-no.c b/micro-benchmarks/DRB133-taskdep5-orig-omp45-no.c index c096fd3..4d133d5 100644 --- a/micro-benchmarks/DRB133-taskdep5-orig-omp45-no.c +++ b/micro-benchmarks/DRB133-taskdep5-orig-omp45-no.c @@ -17,16 +17,26 @@ #include #include +#include "signaling.h" + +int sem=0; void foo(){ int x = 0, y = 2; - #pragma omp task depend(inout: x) shared(x) + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); x++; // 1st child task + } - #pragma omp task depend(in: x) depend(inout: y) shared(x, y) - y = y-x; //2nd child task + #pragma omp task depend(in: x) depend(inout: y) shared(x, y, sem) + { + SIGNAL(sem); + y -= x; //2nd child task + } + WAIT(sem, 2); #pragma omp task depend(in: x) if(0) // 1st taskwait {} @@ -38,7 +48,7 @@ void foo(){ } int main(){ - #pragma omp parallel + #pragma omp parallel num_threads(2) #pragma omp single foo(); diff --git a/micro-benchmarks/DRB133b-taskdep5-orig-omp45-no.c b/micro-benchmarks/DRB133b-taskdep5-orig-omp45-no.c new file mode 100644 index 0000000..448b5c5 --- /dev/null +++ b/micro-benchmarks/DRB133b-taskdep5-orig-omp45-no.c @@ -0,0 +1,61 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + +/* The first two tasks are serialized, because a dependence on the first child is produced + * by x with the in dependence type in the depend clause of the second task. Generating task + * at the first taskwait only waits for the first child task to complete. The second taskwait + * guarantees completion of the second task before y is accessed. Therefore there is no race + * condition. + * */ + + +#include +#include +#include "signaling.h" + +int sem=0; + +void foo(){ + int x = 0, y = 2; + + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); + x++; // 1st child task + } + + #pragma omp task depend(in: x) depend(inout: y) shared(x, y, sem) + { + SIGNAL(sem); + y -= x; //2nd child task + } + + #pragma omp task depend(in: x) if(0) // 1st taskwait + {} + + printf("x=%d\n",x); + + #pragma omp taskwait // 2nd taskwait + + printf("y=%d\n",y); +} + +int main(){ + #pragma omp parallel num_threads(2) + { + #pragma omp masked + { + foo(); + } + WAIT(sem, 2); + } + + return 0; +} + diff --git a/micro-benchmarks/DRB134-taskdep5-orig-omp45-yes.c b/micro-benchmarks/DRB134-taskdep5-orig-omp45-yes.c index df59a0b..eaca0fd 100644 --- a/micro-benchmarks/DRB134-taskdep5-orig-omp45-yes.c +++ b/micro-benchmarks/DRB134-taskdep5-orig-omp45-yes.c @@ -11,22 +11,32 @@ * by x with the in dependence type in the depend clause of the second task. Generating task * at the first taskwait only waits for the first child task to complete. The second taskwait * guarantees completion of the second task before y is accessed. If we access y before the - * second taskwait, there is a race condition at line 28:2 and 34:18. Data Race Pair, y@28:2:W vs. y@34:19:R + * second taskwait, there is a race condition at line 28:2 and 34:18. Data Race Pair, y@36:5:W vs. y@43:19:R * */ #include #include +#include "signaling.h" + +int sem=0; void foo(){ int x = 0, y = 2; - #pragma omp task depend(inout: x) shared(x) + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); x++; // 1st child task + } - #pragma omp task depend(in: x) depend(inout: y) shared(x, y) + #pragma omp task depend(in: x) depend(inout: y) shared(x, y, sem) + { + SIGNAL(sem); y -= x; //2nd child task + } + WAIT(sem, 2); #pragma omp task depend(in: x) if(0) // 1st taskwait {} @@ -38,7 +48,7 @@ void foo(){ } int main(){ - #pragma omp parallel + #pragma omp parallel num_threads(2) #pragma omp single foo(); diff --git a/micro-benchmarks/DRB134b-taskdep5-orig-omp45-yes.c b/micro-benchmarks/DRB134b-taskdep5-orig-omp45-yes.c new file mode 100644 index 0000000..7588363 --- /dev/null +++ b/micro-benchmarks/DRB134b-taskdep5-orig-omp45-yes.c @@ -0,0 +1,61 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + +/* The first two tasks are serialized, because a dependence on the first child is produced + * by x with the in dependence type in the depend clause of the second task. Generating task + * at the first taskwait only waits for the first child task to complete. The second taskwait + * guarantees completion of the second task before y is accessed. If we access y before the + * second taskwait, there is a race condition at line 36 ann 44. Data Race Pair, y@36:5:W vs. y@44:19:R + * */ + + +#include +#include +#include "signaling.h" + +int sem=0; + +void foo(){ + int x = 0, y = 2; + + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); + x++; // 1st child task + } + + #pragma omp task depend(in: x) depend(inout: y) shared(x, y, sem) + { + SIGNAL(sem); + y -= x; //2nd child task + } + + #pragma omp task depend(in: x) if(0) // 1st taskwait + {} + + printf("x=%d\n",x); + printf("y=%d\n",y); + + #pragma omp taskwait // 2nd taskwait + +} + +int main(){ + #pragma omp parallel num_threads(2) + { + #pragma omp masked + { + foo(); + } + WAIT(sem, 2); + } + + return 0; +} + diff --git a/micro-benchmarks/DRB136-taskdep-mutexinoutset-orig-yes.c b/micro-benchmarks/DRB136-taskdep-mutexinoutset-orig-yes.c index d073296..c19dba9 100644 --- a/micro-benchmarks/DRB136-taskdep-mutexinoutset-orig-yes.c +++ b/micro-benchmarks/DRB136-taskdep-mutexinoutset-orig-yes.c @@ -15,11 +15,12 @@ #include #include +#include "signaling.h" int main(){ - int a, b, c, d; + int a, b, c, d, sem = 0; - #pragma omp parallel + #pragma omp parallel num_threads(2) #pragma omp single { #pragma omp task depend(out: c) @@ -29,9 +30,17 @@ int main(){ #pragma omp task depend(out: b) b = 3; #pragma omp task depend(in: a) + { + SIGNAL(sem); + WAIT(sem,2); c += a; + } #pragma omp task depend(in: b) + { + SIGNAL(sem); + WAIT(sem,2); c += b; + } #pragma omp task depend(in: c) d = c; } diff --git a/micro-benchmarks/DRB136b-taskdep-mutexinoutset-orig-yes.c b/micro-benchmarks/DRB136b-taskdep-mutexinoutset-orig-yes.c new file mode 100644 index 0000000..58c0a21 --- /dev/null +++ b/micro-benchmarks/DRB136b-taskdep-mutexinoutset-orig-yes.c @@ -0,0 +1,67 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + + +/* Due to the missing mutexinoutset dependence type on c, these tasks will execute in any + * order leading to the data race at line 36. Data Race Pair, + c@35:7:W vs. c@35:7:W + c@35:7:W vs. c@39:11:R + c@37:7:W vs. c@39:11:R + * */ + + +#include +#include +#include "signaling.h" + +int main(){ + int a, b, c, d, sem = 0; + + #pragma omp parallel num_threads(2) + { + #pragma omp masked + { + #pragma omp task depend(out: c) + { + SIGNAL(sem); + c = 1; + } + #pragma omp task depend(out: a) + { + SIGNAL(sem); + a = 2; + } + #pragma omp task depend(out: b) + { + SIGNAL(sem); + b = 3; + } + #pragma omp task depend(in: a) + { + SIGNAL(sem); + c += a; + } + #pragma omp task depend(in: b) + { + SIGNAL(sem); + c += b; + } + #pragma omp task depend(in: c) + { + SIGNAL(sem); + d = c; + } + #pragma omp taskwait + } + WAIT(sem, 6); + } + + printf("%d\n",d); + return 0; +} diff --git a/micro-benchmarks/DRB165-taskdep4-orig-omp50-yes.c b/micro-benchmarks/DRB165-taskdep4-orig-omp50-yes.c index b78cd8d..bc9cd10 100644 --- a/micro-benchmarks/DRB165-taskdep4-orig-omp50-yes.c +++ b/micro-benchmarks/DRB165-taskdep4-orig-omp50-yes.c @@ -11,22 +11,30 @@ * There is no completion restraint on the second child task. Hence, immediately after the first * taskwait it is unsafe to access the y variable since the second child task may still be * executing. - * Data Race at y@28:2:W vs. y@33:19:R + * Data Race at y@34:4:W vs. y@41:19:R */ #include #include +#include "signaling.h" void foo(){ - int x = 0, y = 2; + int x = 0, y = 2, sem = 0; - #pragma omp task depend(inout: x) shared(x) - x++; //1st Child Task + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); + x++; //1st Child Task + } - #pragma omp task shared(y) - y--; // 2nd child task + #pragma omp task shared(y, sem) + { + SIGNAL(sem); + y--; // 2nd child task + } + WAIT(sem, 2); #pragma omp taskwait depend(in: x) // 1st taskwait printf("x=%d\n",x); @@ -36,7 +44,7 @@ void foo(){ int main(){ - #pragma omp parallel + #pragma omp parallel num_threads(2) #pragma omp single foo(); diff --git a/micro-benchmarks/DRB165b-taskdep4-orig-omp50-yes.c b/micro-benchmarks/DRB165b-taskdep4-orig-omp50-yes.c new file mode 100644 index 0000000..4abcdec --- /dev/null +++ b/micro-benchmarks/DRB165b-taskdep4-orig-omp50-yes.c @@ -0,0 +1,56 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + +/* + * There is no completion restraint on the second child task. Hence, immediately after the first + * taskwait it is unsafe to access the y variable since the second child task may still be + * executing. + * Data Race at y@36:4:W vs. y@42:19:R +*/ + +#include +#include +#include "signaling.h" + +int sem = 0; + +void foo(){ + + int x = 0, y = 2; + + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); + x++; //1st Child Task + } + + #pragma omp task shared(y, sem) + { + SIGNAL(sem); + y--; // 2nd child task + } + + #pragma omp taskwait depend(in: x) // 1st taskwait + + printf("x=%d\n",x); + printf("y=%d\n",y); + #pragma omp taskwait // 2nd taskwait +} + + +int main(){ + #pragma omp parallel + { + #pragma omp masked + foo(); + WAIT(sem, 2); + } + + return 0; +} diff --git a/micro-benchmarks/DRB168-taskdep5-orig-omp50-yes.c b/micro-benchmarks/DRB168-taskdep5-orig-omp50-yes.c index e8359f1..81060c6 100644 --- a/micro-benchmarks/DRB168-taskdep5-orig-omp50-yes.c +++ b/micro-benchmarks/DRB168-taskdep5-orig-omp50-yes.c @@ -11,33 +11,42 @@ * by x with the in dependence type in the depend clause of the second task. Generating task * at the first taskwait only waits for the first child task to complete. The second taskwait * guarantees completion of the second task before y is accessed. If we access y before the - * second taskwait, there is a race condition at line 28 ann 33. Data Race Pair, y@28:2:W vs. y@33:19:R + * second taskwait, there is a race condition at line 28 ann 33. Data Race Pair, y@36:5:W vs. y@43:19:R * */ #include #include +#include "signaling.h" + +int sem=0; void foo(){ int x = 0, y = 2; - #pragma omp task depend(inout: x) shared(x) - x++; // 1st child task + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); + x++; // 1st child task + } - #pragma omp task depend(in: x) depend(inout: y) shared(x, y) - y -= x; //2nd child task + #pragma omp task depend(in: x) depend(inout: y) shared(x, y, sem) + { + SIGNAL(sem); + y -= x; //2nd child task + } + WAIT(sem, 2); #pragma omp taskwait depend(in: x) // 1st taskwait printf("x=%d\n",x); printf("y=%d\n",y); - #pragma omp taskwait // 2nd taskwait } int main(){ - #pragma omp parallel + #pragma omp parallel num_threads(2) #pragma omp single foo(); diff --git a/micro-benchmarks/DRB168b-taskdep5-orig-omp50-yes.c b/micro-benchmarks/DRB168b-taskdep5-orig-omp50-yes.c new file mode 100644 index 0000000..5b939c6 --- /dev/null +++ b/micro-benchmarks/DRB168b-taskdep5-orig-omp50-yes.c @@ -0,0 +1,59 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + +/* The first two tasks are serialized, because a dependence on the first child is produced + * by x with the in dependence type in the depend clause of the second task. Generating task + * at the first taskwait only waits for the first child task to complete. The second taskwait + * guarantees completion of the second task before y is accessed. If we access y before the + * second taskwait, there is a race condition at line 36 ann 43. Data Race Pair, y@36:5:W vs. y@43:19:R + * */ + + +#include +#include +#include "signaling.h" + +int sem=0; + +void foo(){ + int x = 0, y = 2; + + #pragma omp task depend(inout: x) shared(x, sem) + { + SIGNAL(sem); + x++; // 1st child task + } + + #pragma omp task depend(in: x) depend(inout: y) shared(x, y, sem) + { + SIGNAL(sem); + y -= x; //2nd child task + } + + #pragma omp taskwait depend(in: x) // 1st taskwait + + printf("x=%d\n",x); + printf("y=%d\n",y); + #pragma omp taskwait // 2nd taskwait + +} + +int main(){ + #pragma omp parallel num_threads(2) + { + #pragma omp masked + { + foo(); + } + WAIT(sem, 2); + } + + return 0; +} + diff --git a/micro-benchmarks/DRB173-non-sibling-taskdep-yes.c b/micro-benchmarks/DRB173-non-sibling-taskdep-yes.c index b3e24ce..661fe87 100644 --- a/micro-benchmarks/DRB173-non-sibling-taskdep-yes.c +++ b/micro-benchmarks/DRB173-non-sibling-taskdep-yes.c @@ -17,24 +17,35 @@ for details. #include #include +#include "signaling.h" void foo() { - int a = 0; + int a = 0, sem = 0; -#pragma omp parallel +#pragma omp parallel num_threads(2) #pragma omp single { #pragma omp task depend(inout : a) shared(a) { #pragma omp task depend(inout : a) shared(a) - a++; + { + a++; + SIGNAL(sem); + WAIT(sem,2); + } } #pragma omp task depend(inout : a) shared(a) { #pragma omp task depend(inout : a) shared(a) - a++; + { + a++; + SIGNAL(sem); + WAIT(sem,2); + } } + // allow other thread to steal first task + WAIT(sem,1); } printf("a=%d\n", a); diff --git a/micro-benchmarks/DRB173b-non-sibling-taskdep-yes.c b/micro-benchmarks/DRB173b-non-sibling-taskdep-yes.c new file mode 100644 index 0000000..20d89c9 --- /dev/null +++ b/micro-benchmarks/DRB173b-non-sibling-taskdep-yes.c @@ -0,0 +1,53 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file +for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + +/* + * Data race between non-sibling tasks with declared task dependency + * Derived from code in https://hal.archives-ouvertes.fr/hal-02177469/document, + * Listing 1.1 + * Data Race Pair, a@30:7:W vs. a@36:7:W + * */ + +#include +#include +#include "signaling.h" + +void foo() { + int a = 0, sem = 0; + +#pragma omp parallel num_threads(2) +{ +#pragma omp masked +#pragma omp taskgroup + { +#pragma omp task depend(inout : a) shared(a) + { +#pragma omp task depend(inout : a) shared(a) + SIGNAL(sem); + a++; + } + +#pragma omp task depend(inout : a) shared(a) + { +#pragma omp task depend(inout : a) shared(a) + SIGNAL(sem); + a++; + } + } + WAIT(sem,2); +} + printf("a=%d\n", a); +} + +int main() { + foo(); + + return 0; +} diff --git a/micro-benchmarks/DRB175-non-sibling-taskdep2-yes.c b/micro-benchmarks/DRB175-non-sibling-taskdep2-yes.c index 5121111..e44ca1f 100644 --- a/micro-benchmarks/DRB175-non-sibling-taskdep2-yes.c +++ b/micro-benchmarks/DRB175-non-sibling-taskdep2-yes.c @@ -13,19 +13,25 @@ for details. * with declared task dependency * Derived from code in https://hal.archives-ouvertes.fr/hal-02177469/document, * Listing 1.3 - * Data Race Pair, a@28:6:W vs. a@28:6:W + * Schedule forced to execute all tasks by different threads. + * Data Race Pair, a@32:8:W vs. a@32:8:W * */ #include #include +#include "signaling.h" void foo() { - int a = 0; + int a = 0, sem = 0; #pragma omp parallel { #pragma omp task depend(inout : a) shared(a) - a++; + { + SIGNAL(sem); + WAIT(sem, omp_get_num_threads()); + a++; + } } printf("a=%d\n", a); } diff --git a/micro-benchmarks/DRB175b-non-sibling-taskdep2-yes.c b/micro-benchmarks/DRB175b-non-sibling-taskdep2-yes.c new file mode 100644 index 0000000..9c65c85 --- /dev/null +++ b/micro-benchmarks/DRB175b-non-sibling-taskdep2-yes.c @@ -0,0 +1,44 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file +for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + +/* + * Data race between non-sibling tasks created from different implicit tasks + * with declared task dependency + * Derived from code in https://hal.archives-ouvertes.fr/hal-02177469/document, + * Listing 1.3 + * Schedule encouraged to execute all tasks by thread 0. + * Data Race Pair, a@28:6:W vs. a@28:6:W + * */ + +#include +#include +#include "signaling.h" + +void foo() { + int a = 0, sem = 0; + +#pragma omp parallel + { +#pragma omp task depend(inout : a) shared(a) + { + SIGNAL(sem); + a++; + } + if (omp_get_thread_num() != 0) + WAIT(sem, omp_get_num_threads()); + } + printf("a=%d\n", a); +} + +int main() { + foo(); + + return 0; +} diff --git a/micro-benchmarks/DRB177-fib-taskdep-yes.c b/micro-benchmarks/DRB177-fib-taskdep-yes.c index e76a9aa..bc53827 100644 --- a/micro-benchmarks/DRB177-fib-taskdep-yes.c +++ b/micro-benchmarks/DRB177-fib-taskdep-yes.c @@ -22,13 +22,19 @@ int fib(int n) { if (n < 2) return n; #pragma omp task shared(i) depend(out : i) - i = fib(n - 1); + { + i = fib(n - 1); + } #pragma omp task shared(j) depend(out : j) - j = fib(n - 2); -#pragma omp task shared(i, j) depend(in : j) - s = i + j; + { + j = fib(n - 2); + } +#pragma omp task shared(i, j, s) depend(in : j) + { + s = i + j; + } #pragma omp taskwait - return i + j; + return s; } int main(int argc, char **argv) { diff --git a/micro-benchmarks/DRB177b-fib-taskdep-yes.c b/micro-benchmarks/DRB177b-fib-taskdep-yes.c new file mode 100644 index 0000000..b1211c4 --- /dev/null +++ b/micro-benchmarks/DRB177b-fib-taskdep-yes.c @@ -0,0 +1,57 @@ +/* +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! +!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC +!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file +for details. +!!! +!!! SPDX-License-Identifier: (BSD-3-Clause) +!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!! + */ + +/* + * Fibonacci code with data race (possible to scale problem size by providing + * size argument). + * Data Race Pair, i@25:5:W vs. i@29:7:R + * */ + +#include +#include +#include "signaling.h" + +int sem = 0; + +int fib(int n) { + int i, j, s; + if (n < 2) + return n; +#pragma omp task shared(i, sem) depend(out : i) + { + i = fib(n - 1); + } +#pragma omp task shared(j, sem) depend(out : j) + { + j = fib(n - 2); + } +#pragma omp task shared(i, j, s, sem) depend(in : j) + { + s = i + j; + } +#pragma omp taskwait + return s; +} + +int main(int argc, char **argv) { + int n = 10; + if (argc > 1) + n = atoi(argv[1]); +#pragma omp parallel + { +#pragma omp masked + { + printf("fib(%i) = %i\n", n, fib(n)); + SIGNAL(sem); + } + WAIT(sem, 1); + } + return 0; +} From 4f65b3727ee6e690e462e739fbce2a227b9f93ad Mon Sep 17 00:00:00 2001 From: Joachim Jenke Date: Fri, 11 Aug 2023 11:42:58 +0200 Subject: [PATCH 09/11] Make test-harness more robust for missing /usr/bin/time and bc --- scripts/test-harness.sh | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/scripts/test-harness.sh b/scripts/test-harness.sh index 6017536..f4cb46b 100755 --- a/scripts/test-harness.sh +++ b/scripts/test-harness.sh @@ -98,6 +98,14 @@ FORTRAN_COMPILE_FLAGS="-O0 -fopenmp -fsanitize=thread -lgfortran" IFORT_FORTRAN_FLAGS="-g -O0 -free -qopenmp -qopenmp-offload=host -Tf" +if which bc > /dev/null 2>&1 ; then + CALCTIME="echo \"scale=3; (\$end-\$start)/1000000\" | bc" +elif which $PYTHON > /dev/null 2>&1 ; then + CALCTIME="echo \"print('%.3f'%((\$end-\$start)/1.e6))\" | $PYTHON" +fi + + + POLYFLAG="micro-benchmarks/utilities/polybench.c -I micro-benchmarks -I micro-benchmarks/utilities -DPOLYBENCH_NO_FLUSH_CACHE -DPOLYBENCH_TIME -D_POSIX_C_SOURCE=200112L" FPOLYFLAG="-Imicro-benchmarks-fortran micro-benchmarks-fortran/utilities/fpolybench.o" VARLEN_PATTERN='[[:alnum:]]+-var-[[:alnum:]]+\.c' @@ -310,8 +318,12 @@ trap cleanup SIGINT SIGTERM if [[ "$LANGUAGE" == "c" || "$LANGUAGE" == "C" || "$LANGUAGE" == "c++" || "$LANGUAGE" == "C++" ]]; then for tool in "${TOOLS[@]}"; do - + MEMUSAGE= MEMLOG="$LOG_DIR/$tool.memlog" + if which $MEMCHECK > /dev/null 2>&1 ; then + MEMUSAGE="$MEMCHECK -f \"%M\" -o \"$MEMLOG\"" + fi + file="$OUTPUT_DIR/$tool.csv" echo "Saving to: $file and $MEMLOG" [ -e "$file" ] && rm "$file" @@ -459,7 +471,7 @@ for tool in "${TOOLS[@]}"; do cat tmp.log >> "$LOG_DIR/$logname" || >tmp.log ;; tsan-clang) # races=$($MEMCHECK -f "%M" -o "$MEMLOG" "./$exname" $size 2>&1 | tee -a "$LOG_DIR/$logname" | grep -ce 'WARNING: ThreadSanitizer: data race') ;; - $TIMEOUTCMD $TIMEOUTMIN"m" $MEMCHECK -f "%M" -o "$MEMLOG" env TSAN_OPTIONS="exitcode=0 halt_on_error=1 ignore_noninstrumented_modules=1" "./$exname" $size &> tmp.log; + $TIMEOUTCMD $TIMEOUTMIN"m" $MEMUSAGE env TSAN_OPTIONS="exitcode=0 halt_on_error=1 ignore_noninstrumented_modules=1" "./$exname" $size &> tmp.log; check_return_code $?; echo "$testname return $testreturn" races=$(grep -ce 'WARNING: ThreadSanitizer: data race' tmp.log) @@ -489,7 +501,9 @@ for tool in "${TOOLS[@]}"; do #races=$("./$exname" $size 2>&1 | tee -a "$LOG_DIR/$logname" | grep -ce 'race found!') ;; esac end=$(date +%s%6N) - elapsedtime=$(echo "scale=3; ($end-$start)/1000000"|bc) +# elapsedtime=$(echo "scale=3; ($end-$start)/1000000"|bc) +# elapsedtime=$(echo "print('%.3f'%(($end-$start)/1.e6))" | python3) + elapsedtime=$(eval $CALCTIME) mem=$(cat $MEMLOG) echo "$tool,$id,\"$testname\",$haverace,$thread,${size:-"N/A"},${races:-0},$elapsedtime,$mem,$compilereturn,$testreturn" >> "$file" ITER_INDEX=$((ITER_INDEX+1)) @@ -509,7 +523,11 @@ elif [[ "$LANGUAGE" == "fortran" || "$LANGUAGE" == "FORTRAN" ]]; then for tool in "${TOOLS[@]}"; do + MEMUSAGE= MEMLOG="$LOG_DIR/$tool.memlog" + if which $MEMCHECK > /dev/null 2>&1 ; then + MEMUSAGE="$MEMCHECK -f \"%M\" -o \"$MEMLOG\"" + fi file="$OUTPUT_DIR/$tool.csv" echo "Saving to: $file and $MEMLOG" [ -e "$file" ] && rm "$file" @@ -642,7 +660,7 @@ for tool in "${TOOLS[@]}"; do cat tmp.log >> "$LOG_DIR/$logname" || >tmp.log ;; tsan-clang) # races=$($MEMCHECK -f "%M" -o "$MEMLOG" "./$exname" $size 2>&1 | tee -a "$LOG_DIR/$logname" | grep -ce 'WARNING: ThreadSanitizer: data race') ;; - $TIMEOUTCMD $TIMEOUTMIN"m" $MEMCHECK -f "%M" -o "$MEMLOG" env TSAN_OPTIONS="exitcode=0 halt_on_error=1 ignore_noninstrumented_modules=1" "./$exname" $size &> tmp.log; + $TIMEOUTCMD $TIMEOUTMIN"m" $MEMUSAGE env TSAN_OPTIONS="exitcode=0 halt_on_error=1 ignore_noninstrumented_modules=1" "./$exname" $size &> tmp.log; check_return_code $?; echo "$testname return $testreturn" races=$(grep -ce 'WARNING: ThreadSanitizer: data race' tmp.log) @@ -672,7 +690,9 @@ for tool in "${TOOLS[@]}"; do #races=$("./$exname" $size 2>&1 | tee -a "$LOG_DIR/$logname" | grep -ce 'race found!') ;; esac end=$(date +%s%6N) - elapsedtime=$(echo "scale=3; ($end-$start)/1000000"|bc) +# elapsedtime=$(echo "scale=3; ($end-$start)/1000000"|bc) +# elapsedtime=$(echo "print('%.3f'%(($end-$start)/1.e6))" | python3) + elapsedtime=$(eval $CALCTIME) mem=$(cat $MEMLOG) echo "$tool,$id,\"$testname\",$haverace,$thread,${size:-"N/A"},${races:-0},$elapsedtime,$mem,$compilereturn,$testreturn" >> "$file" ITER_INDEX=$((ITER_INDEX+1)) From dee14133572284f99542e7d05549dfffb4c3997c Mon Sep 17 00:00:00 2001 From: Joachim Jenke Date: Mon, 14 Aug 2023 14:09:10 +0200 Subject: [PATCH 10/11] Fix regex and ignore extra files in the micro-benchmark directories --- scripts/getSourceRaceInfo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/getSourceRaceInfo.py b/scripts/getSourceRaceInfo.py index 5923dae..4e7edda 100644 --- a/scripts/getSourceRaceInfo.py +++ b/scripts/getSourceRaceInfo.py @@ -9,14 +9,14 @@ def main(argv): # micro-bechmarks in C - cfiles = [f for f in os.listdir(CDIR) if os.path.isfile(os.path.join(CDIR, f))] + cfiles = [f for f in os.listdir(CDIR) if os.path.isfile(os.path.join(CDIR, f)) and (f.endswith(".c") or f.endswith(".cpp"))] for f in cfiles: fullpath = os.path.join(CDIR, f) print("processing C:" + fullpath) genRaceInfoJsonFile(fullpath,os.path.join(REF_DIR, "C")) # micro-bechmarks in fortran - ffiles = [f for f in os.listdir(FDIR) if os.path.isfile(os.path.join(FDIR, f))] + ffiles = [f for f in os.listdir(FDIR) if os.path.isfile(os.path.join(FDIR, f)) and f.lower().endswith(".f95")] for f in ffiles: fullpath = os.path.join(FDIR, f) print("processing Fortran:"+fullpath) @@ -52,7 +52,7 @@ def genRaceInfoJsonFile(inputfile, outputdir): match = x.group() js["microbenchmark"] = filename #print(match) - pair = re.findall("(?:\*)*[a-zA-Z]\S*(?:\[.*\])*\@\d+\:\d+\:[R,W]", match) + pair = re.findall("(?:\*)*[a-zA-Z]\S*(?:\[[^]]*\])*\@\d+\:\d+\:[R,W]", match) #print(i,pair) p1 = pair[0] p2 = pair[1] From d2c94124cd3648da3c32b08bba34e484955fc500 Mon Sep 17 00:00:00 2001 From: Joachim Jenke Date: Mon, 14 Aug 2023 14:10:40 +0200 Subject: [PATCH 11/11] Fix line:column markup and add missing data race pairs --- micro-benchmarks/DRB013-nowait-orig-yes.c | 4 ++- .../DRB020-privatemissing-var-yes.c | 3 ++- .../DRB027-taskdependmissing-orig-yes.c | 2 +- .../DRB027b-taskdependmissing-orig-yes.c | 2 +- .../DRB035-truedepscalar-orig-yes.c | 3 ++- .../DRB036-truedepscalar-var-yes.c | 4 +-- micro-benchmarks/DRB114-if-orig-yes.c | 2 +- .../DRB116-target-teams-orig-yes.c | 2 +- .../DRB117-taskwait-waitonlychild-orig-yes.c | 2 +- .../DRB129-mergeable-taskwait-orig-no.c | 2 +- .../DRB134-taskdep5-orig-omp45-yes.c | 6 ++--- .../DRB134b-taskdep5-orig-omp45-yes.c | 2 +- .../DRB136-taskdep-mutexinoutset-orig-yes.c | 7 ++++- .../DRB136b-taskdep-mutexinoutset-orig-yes.c | 6 ++--- .../DRB156-missingordered-orig-gpu-yes.c | 2 +- .../DRB157-missingorderedsimd-orig-gpu-yes.c | 2 +- .../DRB161-nolocksimd-orig-gpu-yes.c | 2 +- .../DRB164-simdmissinglock1-orig-gpu-yes.c | 2 +- .../DRB173-non-sibling-taskdep-yes.c | 2 +- .../DRB175-non-sibling-taskdep2-yes.c | 2 +- .../DRB175b-non-sibling-taskdep2-yes.c | 2 +- micro-benchmarks/DRB177-fib-taskdep-yes.c | 8 +----- micro-benchmarks/DRB177b-fib-taskdep-yes.c | 8 +----- micro-benchmarks/DRB180-miniAMR-yes.c | 27 ++++++++++++------- micro-benchmarks/DRB183-atomic3-yes.c | 3 ++- micro-benchmarks/DRB185-barrier1-yes.c | 6 ++++- micro-benchmarks/DRB189-barrier3-no.c | 4 +-- .../DRB191-critical-section2-yes.c | 4 ++- micro-benchmarks/DRB199-prodcons-yes.c | 4 ++- micro-benchmarks/DRB201-sync1-yes.c | 2 +- micro-benchmarks/DRB201b-sync1-yes.c | 2 +- 31 files changed, 70 insertions(+), 59 deletions(-) diff --git a/micro-benchmarks/DRB013-nowait-orig-yes.c b/micro-benchmarks/DRB013-nowait-orig-yes.c index e948774..7255fc4 100644 --- a/micro-benchmarks/DRB013-nowait-orig-yes.c +++ b/micro-benchmarks/DRB013-nowait-orig-yes.c @@ -52,7 +52,9 @@ Some threads may finish the for loop early and execute errors = dt[9]+1 while another thread may still be simultaneously executing the for worksharing region by writing to d[9], causing data races. -Data race pair: a[i]@72:7:W vs. a[9]@75:13:R +Data race pair: a[i]@74:7:W vs. a[9]@77:13:R +Data race pair: a[i]@74:7:W vs. a[9]@77:20:R +Data race pair: a[i]@74:7:W vs. a[9]@77:31:R */ #include diff --git a/micro-benchmarks/DRB020-privatemissing-var-yes.c b/micro-benchmarks/DRB020-privatemissing-var-yes.c index 60b4714..c65c2e0 100644 --- a/micro-benchmarks/DRB020-privatemissing-var-yes.c +++ b/micro-benchmarks/DRB020-privatemissing-var-yes.c @@ -45,7 +45,8 @@ THE POSSIBILITY OF SUCH DAMAGE. */ /* tmp should be put as private to avoid race condition -Data race pair: tmp@65:5:W vs. tmp@66:12:R +Data race pair: tmp@66:5:W vs. tmp@67:12:R + tmp@66:5:W vs. tmp@66:5:W */ #include int main(int argc, char* argv[]) diff --git a/micro-benchmarks/DRB027-taskdependmissing-orig-yes.c b/micro-benchmarks/DRB027-taskdependmissing-orig-yes.c index 7373750..d5add67 100644 --- a/micro-benchmarks/DRB027-taskdependmissing-orig-yes.c +++ b/micro-benchmarks/DRB027-taskdependmissing-orig-yes.c @@ -47,7 +47,7 @@ THE POSSIBILITY OF SUCH DAMAGE. /* Two tasks without depend clause to protect data writes. i is shared for two tasks based on implicit data-sharing attribute rules. -Data race pair: i@63:5:W vs. i@67:5:W +Data race pair: i@64:5:W vs. i@70:5:W */ #include #include diff --git a/micro-benchmarks/DRB027b-taskdependmissing-orig-yes.c b/micro-benchmarks/DRB027b-taskdependmissing-orig-yes.c index 1187cd1..51ba1e4 100644 --- a/micro-benchmarks/DRB027b-taskdependmissing-orig-yes.c +++ b/micro-benchmarks/DRB027b-taskdependmissing-orig-yes.c @@ -47,7 +47,7 @@ THE POSSIBILITY OF SUCH DAMAGE. /* Two tasks without depend clause to protect data writes. i is shared for two tasks based on implicit data-sharing attribute rules. -Data race pair: i@63:5:W vs. i@67:5:W +Data race pair: i@66:5:W vs. i@71:5:W */ #include #include diff --git a/micro-benchmarks/DRB035-truedepscalar-orig-yes.c b/micro-benchmarks/DRB035-truedepscalar-orig-yes.c index 84510ea..c2c6db1 100644 --- a/micro-benchmarks/DRB035-truedepscalar-orig-yes.c +++ b/micro-benchmarks/DRB035-truedepscalar-orig-yes.c @@ -46,7 +46,8 @@ THE POSSIBILITY OF SUCH DAMAGE. /* Loop carried true dep between tmp =.. and ..= tmp. -Data race pair: tmp@66:12:R vs. tmp@67:5:W +Data race pair: tmp@67:12:R vs. tmp@68:5:W + tmp@68:5:W vs. tmp@68:5:W */ #include #include diff --git a/micro-benchmarks/DRB036-truedepscalar-var-yes.c b/micro-benchmarks/DRB036-truedepscalar-var-yes.c index 46b5a91..7624cb1 100644 --- a/micro-benchmarks/DRB036-truedepscalar-var-yes.c +++ b/micro-benchmarks/DRB036-truedepscalar-var-yes.c @@ -46,8 +46,8 @@ THE POSSIBILITY OF SUCH DAMAGE. /* Loop carried true dep between tmp =.. and ..= tmp. -Data race pairs: tmp@66:12:R vs. tmp@67:5:W - tmp@67:5:W vs. tmp@67:5:W +Data race pairs: tmp@67:12:R vs. tmp@68:5:W + tmp@68:5:W vs. tmp@68:5:W */ #include int main(int argc, char* argv[]) diff --git a/micro-benchmarks/DRB114-if-orig-yes.c b/micro-benchmarks/DRB114-if-orig-yes.c index cca79fa..6946301 100644 --- a/micro-benchmarks/DRB114-if-orig-yes.c +++ b/micro-benchmarks/DRB114-if-orig-yes.c @@ -46,7 +46,7 @@ THE POSSIBILITY OF SUCH DAMAGE. /* When if() evaluates to true, this program has data races due to true dependence within the loop at 65. -Data race pair: a[i+1]@66:5:W vs. a[i]@66:12:R +Data race pair: a[i+1]@65:5:W vs. a[i]@65:12:R */ #include #include diff --git a/micro-benchmarks/DRB116-target-teams-orig-yes.c b/micro-benchmarks/DRB116-target-teams-orig-yes.c index 40bfb10..e4d785c 100644 --- a/micro-benchmarks/DRB116-target-teams-orig-yes.c +++ b/micro-benchmarks/DRB116-target-teams-orig-yes.c @@ -48,7 +48,7 @@ THE POSSIBILITY OF SUCH DAMAGE. /* use of omp target + teams Without protection, master threads from two teams cause data races. -Data race pair: a@66:5:W vs. a@66:5:W +Data race pair: a[50]*@66:5:W vs. a[50]*@66:5:W */ int main(int argc, char* argv[]) { diff --git a/micro-benchmarks/DRB117-taskwait-waitonlychild-orig-yes.c b/micro-benchmarks/DRB117-taskwait-waitonlychild-orig-yes.c index ac631c5..0f7a747 100644 --- a/micro-benchmarks/DRB117-taskwait-waitonlychild-orig-yes.c +++ b/micro-benchmarks/DRB117-taskwait-waitonlychild-orig-yes.c @@ -11,7 +11,7 @@ The thread encountering the taskwait directive at line 46 only waits for its child task (line 37-44) to complete. It does not wait for its descendant tasks (line 39-42). -Data Race Pairs, sum@47:7:W vs. sum@47:7:W +Data Race Pairs, psum[1]@41:10:W vs. psum[1]@47:13:R */ #include diff --git a/micro-benchmarks/DRB129-mergeable-taskwait-orig-no.c b/micro-benchmarks/DRB129-mergeable-taskwait-orig-no.c index bc6a699..c14f64d 100644 --- a/micro-benchmarks/DRB129-mergeable-taskwait-orig-no.c +++ b/micro-benchmarks/DRB129-mergeable-taskwait-orig-no.c @@ -12,7 +12,7 @@ * The created task will access different instances of the variable x if the task is not merged, * as x is firstprivate, but it will access the same variable x if the task is merged. It can * print two different values for x depending on the decisions taken by the implementation. - * Data Race Pairs, x@27:5:W vs. x@27:5:W + * No data race, but implementation-specific behavior for data scoping of x, x@27:5:W */ #include diff --git a/micro-benchmarks/DRB134-taskdep5-orig-omp45-yes.c b/micro-benchmarks/DRB134-taskdep5-orig-omp45-yes.c index eaca0fd..908e958 100644 --- a/micro-benchmarks/DRB134-taskdep5-orig-omp45-yes.c +++ b/micro-benchmarks/DRB134-taskdep5-orig-omp45-yes.c @@ -11,7 +11,7 @@ * by x with the in dependence type in the depend clause of the second task. Generating task * at the first taskwait only waits for the first child task to complete. The second taskwait * guarantees completion of the second task before y is accessed. If we access y before the - * second taskwait, there is a race condition at line 28:2 and 34:18. Data Race Pair, y@36:5:W vs. y@43:19:R + * second taskwait, there is a race condition at line 28:2 and 34:18. Data Race Pair, y-@36:5:W vs. y@44:19:R * */ @@ -27,13 +27,13 @@ void foo(){ #pragma omp task depend(inout: x) shared(x, sem) { SIGNAL(sem); - x++; // 1st child task + x++; // 1st child task } #pragma omp task depend(in: x) depend(inout: y) shared(x, y, sem) { SIGNAL(sem); - y -= x; //2nd child task + y -= x; //2nd child task } WAIT(sem, 2); diff --git a/micro-benchmarks/DRB134b-taskdep5-orig-omp45-yes.c b/micro-benchmarks/DRB134b-taskdep5-orig-omp45-yes.c index 7588363..8977755 100644 --- a/micro-benchmarks/DRB134b-taskdep5-orig-omp45-yes.c +++ b/micro-benchmarks/DRB134b-taskdep5-orig-omp45-yes.c @@ -11,7 +11,7 @@ * by x with the in dependence type in the depend clause of the second task. Generating task * at the first taskwait only waits for the first child task to complete. The second taskwait * guarantees completion of the second task before y is accessed. If we access y before the - * second taskwait, there is a race condition at line 36 ann 44. Data Race Pair, y@36:5:W vs. y@44:19:R + * second taskwait, there is a race condition at line 36 ann 44. Data Race Pair, y-@36:5:W vs. y@43:19:R * */ diff --git a/micro-benchmarks/DRB136-taskdep-mutexinoutset-orig-yes.c b/micro-benchmarks/DRB136-taskdep-mutexinoutset-orig-yes.c index c19dba9..d1755f0 100644 --- a/micro-benchmarks/DRB136-taskdep-mutexinoutset-orig-yes.c +++ b/micro-benchmarks/DRB136-taskdep-mutexinoutset-orig-yes.c @@ -9,7 +9,12 @@ /* Due to the missing mutexinoutset dependence type on c, these tasks will execute in any - * order leading to the data race at line 36. Data Race Pair, d@36:7:W vs. d@36:7:W + * order leading to the data race at line 36. + * Data Race Pair, c@32:7:W vs. c+@41:7:W + c@32:7:W vs. c+@47:7:W + c+@41:7:W vs. c+@47:7:W + c+@41:7:W vs. c@50:11:W + c+@47:7:W vs. c@50:11:W * */ diff --git a/micro-benchmarks/DRB136b-taskdep-mutexinoutset-orig-yes.c b/micro-benchmarks/DRB136b-taskdep-mutexinoutset-orig-yes.c index 58c0a21..adb97c6 100644 --- a/micro-benchmarks/DRB136b-taskdep-mutexinoutset-orig-yes.c +++ b/micro-benchmarks/DRB136b-taskdep-mutexinoutset-orig-yes.c @@ -10,9 +10,9 @@ /* Due to the missing mutexinoutset dependence type on c, these tasks will execute in any * order leading to the data race at line 36. Data Race Pair, - c@35:7:W vs. c@35:7:W - c@35:7:W vs. c@39:11:R - c@37:7:W vs. c@39:11:R + c+@48:7:W vs. c+@53:7:W + c+@48:7:W vs. c@58:11:R + c+@53:7:W vs. c@58:11:R * */ diff --git a/micro-benchmarks/DRB156-missingordered-orig-gpu-yes.c b/micro-benchmarks/DRB156-missingordered-orig-gpu-yes.c index 93b65c8..8b1f900 100644 --- a/micro-benchmarks/DRB156-missingordered-orig-gpu-yes.c +++ b/micro-benchmarks/DRB156-missingordered-orig-gpu-yes.c @@ -8,7 +8,7 @@ */ /*This example is referred from DRACC by Adrian Schmitz et al. -Missing ordered directive causes data race pairs var@28:5:W vs. var@28:13:R +Missing ordered directive causes data race pairs var[i]@28:5:W vs. var[i-1]@28:12:R */ #include diff --git a/micro-benchmarks/DRB157-missingorderedsimd-orig-gpu-yes.c b/micro-benchmarks/DRB157-missingorderedsimd-orig-gpu-yes.c index b1ab176..9710ba9 100644 --- a/micro-benchmarks/DRB157-missingorderedsimd-orig-gpu-yes.c +++ b/micro-benchmarks/DRB157-missingorderedsimd-orig-gpu-yes.c @@ -11,7 +11,7 @@ This kernel is modified version from “DataRaceOnAccelerator A Micro-benchmark Suite for Evaluating Correctness Tools Targeting Accelerators” by Adrian Schmitz et al. Due to distribute parallel for simd directive at line 31, there is a data race at line 33. -Data Rae Pairs, var@33:5:W vs. var@33:12:R +Data Rae Pairs, var[i]@33:5:W vs. var[i-C]@33:12:R .*/ #include diff --git a/micro-benchmarks/DRB161-nolocksimd-orig-gpu-yes.c b/micro-benchmarks/DRB161-nolocksimd-orig-gpu-yes.c index a2d6dc9..a5e86b8 100644 --- a/micro-benchmarks/DRB161-nolocksimd-orig-gpu-yes.c +++ b/micro-benchmarks/DRB161-nolocksimd-orig-gpu-yes.c @@ -10,7 +10,7 @@ /* This example is from DRACC by Adrian Schmitz et al. Concurrent access on a counter with no lock with simd. Atomicity Violation. Intra Region. -Data Race Pairs: var@33:7:W vs. var@33:7:W +Data Race Pairs: var[i]@33:7:W vs. var[i]@33:7:W */ #include diff --git a/micro-benchmarks/DRB164-simdmissinglock1-orig-gpu-yes.c b/micro-benchmarks/DRB164-simdmissinglock1-orig-gpu-yes.c index 4304d1e..4101f1b 100644 --- a/micro-benchmarks/DRB164-simdmissinglock1-orig-gpu-yes.c +++ b/micro-benchmarks/DRB164-simdmissinglock1-orig-gpu-yes.c @@ -11,7 +11,7 @@ This kernel is referred from “DataRaceOnAccelerator A Micro-benchmark Suite for Evaluating Correctness Tools Targeting Accelerators” by Adrian Schmitz et al. Concurrent access of var@35:7 without acquiring locks causes atomicity violation. Data race present. -Data Race Pairs, var@35:7:W vs. var@35:7:W +Data Race Pairs, var[i]@35:7:W vs. var[i]@35:7:W */ #include diff --git a/micro-benchmarks/DRB173-non-sibling-taskdep-yes.c b/micro-benchmarks/DRB173-non-sibling-taskdep-yes.c index 661fe87..d7a6b70 100644 --- a/micro-benchmarks/DRB173-non-sibling-taskdep-yes.c +++ b/micro-benchmarks/DRB173-non-sibling-taskdep-yes.c @@ -12,7 +12,7 @@ for details. * Data race between non-sibling tasks with declared task dependency * Derived from code in https://hal.archives-ouvertes.fr/hal-02177469/document, * Listing 1.1 - * Data Race Pair, a@30:7:W vs. a@36:7:W + * Data Race Pair, a@32:9:W vs. a@42:9:W * */ #include diff --git a/micro-benchmarks/DRB175-non-sibling-taskdep2-yes.c b/micro-benchmarks/DRB175-non-sibling-taskdep2-yes.c index e44ca1f..bf05d3b 100644 --- a/micro-benchmarks/DRB175-non-sibling-taskdep2-yes.c +++ b/micro-benchmarks/DRB175-non-sibling-taskdep2-yes.c @@ -14,7 +14,7 @@ for details. * Derived from code in https://hal.archives-ouvertes.fr/hal-02177469/document, * Listing 1.3 * Schedule forced to execute all tasks by different threads. - * Data Race Pair, a@32:8:W vs. a@32:8:W + * Data Race Pair, a@33:7:W vs. a@33:7:W * */ #include diff --git a/micro-benchmarks/DRB175b-non-sibling-taskdep2-yes.c b/micro-benchmarks/DRB175b-non-sibling-taskdep2-yes.c index 9c65c85..832261a 100644 --- a/micro-benchmarks/DRB175b-non-sibling-taskdep2-yes.c +++ b/micro-benchmarks/DRB175b-non-sibling-taskdep2-yes.c @@ -14,7 +14,7 @@ for details. * Derived from code in https://hal.archives-ouvertes.fr/hal-02177469/document, * Listing 1.3 * Schedule encouraged to execute all tasks by thread 0. - * Data Race Pair, a@28:6:W vs. a@28:6:W + * Data Race Pair, a@32:7:W vs. a@32:7:W * */ #include diff --git a/micro-benchmarks/DRB177-fib-taskdep-yes.c b/micro-benchmarks/DRB177-fib-taskdep-yes.c index bc53827..abe8314 100644 --- a/micro-benchmarks/DRB177-fib-taskdep-yes.c +++ b/micro-benchmarks/DRB177-fib-taskdep-yes.c @@ -11,7 +11,7 @@ for details. /* * Fibonacci code with data race (possible to scale problem size by providing * size argument). - * Data Race Pair, i@25:5:W vs. i@29:7:R + * Data Race Pair, i@25:5:W vs. i@29:9:R * */ #include @@ -22,17 +22,11 @@ int fib(int n) { if (n < 2) return n; #pragma omp task shared(i) depend(out : i) - { i = fib(n - 1); - } #pragma omp task shared(j) depend(out : j) - { j = fib(n - 2); - } #pragma omp task shared(i, j, s) depend(in : j) - { s = i + j; - } #pragma omp taskwait return s; } diff --git a/micro-benchmarks/DRB177b-fib-taskdep-yes.c b/micro-benchmarks/DRB177b-fib-taskdep-yes.c index b1211c4..a13c406 100644 --- a/micro-benchmarks/DRB177b-fib-taskdep-yes.c +++ b/micro-benchmarks/DRB177b-fib-taskdep-yes.c @@ -11,7 +11,7 @@ for details. /* * Fibonacci code with data race (possible to scale problem size by providing * size argument). - * Data Race Pair, i@25:5:W vs. i@29:7:R + * Data Race Pair, i@28:5:W vs. i@32:9:R * */ #include @@ -25,17 +25,11 @@ int fib(int n) { if (n < 2) return n; #pragma omp task shared(i, sem) depend(out : i) - { i = fib(n - 1); - } #pragma omp task shared(j, sem) depend(out : j) - { j = fib(n - 2); - } #pragma omp task shared(i, j, s, sem) depend(in : j) - { s = i + j; - } #pragma omp taskwait return s; } diff --git a/micro-benchmarks/DRB180-miniAMR-yes.c b/micro-benchmarks/DRB180-miniAMR-yes.c index 4206d6c..8f50bbc 100644 --- a/micro-benchmarks/DRB180-miniAMR-yes.c +++ b/micro-benchmarks/DRB180-miniAMR-yes.c @@ -10,15 +10,22 @@ for details. /* Simplified miniAMR proxy app to reproduce data race behavior. - Data Race Pair, in@60:43:R vs. in@52:43:W - work@65:19@W vs. work@65:19@W - bp->array@65:36@R vs. bp->array@75:19@W - bp->array@66:36@R vs. bp->array@75:19@W - bp->array@67:36@R vs. bp->array@75:19@W - bp->array@68:36@R vs. bp->array@75:19@W - bp->array@69:36@R vs. bp->array@75:19@W - bp->array@70:36@R vs. bp->array@75:19@W - bp->array@71:36@R vs. bp->array@75:19@W + Data Race Pair, in@67:43:W vs. in@67:43:W + in@67:12:W vs. in@67:43:W + in@67:12:W vs. in@67:12:W + in@67:12:W vs. in@67:20:R + in@67:43:W vs. in@67:20:R + in@67:12:W vs. in@68:23:R + in@67:43:W vs. in@68:23:R + work[i][j][k]@72:19:W vs. work[i][j][k]@72:19:W + work[i][j][k]@72:19:W vs. work[i][j][k]@82:45:R + bp->array[var][i-1][j ][k ]@72:36:R vs. bp->array[var][i][j][k]@82:19:W + bp->array[var][i-1][j ][k ]@73:36:R vs. bp->array[var][i][j][k]@82:19:W + bp->array[var][i-1][j ][k ]@74:36:R vs. bp->array[var][i][j][k]@82:19:W + bp->array[var][i-1][j ][k ]@75:36:R vs. bp->array[var][i][j][k]@82:19:W + bp->array[var][i-1][j ][k ]@76:36:R vs. bp->array[var][i][j][k]@82:19:W + bp->array[var][i-1][j ][k ]@77:36:R vs. bp->array[var][i][j][k]@82:19:W + bp->array[var][i-1][j ][k ]@78:36:R vs. bp->array[var][i][j][k]@82:19:W */ #include @@ -55,7 +62,7 @@ void stencil_calc(int var, int stencil_in) int tid; -#pragma omp parallel default(shared) private(i, j, k, bp) +#pragma omp parallel for default(shared) private(i, j, k, bp) { for (in = 0; in < max_num_blocks; ++in) { bp = &blocks[in]; diff --git a/micro-benchmarks/DRB183-atomic3-yes.c b/micro-benchmarks/DRB183-atomic3-yes.c index 926f59a..a053fdf 100644 --- a/micro-benchmarks/DRB183-atomic3-yes.c +++ b/micro-benchmarks/DRB183-atomic3-yes.c @@ -13,7 +13,8 @@ * Wenhao Wu and Stephen F. Siegel @Univ. of Delaware. * Race because the write to s is not protected by atomic - * Data race pair: s@26:7:W vs. s@34:16:R + * Data race pair: s@27:7:W vs. s@35:16:R + * x@26:7:W vs. x@37:7:W */ int main() { diff --git a/micro-benchmarks/DRB185-barrier1-yes.c b/micro-benchmarks/DRB185-barrier1-yes.c index aaebbf5..7784234 100644 --- a/micro-benchmarks/DRB185-barrier1-yes.c +++ b/micro-benchmarks/DRB185-barrier1-yes.c @@ -12,7 +12,11 @@ * Wenhao Wu and Stephen F. Siegel @Univ. of Delaware. * wrong 2-thread flag barrier using busy-waits, race - * Data race pair: x@85:9:W vs. x@92:9:W + * Data race pair: x@89:9:W vs. x@96:9:W + * x@84:58:R vs. x@89:9:W + * x@89:9:W vs. x@91:58:R + * x@91:58:R vs. x@96:9:W + * x@84:58:R vs. x@96:9:W */ #include diff --git a/micro-benchmarks/DRB189-barrier3-no.c b/micro-benchmarks/DRB189-barrier3-no.c index ea8e57b..69b7247 100644 --- a/micro-benchmarks/DRB189-barrier3-no.c +++ b/micro-benchmarks/DRB189-barrier3-no.c @@ -11,9 +11,7 @@ * This is a program based on a dataset contributed by * Wenhao Wu and Stephen F. Siegel @Univ. of Delaware. - * one synchronization commented out. - * enters. So race on x can occur. - * Data race pair: x@104:9:W vs. x@111:9:W + * No data race. */ #include diff --git a/micro-benchmarks/DRB191-critical-section2-yes.c b/micro-benchmarks/DRB191-critical-section2-yes.c index c3f95f3..8c5f923 100644 --- a/micro-benchmarks/DRB191-critical-section2-yes.c +++ b/micro-benchmarks/DRB191-critical-section2-yes.c @@ -12,7 +12,9 @@ * Wenhao Wu and Stephen F. Siegel @Univ. of Delaware. * Race due to different critical section names - * Data race pair: size@34:11:W vs. size@49:11:W + * Data race pair: size@36:11:W vs. size@51:11:W + size@34:13:R vs. size@51:11:W + size@36:11:W vs. size@49:13:R */ #include diff --git a/micro-benchmarks/DRB199-prodcons-yes.c b/micro-benchmarks/DRB199-prodcons-yes.c index efc3244..d5e209e 100644 --- a/micro-benchmarks/DRB199-prodcons-yes.c +++ b/micro-benchmarks/DRB199-prodcons-yes.c @@ -12,7 +12,9 @@ * Wenhao Wu and Stephen F. Siegel @Univ. of Delaware. * race introduced because critical sections have different names for producer and consumer. - * Data race pair: size@34:11:W vs. size@45:11:W + * Data race pair: size@35:11:W vs. size@47:11:W + size@33:13:R vs. size@47:11:W + size@35:11:W vs. size@45:13:R */ #include diff --git a/micro-benchmarks/DRB201-sync1-yes.c b/micro-benchmarks/DRB201-sync1-yes.c index b0e9097..f137bcc 100644 --- a/micro-benchmarks/DRB201-sync1-yes.c +++ b/micro-benchmarks/DRB201-sync1-yes.c @@ -12,7 +12,7 @@ * Wenhao Wu and Stephen F. Siegel @Univ. of Delaware. * Thread with id 1 acquires and releases the lock, but then it modifies x without holding it. - * Data race pair: size@35:7:W vs. size@42:7:W + * Data race pair: x@37:7:W vs. x@45:7:W */ #include diff --git a/micro-benchmarks/DRB201b-sync1-yes.c b/micro-benchmarks/DRB201b-sync1-yes.c index 1ae2007..35c331c 100644 --- a/micro-benchmarks/DRB201b-sync1-yes.c +++ b/micro-benchmarks/DRB201b-sync1-yes.c @@ -12,7 +12,7 @@ * Wenhao Wu and Stephen F. Siegel @Univ. of Delaware. * Thread with id 1 acquires and releases the lock, but then it modifies x without holding it. - * Data race pair: size@35:7:W vs. size@42:7:W + * Data race pair: x@37:7:W vs. x@45:7:W */ #include