3 function dotprod_ref (B
, C
, N
) result (sum
)
5 real :: B(N
), C(N
), sum
9 sum
= sum
+ B(i
) * C(i
)
13 function dotprod (B
, C
, N
) result(sum
)
14 real :: B(N
), C(N
), sum
17 !$omp target teams map(to: B, C) map(tofrom: sum) &
18 !$omp& reduction(+:sum)
19 !$omp distribute parallel do reduction(+:sum)
21 sum
= sum
+ B(i
) * C(i
)
23 !$omp end target teams
26 subroutine init (B
, C
, N
)
31 C(i
) = 0.000001 * i
* i
35 subroutine check (a
, b
)
37 real, parameter :: EPS
= 0.0001
40 else if (a
== 0.0) then
45 if (err
> EPS
.or
. err
< -EPS
) STOP 1
51 real, pointer, dimension(:) :: B
, C
55 ref
= dotprod_ref (B
, C
, n
)