brintos

brintos / llvm-project-archived public Read only

0
0
Text · 829 B · f7fef95 Raw
37 lines · plain
1! Offloading test with two target regions mapping the same declare target2! Fortran array and writing some values to it before checking the host3! correctly receives the correct updates made on the device.4! REQUIRES: flang, amdgpu5 6! RUN: %libomptarget-compile-fortran-run-and-check-generic7module test_08    implicit none9    integer :: sp(10) = (/0,0,0,0,0,0,0,0,0,0/)10    !$omp declare target link(sp)11end module test_012 13program main14    use test_015    integer :: i = 116    integer :: j = 1117 18!$omp target map(tofrom:sp) map(to: i, j)19    do while (i <= j)20        sp(i) = i;21        i = i + 122    end do23!$omp end target24 25!$omp target map(tofrom:sp) map(to: i, j)26    do while (i <= j)27        sp(i) = sp(i) + i;28        i = i + 129    end do30!$omp end target31 32print *, sp(:)33 34end program35 36! CHECK: 2 4 6 8 10 12 14 16 18 2037