source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB149-missingdata1-orig-gpu-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.2 KB
RevLine 
[e3f356c]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!Classic i-k-j matrix multiplication. No data race pairs.
9
10program DRB149_missingdata1_orig_gpu_no
11 use omp_lib
12 implicit none
13
14 integer :: len, i, j
15 integer, dimension(:), allocatable :: a, b, c
16
17 len = 100
18
19 allocate (a(len))
20 allocate (b(len+len*len))
21 allocate (c(len))
22
23 do i = 1, len
24 do j = 1, len
25 b(j+i*len)=1
26 end do
27 a(i) = 1
28 c(i) = 0
29 end do
30
31 !$omp target map(to:a,b) map(tofrom:c) device(0)
32 !$omp teams distribute parallel do
33 do i = 1, len
34 do j = 1, len
35 c(i) = c(i)+a(j)*b(j+i*len)
36 end do
37 end do
38 !$omp end teams distribute parallel do
39 !$omp end target
40
41 do i = 1, len
42 if (c(i)/=len) then
43 print*, c(i)
44 end if
45 end do
46
47 deallocate(a,b,c)
48end program
Note: See TracBrowser for help on using the repository browser.