5 subroutine init (v1
, v2
, N
)
7 real, pointer, dimension(:) :: v1
, v2
14 subroutine check (p
, N
)
16 real, parameter :: EPS
= 0.00001
17 real, pointer, dimension(:) :: p
19 diff
= p(i
) - (i
+ 2.0) * (i
- 3.0)
20 if (diff
> EPS
.or
. -diff
> EPS
) STOP 1
24 subroutine vec_mult_1 (p
, v1
, v2
, N
)
26 real, pointer, dimension(:) :: p
, v1
, v2
27 !$omp target map(to: v1(1:N), v2(:N)) map(from: p(1:N))
35 subroutine vec_mult_2 (p
, v1
, v2
, N
)
36 real, dimension(*) :: p
, v1
, v2
38 !$omp target map(to: v1(1:N), v2(:N)) map(from: p(1:N))
48 use e_50_4_mod
, only
: init
, check
, vec_mult_1
, vec_mult_2
49 real, pointer, dimension(:) :: p1
, p2
, v1
, v2
52 allocate (p1(n
), p2(n
), v1(n
), v2(n
))
54 call vec_mult_1 (p1
, v1
, v2
, n
)
55 call vec_mult_2 (p2
, v1
, v2
, n
)
58 deallocate (p1
, p2
, v1
, v2
)