[Openmp-commits] [openmp] [openmp][flang] Add tests for map clause (PR #70394)

via Openmp-commits openmp-commits at lists.llvm.org
Fri Oct 27 05:25:32 PDT 2023

agozillon wrote:

Awesome work, it would be cool to have an example like the following eventually: 

program main
    use omp_lib
    integer :: var1, var2
    common /var_common/ var1, var2
    var1 = 10
    var2 = 20
    print *, "var4 before target = ", var1
    !$omp target map(tofrom:var_common)
      var1 = var2
    !$omp end target
    print *, "var4 after target = ", var1

    if (var1 /= 20) then
        print*, "======= FORTRAN Test Failed! ======="
        stop 1    
    end if
  end program

Which I believe is legal Fortran+OpenMP @mjklemm or @kiranchandramohan may be able to clarify completely. The above example doesn't appear to work upstream or downstream from what I can tell though, so likely something for a future PR where we add the features needed to run it. The proper syntax for the map (at least from looking at some examples) also doesn't seem to get accepted currently either, I think it should be possible to write:

`!$omp target map(tofrom:/var_common/)`

With the"/" slashes, but the symbol unfortunately doesn't appear to be found currently when utilised like that. Someone with more Fortran and OpenMP knowledge might know better though, I am very unfamiliar with common blocks. 

But yes, things for the future. Otherwise this PR LGTM, nice work. 


More information about the Openmp-commits mailing list