source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB104-nowait-barrier-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!This example is based on one code snippet extracted from a paper:
9!Ma etc. Symbolic Analysis of Concurrency Errors in OpenMP Programs, ICPP 2013
10!
11!Explicit barrier to counteract nowait. No data race pairs.
12
13
14program DRB104_nowait_barrier_orig_no
15 use omp_lib
16 implicit none
17
18 integer i, error, len, b
19 integer, dimension(:), allocatable :: a
20
21 len = 1000
22 b = 5
23 allocate (a(len))
24
25 do i = 1, len
26 a(i) = i
27 end do
28
29 !$omp parallel shared(b, error)
30 !$omp do
31 do i = 1, len
32 a(i) = b+a(i)*5
33 end do
34 !$omp end do nowait
35 !$omp end parallel
36
37 !$omp barrier
38 !$omp single
39 error = a(9)+1
40 !$omp end single
41
42 print 100, error
43 100 format ('error =',3i8)
44
45 deallocate(a)
46end program
Note: See TracBrowser for help on using the repository browser.