xref: /llvm-project/offload/test/offloading/fortran/dump_map_tables.f90 (revision 372344995568cae076477a8b0e98fcdec7c49379)
1! Offloading test with runtine call to ompx_dump_mapping_tables Fortran array
2! writing some values and printing the variable mapped to device correctly
3! receives the updates made on the device.
4! REQUIRES: flang
5! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
6! UNSUPPORTED: aarch64-unknown-linux-gnu
7! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
8! UNSUPPORTED: x86_64-unknown-linux-gnu
9! UNSUPPORTED: x86_64-unknown-linux-gnu-LTO
10
11! RUN: %libomptarget-compile-fortran-run-and-check-generic
12
13program map_dump_example
14  INTERFACE
15    SUBROUTINE ompx_dump_mapping_tables() BIND(C)
16    END SUBROUTINE ompx_dump_mapping_tables
17  END INTERFACE
18
19  integer i,j,k,N
20  integer async_q(4)
21  real :: A(5000000)
22  N=5000000
23  do i=1, N
24    A(i)=0
25  enddo
26! clang-format off
27! CHECK: omptarget device 0 info: OpenMP Host-Device pointer mappings after block
28! CHECK-NEXT: omptarget device 0 info: Host Ptr Target Ptr Size (B) DynRefCount HoldRefCount Declaration
29! CHECK-NEXT: omptarget device 0 info: {{(0x[0-9a-f]{16})}} {{(0x[0-9a-f]{16})}}  20000000 1 0 {{.*}} at a(:n):21:11
30! clang-format on
31!$omp target enter data map(to:A(:N))
32  call ompx_dump_mapping_tables()
33!$omp target parallel do
34  do i=1, N
35    A(i)=A(i)*2
36  enddo
37!$omp target exit data map(from:A)
38end program
39