source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB098-simd2-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.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!Two-dimension array computation with a vetorization directive
9!collapse(2) makes simd associate with 2 loops.
10!Loop iteration variables should be predetermined as lastprivate. No data race pairs.
11
12program DRB098_simd2_orig_no
13 use omp_lib
14 implicit none
15
16 integer, parameter :: dp = kind(1.0d0)
17 real(dp), dimension(:,:), allocatable :: a,b,c
18 integer :: len, i, j
19
20 len = 100
21 allocate (a(len,len))
22 allocate (b(len,len))
23 allocate (c(len,len))
24
25 do i = 1, len
26 do j = 1, len
27 a(i,j) = real(i,dp)/2.0
28 b(i,j) = real(i,dp)/3.0
29 c(i,j) = real(i,dp)/7.0
30 end do
31 end do
32
33 !$omp simd collapse(2)
34 do i = 1, len
35 do j = 1, len
36 c(i,j)=a(i,j)*b(i,j)
37 end do
38 end do
39 !$omp end simd
40
41 print*,'c(50,50) =',c(50,50)
42
43 deallocate(a,b,c)
44end program
Note: See TracBrowser for help on using the repository browser.