source: CIVL/mods/dev.civl.com/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB002-antidep1-var-yes.f95@ cb4d4f4

1.23 2.0 main test-branch
Last change on this file since cb4d4f4 was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5664 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100755
File size: 2.0 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]@60:9 vs. a[i]@60:16
10
11!!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -!!
12!! NOTE by WenhaoWu (wuwenhao@udel.edu) !!
13!! This example is modified so that the bound can be adjusted !!
14!! by defining 'N' and if it is not defined then the bound value !!
15!! in the original example is used as the default value of 'N' !!
16!!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -!!
17
18#ifndef N
19#define N 10
20#endif
21
22program DRB002_antidep1_var_yes
23 use omp_lib
24 implicit none
25 integer :: i, len, argCount, allocStatus, rdErr, ix
26 character(len=80), dimension(:), allocatable :: args
27 integer, dimension (:), allocatable :: a
28 len = N
29
30 argCount = command_argument_count()
31 if (argCount == 0) then
32 write (*,'(a)') "No command line arguments provided."
33 end if
34
35 allocate(args(argCount), stat=allocStatus)
36 if (allocStatus > 0) then
37 write (*,'(a)') "Allocation error, program terminated."
38 stop
39 end if
40
41 do ix = 1, argCount
42 call get_command_argument(ix,args(ix))
43 end do
44
45 if (argCount >= 1) then
46 read (args(1), '(i10)', iostat=rdErr) len
47 if (rdErr /= 0 ) then
48 write (*,'(a)') "Error, invalid integer value."
49 end if
50 end if
51
52 allocate (a(len))
53
54 do i = 1, len
55 a(i) = i
56 end do
57
58 !$omp parallel do
59 do i = 1, len-1
60 a(i) = a(i+1)+1
61 end do
62 !$omp end parallel do
63
64 deallocate(a)
65 deallocate(args)
66
67end program
Note: See TracBrowser for help on using the repository browser.