1.23
2.0
acw/focus-triggers
main
test-branch
| Line | |
|---|
| 1 | !!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
|
|---|
| 2 | !!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC
|
|---|
| 3 | !!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details.
|
|---|
| 4 | !!!
|
|---|
| 5 | !!! SPDX-License-Identifier: (BSD-3-Clause)
|
|---|
| 6 | !!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
|
|---|
| 7 |
|
|---|
| 8 | !This benchmark is extracted from flush_nolist.1c of OpenMP Application
|
|---|
| 9 | !Programming Interface Examples Version 4.5.0 .
|
|---|
| 10 | !We added one critical section to make it a test with only one pair of data races.
|
|---|
| 11 | !The data race will not generate wrong result though. So the assertion always passes.
|
|---|
| 12 | !Data race pair: i@37:13 vs. i@38:15
|
|---|
| 13 |
|
|---|
| 14 | module DRB074
|
|---|
| 15 | use omp_lib
|
|---|
| 16 | implicit none
|
|---|
| 17 | contains
|
|---|
| 18 | subroutine f1(q)
|
|---|
| 19 | integer :: q
|
|---|
| 20 | !$omp critical
|
|---|
| 21 | q = 1
|
|---|
| 22 | !$omp end critical
|
|---|
| 23 | !$omp flush
|
|---|
| 24 | end subroutine
|
|---|
| 25 | end module
|
|---|
| 26 |
|
|---|
| 27 | program DRB074_flush_orig_yes
|
|---|
| 28 | use omp_lib
|
|---|
| 29 | use DRB074
|
|---|
| 30 | implicit none
|
|---|
| 31 |
|
|---|
| 32 | integer :: i, sum
|
|---|
| 33 | i = 0
|
|---|
| 34 | sum = 0
|
|---|
| 35 |
|
|---|
| 36 | !$omp parallel reduction(+:sum) num_threads(10)
|
|---|
| 37 | call f1(i)
|
|---|
| 38 | sum = sum+i
|
|---|
| 39 | !$omp end parallel
|
|---|
| 40 |
|
|---|
| 41 | if (sum /= 10) then
|
|---|
| 42 | print*,'sum =',sum
|
|---|
| 43 | end if
|
|---|
| 44 | end program
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.