source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB112-linear-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!omp for loop is allowed to use the linear clause, an OpenMP 4.5 addition. No data race pairs.
9
10program DRB112_linear_orig_no
11 use omp_lib
12 implicit none
13
14 integer len, i, j
15 integer, parameter :: dp = kind(1.0d0)
16 real(dp), dimension(:), allocatable :: a,b,c
17
18 len = 100
19 i = 0
20 j = 0
21
22 allocate (a(len))
23 allocate (b(len))
24 allocate (c(len))
25
26 do i = 1, len
27 a(i) = (real(i,dp))/2.0
28 b(i) = (real(i,dp))/3.0
29 c(i) = (real(i,dp))/7.0
30 end do
31
32 !$omp parallel do linear(j)
33 do i = 1, len
34 c(j) = c(j)+a(i)*b(i)
35 j = j+1
36 end do
37 !$omp end parallel do
38
39 !print*,'c(50) =',c(50)
40
41 if(allocated(a))deallocate(a)
42 if(allocated(b))deallocate(b)
43end program
Note: See TracBrowser for help on using the repository browser.