mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
22 lines
660 B
Fortran
22 lines
660 B
Fortran
! @@name: teams.3f
|
|
! @@type: F-free
|
|
! @@compilable: yes
|
|
! @@linkable: no
|
|
! @@expect: success
|
|
function dotprod(B,C,N) result(sum)
|
|
real :: B(N), C(N), sum
|
|
integer :: N, i
|
|
sum = 0.0e0
|
|
!$omp target teams map(to: B, C) &
|
|
!$omp& defaultmap(tofrom:scalar) reduction(+:sum)
|
|
!$omp distribute parallel do reduction(+:sum)
|
|
do i = 1,N
|
|
sum = sum + B(i) * C(i)
|
|
end do
|
|
!$omp end target teams
|
|
end function
|
|
|
|
! Note: The variable sum is now mapped with tofrom from the defaultmap
|
|
! clause on the combined target teams construct, for correct
|
|
! execution with 4.5 (and pre-4.5) compliant compilers. See Devices Intro.
|