source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB021-reductionmissing-orig-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.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!A kernel with two level parallelizable loop with reduction:
9!if reduction(+:sum) is missing, there is race condition.
10!Data race pairs: we allow multiple pairs to preserve the pattern.
11! sum@37"13 vs. sum@37:13
12! sum@37:13 vs. sum@37:22
13
14program DRB021_reductionmissing_orig_yes
15 use omp_lib
16 implicit none
17
18 integer :: i, j, len
19 real :: temp, getSum
20 real, dimension (:,:), allocatable :: u
21
22 len = 100
23 getSum = 0.0
24
25 allocate (u(len, len))
26
27 do i = 1, len
28 do j = 1, len
29 u(i,j) = 0.5
30 end do
31 end do
32
33 !$omp parallel do private(temp, i, j)
34 do i = 1, len
35 do j = 1, len
36 temp = u(i,j)
37 getSum = getSum + temp * temp
38 end do
39 end do
40 !$omp end parallel do
41
42 print*,"sum =", getSum
43 deallocate(u)
44end program
Note: See TracBrowser for help on using the repository browser.