source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB100-task-reference-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.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! * Cover the implicitly determined rule: In an orphaned task generating construct,
9! * formal arguments passed by reference are firstprivate.
10! * This requires OpenMP 4.5 to work.
11! * Earlier OpenMP does not allow a reference type for a variable within firstprivate().
12! * No data race pairs.
13
14
15module DRB100
16 implicit none
17 integer, dimension(:), allocatable :: a
18contains
19 subroutine gen_task(i)
20 use omp_lib
21 implicit none
22 integer :: i
23 !$omp task
24 a(i) = i+1
25 !$omp end task
26 end subroutine
27end module
28
29program DRB100_task_reference_orig_no
30 use omp_lib
31 use DRB100
32 implicit none
33
34 integer :: i
35 allocate (a(100))
36
37 !$omp parallel
38 !$omp single
39 do i = 1, 100
40 call gen_task(i)
41 end do
42 !$omp end single
43 !$omp end parallel
44
45 do i = 1, 100
46 if (a(i) /= i+1) then
47 print*,'warning: a(',i,') =',a(i),' not expected',i+1
48 end if
49! print*,a(i),i+1
50 end do
51end program
Note: See TracBrowser for help on using the repository browser.