main
|
Last change
on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100755
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | !!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
|
|---|
| 3 | !!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC
|
|---|
| 4 | !!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details.
|
|---|
| 5 | !!!
|
|---|
| 6 | !!! SPDX-License-Identifier: (BSD-3-Clause)
|
|---|
| 7 | !!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 | /* Due to the missing mutexinoutset dependence type on c, these tasks will execute in any
|
|---|
| 12 | * order leading to the data race at line 36. Data Race Pair, d@36:7 and d@36:7
|
|---|
| 13 | * */
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 | #include <stdio.h>
|
|---|
| 17 | #include <omp.h>
|
|---|
| 18 |
|
|---|
| 19 | int main(){
|
|---|
| 20 | int a, b, c, d;
|
|---|
| 21 |
|
|---|
| 22 | #pragma omp parallel
|
|---|
| 23 | #pragma omp single
|
|---|
| 24 | {
|
|---|
| 25 | #pragma omp task depend(out: c)
|
|---|
| 26 | c = 1;
|
|---|
| 27 | #pragma omp task depend(out: a)
|
|---|
| 28 | a = 2;
|
|---|
| 29 | #pragma omp task depend(out: b)
|
|---|
| 30 | b = 3;
|
|---|
| 31 | #pragma omp task depend(in: a)
|
|---|
| 32 | c += a;
|
|---|
| 33 | #pragma omp task depend(in: b)
|
|---|
| 34 | c += b;
|
|---|
| 35 | #pragma omp task depend(in: c)
|
|---|
| 36 | d = c;
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | printf("%d\n",d);
|
|---|
| 40 | return 0;
|
|---|
| 41 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.