1
0
mirror of https://github.com/OpenMP/Examples.git synced 2025-04-07 15:12:11 +01:00
OpenMP-Examples/sources/Example_async_target.1f.f
2015-01-13 11:38:24 -08:00

39 lines
709 B
Fortran

! @@name: async_target.1f
! @@type: F-free
! @@compilable: yes
! @@linkable: no
! @@expect: success
module parameters
integer, parameter :: N=1000000000, CHUNKSZ=1000000
end module
subroutine pipedF()
use parameters, ONLY: N, CHUNKSZ
integer :: C, i
real :: z(N)
interface
function F(z)
!$omp declare target
real, intent(IN) ::z
real ::F
end function F
end interface
call init(z,N)
do C=1,N,CHUNKSZ
!$omp task
!$omp target map(z(C:C+CHUNKSZ-1))
!$omp parallel do
do i=C,C+CHUNKSZ-1
z(i) = F(z(i))
end do
!$omp end target
!$omp end task
end do
print*, z
end subroutine pipedF