source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB076-flush-orig-no.f95

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.1 KB
RevLine 
[e3f356c]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
9!Application Programming Interface Examples Version 4.5.0 .
10!
11!We privatize variable i to fix data races in the original example.
12!Once i is privatized, flush is no longer needed. No data race pairs.
13
14module DRB076
15 use omp_lib
16 implicit none
17contains
18 subroutine f1(q)
19 integer :: q
20 q = 1
21 end subroutine
22end module
23
24program DRB076_flush_orig_no
25 use omp_lib
26 use DRB076
27 implicit none
28
29 integer :: i, sum
30 i = 0
31 sum = 0
32
33 !$omp parallel reduction(+:sum) num_threads(10) private(i)
34 call f1(i)
35 sum = sum + i
36 !$omp end parallel
37
38 if (sum /= 10) then
39 print*,'sum =',sum
40 end if
41end program
Note: See TracBrowser for help on using the repository browser.