source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB059-lastprivate-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
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!Using lastprivate() to resolve an output dependence.
9!
10!Semantics of lastprivate (x):
11!causes the corresponding original list item to be updated after the end of the region.
12!The compiler/runtime copies the local value back to the shared one within the last iteration.
13
14
15program DRB059_lastprivate_orig_no
16 use omp_lib
17 implicit none
18 !$omp parallel
19 call foo()
20 !$omp end parallel
21contains
22 subroutine foo()
23 integer :: i, x
24 !$omp parallel do private(i) lastprivate(x)
25 do i = 1, 100
26 x = i
27 end do
28 !$omp end parallel do
29 print 100, x
30 100 format ("x =",i3)
31 end subroutine foo
32end program
Note: See TracBrowser for help on using the repository browser.