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, m)11 use iso_fortran_env12 implicit none13 integer,intent(in) :: n, m14 real(kind=real32),intent(in) :: a15 real(kind=real32), dimension(:,:),intent(in) :: x16 real(kind=real32), dimension(:,:),intent(inout) :: y17 integer :: i, j18 19 do concurrent(i=1:n, j=1:m)20 y(i,j) = a * x(i,j) + y(i,j)21 end do22 23 write(*,*) "plausibility check:"24 write(*,'("y(1,1) ",f8.6)') y(1,1)25 write(*,'("y(n,m) ",f8.6)') y(n,m)26end subroutine saxpy27 28end module saxpymod29 30program main31 use iso_fortran_env32 use saxpymod, ONLY:saxpy33 implicit none34 35 integer,parameter :: n = 1000, m=1000036 real(kind=real32), allocatable, dimension(:,:) :: x, y37 real(kind=real32) :: a38 integer :: i39 40 allocate(x(1:n,1:m), y(1:n,1:m))41 a = 2.0_real3242 x(:,:) = 1.0_real3243 y(:,:) = 2.0_real3244 45 call saxpy(a, x, y, n, m)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,1) 4.053! CHECK: y(n,m) 4.054