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

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since cc8e265 was e3f356c, checked in by Wenhao Wu <wuwenhao@…>, 5 years ago

merge from branch omptrans for tacas2022

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5471 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.