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

1.23 v1.23.0
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.2 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!Referred from worksharing_critical.1.f
9!A single thread executes the one and only section in the sections region, and executes the
10!critical region. The same thread encounters the nested parallel region, creates a new team
11!of threads, and becomes the master of the new team. One of the threads in the new team enters
12!the single region and increments i by 1. At the end of this example i is equal to 2.
13
14program DRB139_worksharingcritical_orig_no
15 use omp_lib
16 implicit none
17
18 integer :: i
19 i = 1
20
21 !$OMP PARALLEL SECTIONS
22 !$OMP SECTION
23 !$OMP CRITICAL (NAME)
24 !$OMP PARALLEL
25 !$OMP SINGLE
26 i = i + 1
27 !$OMP END SINGLE
28 !$OMP END PARALLEL
29 !$OMP END CRITICAL (NAME)
30 !$OMP END PARALLEL SECTIONS
31
32 print 100,i
33 100 format ("i = ", 3i8)
34end program
Note: See TracBrowser for help on using the repository browser.