54 lines · plain
1! REQUIRES: flang, amdgpu2 3! RUN: %libomptarget-compile-fortran-generic -fdo-concurrent-to-openmp=device4! RUN: env LIBOMPTARGET_INFO=16 %libomptarget-run-generic 2>&1 | %fcheck-generic5module saxpymod6 use iso_fortran_env7 public :: saxpy8contains9 10subroutine saxpy(a, x, y, n)11 use iso_fortran_env12 implicit none13 integer,intent(in) :: n14 real(kind=real32),intent(in) :: a15 real(kind=real32), dimension(:),intent(in) :: x16 real(kind=real32), dimension(:),intent(inout) :: y17 integer :: i18 19 do concurrent(i=1:n)20 y(i) = a * x(i) + y(i)21 end do22 23 write(*,*) "plausibility check:"24 write(*,'("y(1) ",f8.6)') y(1)25 write(*,'("y(n) ",f8.6)') y(n)26end subroutine saxpy27 28end module saxpymod29 30program main31 use iso_fortran_env32 use saxpymod, ONLY:saxpy33 implicit none34 35 integer,parameter :: n = 1000000036 real(kind=real32), allocatable, dimension(:) :: x, y37 real(kind=real32) :: a38 integer :: i39 40 allocate(x(1:n), y(1:n))41 a = 2.0_real3242 x(:) = 1.0_real3243 y(:) = 2.0_real3244 45 call saxpy(a, x, y, n)46 47 deallocate(x,y)48end program main49 50! CHECK: "PluginInterface" device {{[0-9]+}} info: Launching kernel {{.*}}51! CHECK: plausibility check:52! CHECK: y(1) 4.053! CHECK: y(n) 4.054