source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB106-taskwaitmissing-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.4 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!* This is a program based on a test contributed by Yizi Gu@Rice Univ.
9! * Classic Fibonacci calculation using task but missing taskwait.
10! * Data races pairs: i@29:13 vs i@34:17
11! * j@32:13 vs j@34:19
12
13!check on the unsgined part
14
15module DRB106
16 implicit none
17 integer (kind=4) input
18
19contains
20 recursive function fib(n) result(r)
21 use omp_lib
22 implicit none
23 integer (kind=4) :: n, i, j, r
24
25 if (n<2) then
26 r = n
27 else
28 !$omp task shared(i)
29 i = fib(n-1)
30 !$omp end task
31 !$omp task shared(j)
32 j = fib(n-2)
33 !$omp end task
34 r = i+j
35 end if
36 !$omp taskwait
37 end function
38end module
39
40program DRB106_taskwaitmissing_orig_yes
41 use omp_lib
42 use DRB106
43 implicit none
44
45 integer :: result
46 input = 30
47
48 !$omp parallel
49 !$omp single
50 result = fib(input)
51 !$omp end single
52 !$omp end parallel
53
54 print*,'Fib for ',input,' =',result
55
56end program
Note: See TracBrowser for help on using the repository browser.