source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/original/DRB002-antidep1-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.5 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!A loop with loop-carried anti-dependence.
9!Data race pair: a[i+1]@49:9 vs. a[i]@49:16
10
11program DRB002_antidep1_var_yes
12 use omp_lib
13 implicit none
14 integer :: i, len, argCount, allocStatus, rdErr, ix
15 character(len=80), dimension(:), allocatable :: args
16 integer, dimension (:), allocatable :: a
17 len = 1000
18
19 argCount = command_argument_count()
20 if (argCount == 0) then
21 write (*,'(a)') "No command line arguments provided."
22 end if
23
24 allocate(args(argCount), stat=allocStatus)
25 if (allocStatus > 0) then
26 write (*,'(a)') "Allocation error, program terminated."
27 stop
28 end if
29
30 do ix = 1, argCount
31 call get_command_argument(ix,args(ix))
32 end do
33
34 if (argCount >= 1) then
35 read (args(1), '(i10)', iostat=rdErr) len
36 if (rdErr /= 0 ) then
37 write (*,'(a)') "Error, invalid integer value."
38 end if
39 end if
40
41 allocate (a(len))
42
43 do i = 1, len
44 a(i) = i
45 end do
46
47 !$omp parallel do
48 do i = 1, len-1
49 a(i) = a(i+1)+1
50 end do
51 !$omp end parallel do
52
53 deallocate(a)
54 deallocate(args)
55
56end program
Note: See TracBrowser for help on using the repository browser.