source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB126-firstprivatesections-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.3 KB
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 example is based on fpriv_sections.1.c OpenMP Examples 5.0.0
9!The section construct modifies the value of section_count which breaks the independence of the
10!section constructs. If the same thread executes both the section one will print 1 and the other
11!will print 2. For a same thread execution, there is no data race.
12
13program DRB126_firstprivatesections_orig_no
14 use omp_lib
15 implicit none
16
17 integer :: section_count
18
19 section_count = 0
20
21 call omp_set_dynamic(.FALSE.)
22 call omp_set_num_threads(1)
23
24 !$omp parallel
25 !$omp sections firstprivate( section_count )
26 !$omp section
27 section_count = section_count+1
28 print 100, section_count
29 100 format ('section_count =',3i8)
30
31 !$omp section
32 section_count = section_count+1
33 print 101, section_count
34 101 format ('section_count =',3i8)
35 !$omp end sections
36 !$omp end parallel
37end program
Note: See TracBrowser for help on using the repository browser.