source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB121-reduction-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!Number of threads is empirical: We need enough threads so that
9!the reduction is really performed hierarchically in the barrier!
10!There is no data race.
11
12program DRB121_reduction_orig_no
13 use omp_lib
14 implicit none
15
16 integer :: var, i, sum1, sum2
17
18 var = 0
19 sum1 = 0
20 sum2 = 0
21
22 !$omp parallel reduction(+: var)
23 !$omp do schedule(static) reduction(+: sum1)
24 do i = 1, 5
25 sum1 = sum1+i
26 end do
27 !$omp end do
28
29 !$omp do schedule(static) reduction(+: sum2)
30 do i = 1, 5
31 sum2 = sum2+i
32 end do
33 !$omp end do
34
35 var = sum1 + sum2
36 !$omp end parallel
37
38 print 100, var
39 100 format ('var =',3i8)
40end program
Note: See TracBrowser for help on using the repository browser.