CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
77 lines
1.8 KiB
Fortran
77 lines
1.8 KiB
Fortran
! Offloading test with a target region mapping a declare target Fortran array
|
|
! writing some values to it and checking the host correctly receives the
|
|
! updates made on the device.
|
|
! REQUIRES: flang, amdgpu
|
|
|
|
! RUN: %libomptarget-compile-fortran-run-and-check-generic
|
|
module test_0
|
|
implicit none
|
|
INTEGER :: arr1(10) = (/0,0,0,0,0,0,0,0,0,0/)
|
|
INTEGER :: arr2(10) = (/0,0,0,0,0,0,0,0,0,0/)
|
|
!$omp declare target link(arr1) enter(arr2)
|
|
INTEGER :: scalar = 1
|
|
!$omp declare target link(scalar)
|
|
end module test_0
|
|
|
|
subroutine test_with_array_link_and_tofrom()
|
|
use test_0
|
|
integer :: i = 1
|
|
integer :: j = 11
|
|
!$omp target map(tofrom:arr1, i, j)
|
|
do while (i <= j)
|
|
arr1(i) = i;
|
|
i = i + 1
|
|
end do
|
|
!$omp end target
|
|
|
|
! CHECK: 1 2 3 4 5 6 7 8 9 10
|
|
PRINT *, arr1(:)
|
|
end subroutine test_with_array_link_and_tofrom
|
|
|
|
subroutine test_with_array_link_only()
|
|
use test_0
|
|
integer :: i = 1
|
|
integer :: j = 11
|
|
!$omp target map(i, j)
|
|
do while (i <= j)
|
|
arr1(i) = i + 1;
|
|
i = i + 1
|
|
end do
|
|
!$omp end target
|
|
|
|
! CHECK: 2 3 4 5 6 7 8 9 10 11
|
|
PRINT *, arr1(:)
|
|
end subroutine test_with_array_link_only
|
|
|
|
subroutine test_with_array_enter_only()
|
|
use test_0
|
|
integer :: i = 1
|
|
integer :: j = 11
|
|
!$omp target map(i, j)
|
|
do while (i <= j)
|
|
arr2(i) = i + 1;
|
|
i = i + 1
|
|
end do
|
|
!$omp end target
|
|
|
|
! CHECK: 0 0 0 0 0 0 0 0 0 0
|
|
PRINT *, arr2(:)
|
|
end subroutine test_with_array_enter_only
|
|
|
|
subroutine test_with_scalar_link_only()
|
|
use test_0
|
|
!$omp target
|
|
scalar = 10
|
|
!$omp end target
|
|
|
|
! CHECK: 10
|
|
PRINT *, scalar
|
|
end subroutine test_with_scalar_link_only
|
|
|
|
program main
|
|
call test_with_array_link_and_tofrom()
|
|
call test_with_array_link_only()
|
|
call test_with_array_enter_only()
|
|
call test_with_scalar_link_only()
|
|
end program
|