source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB017-outputdep-var-yes.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.6 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!The loop in this example cannot be parallelized.
9!
10!Data race pairs: we allow two pairs to preserve the original code pattern.
11! 1. x@50 vs. x@51
12! 2. x@51 vs. x@51
13
14program DRB017_outputdep_var_yes
15 use omp_lib
16 implicit none
17
18 integer len, i, x, argCount, allocStatus, rdErr, ix
19 character(len=80), dimension(:), allocatable :: args
20 integer, dimension (:), allocatable :: a
21
22 len = 100
23 x = 10
24
25 argCount = command_argument_count()
26 if (argCount == 0) then
27 write (*,'(a)') "No command line arguments provided."
28 end if
29
30 allocate(args(argCount), stat=allocStatus)
31 if (allocStatus > 0) then
32 write (*,'(a)') "Allocation error, program terminated."
33 stop
34 end if
35
36 do ix = 1, argCount
37 call get_command_argument(ix,args(ix))
38 end do
39
40 if (argCount >= 1) then
41 read (args(1), '(i10)', iostat=rdErr) len
42 if (rdErr /= 0 ) then
43 write (*,'(a)') "Error, invalid integer value."
44 end if
45 end if
46
47 allocate (a(len))
48 !$omp parallel do
49 do i = 1, len
50 a(i) = x
51 x = i
52 end do
53 !$omp end parallel do
54
55 print 100, x, a(0)
56 100 format ("x=",i3,2x,"a(0)=",i3)
57
58 deallocate(args,a)
59end program
Note: See TracBrowser for help on using the repository browser.