Hi Julian,

On 30.09.22 15:30, Julian Brown wrote:

  i = 1; j = 2
  map (foo(i)%dt_ptr(1:3), foo(j)%dt_ptr)


Good catch! In that gfc_dep_resolver considers those terms to have a
dependency, and that triggers the mapping node transformation. But I
don't think OpenMP allows you to write this: IIUC if "foo" is an array,
you're not allowed to separately map two parts of the array because of
(OpenMP 5.2, "5.8.3 map Clause"):

 "Two list items of the map clauses on the same construct must not
  share original storage unless they are the same list item or unless
  one is the containing structure of the other."


I was thinking of something like:

type t
 integer, pointer :: p(:)
end t
type(t2) :: var(2)
allocate (var(1)%p, source=[1,2,3,5])
allocate (var(2)%p, source=[2,3,5])

!$omp target map ( <somehow> )
 var(1)%p(1) = 5
 var(2)%p(2) = 7
!$omp end target


Similarly for C:

struct st {
 int *p;
};
struct st s[2];
s[0].p = (int*)__malloc(sizeof(int)*5);
s[1].p = (int*)__malloc(sizeof(int)*3);

#pragma omp target map( <somehow> )
{
 s[0].p[0] = 5;
 s[1].p[1] = 7;
}


And now I somehow need to map "p" in both the C and the Fortran case.
And I believe that should be possible...
and my
  i = 1; j = 2
  map (var(i)%p(1:3), var(j)%p)
or
 map (s[0].p[:3], s[1].p[:7])

does not look to far fetched to get this result ...

Tobias


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to