mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-04 05:41:33 +01:00
21 lines
559 B
Fortran
21 lines
559 B
Fortran
! @@name: metadirective.2f90
|
|
! @@type: F-free
|
|
! @@compilable: yes, omp_5.0
|
|
! @@linkable: yes
|
|
! @@expect: success
|
|
|
|
program main
|
|
integer, parameter :: N= 100
|
|
integer :: v1(N), v2(N), v3(N);
|
|
|
|
do i=1,N; v1(i)=i; v2(i)=-i; enddo ! initialize
|
|
|
|
!$omp target map(to:v1,v2) map(from:v3) device(0)
|
|
!$omp metadirective &
|
|
!$omp& when( device={arch("nvptx")}: teams loop) &
|
|
!$omp& default( parallel loop)
|
|
do i= 1,N; v3(i) = v1(i) * v2(i); enddo
|
|
|
|
print *, v3(1),v3(N) !!output: -1 -10000
|
|
end program
|