forked from OpenMP/Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample_async_target.4.f90
More file actions
43 lines (32 loc) · 888 Bytes
/
Example_async_target.4.f90
File metadata and controls
43 lines (32 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
! @@name: target.4f90
! @@type: F-free
! @@compilable: yes
! @@linkable: no
! @@expect: success
subroutine vec_mult(N)
implicit none
integer :: i, N
real, allocatable :: p(:), v1(:), v2(:)
allocate( p(N), v1(N), v2(N) )
!$omp parallel num_threads(2)
!$omp single
!$omp task depend(out:v1)
call init(v1, N)
!$omp end task
!$omp task depend(out:v2)
call init(v2, N)
!$omp end task
!$omp target nowait depend(in:v1,v2) depend(out:p) &
!$omp& map(to:v1,v2) map(from: p)
!$omp parallel do
do i=1,N
p(i) = v1(i) * v2(i)
end do
!$omp end target
!$omp task depend(in:p)
call output(p, N)
!$omp end task
!$omp end single
!$omp end parallel
deallocate( p, v1, v2 )
end subroutine